function invclose(el){
   $(el).parent().parent().remove();
}
function send(el){
   var way = window.location;
   $.ajax({
      type: "POST",
      url: "/invite.php",
      data: "email=" + $(el).parent().parent().find("#invemail").val() + "&name=" + $(el).parent().parent().find("#invname").val() + "&msg=" + way + "&fname=" +$(el).parent().parent().find("#invfname").val(),
      success: function(msg){
         if(msg=="OK"){
            $(el).parent().parent().remove();
         }
      }
   });
}



$(document).ready(function(){
   $(".invitesome").click(function(){
      $("body").append("<div style='background: #fff;z-index: 1000;position:fixed;top:35%;left:50%;margin-left:-150px;width:300px;border: 1px #000 solid;padding: 20px 20px 10px 20px;'><div style='padding-bottom: 10px;'>Email: <input type=\"text\" name=\"email\" id='invemail' value=\"\" /></div><div style='padding-bottom: 10px;'>\u0418\u043c\u044f: <input type=\"text\" name=\"name\" id='invname' value=\"\" /></div><div style='padding-bottom: 10px;'>\u0412\u0430\u0448\u0435 \u0438\u043c\u044f: <input type=\"text\" name=\"fname\" id='invfname' value=\"\" /></div><div><a href='#' onclick='invclose(this);return false;'>\u0417\u0430\u043a\u0440\u044b\u0442\u044c</a><a href='#' onclick='send(this);return false;' style='float: right;'>\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c</a></div></div>")
      return false;
   });
   // menu
   $("#menu > li > a").click( function(){
      if ( $(this).parent().find("ul").length == 1 ) {
         $(this).parent().find("ul").slideToggle("slow");
         $(this).parent().toggleClass('active');
         return false;
      }
   });
   //post-foto
   $("#h-link-other").click(function () {
      if ($.cookie("sitever") == "winter") {
         $.cookie("sitever", "summer", {
            path: "/",
            expires: 7
         });
      } else {
         $.cookie("sitever", "winter", {
            path: "/",
            expires: 7
         });
      }
      location.reload();
   });
   $('#h-pic0').cycle({
      fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
      timeout: 10000
   });
   $('#h-pic1').cycle({
      fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
      timeout: 10000
   });
   $('#h-pic2').cycle({
      fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
      timeout: 10000
   });
   $('#h-pic3').cycle({
      fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
      timeout: 10000
   });
   $('#h-pic4').cycle({
      fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
      timeout: 10000
   });
   // initialize scrollable
   $(".scrollable").scrollable();
});		
