jQuery.noConflict();
jQuery().ready(function(){

jQuery(".jTip").rightClick( function(e) {
  if(bookmark===0) {
  bookmark = 1;
  jQuery('#tooltip_hide').prependTo('#JT');
  jQuery('#tooltip_hide').show(); 
  }else if(bookmark===1) {
  bookmark = 0;
  jQuery('#tooltip_hide').prependTo('#container');
  jQuery('#tooltip_hide').hide();
  }
});

jQuery("#tooltip_hide").click(function(){
  jQuery('#tooltip_hide').prependTo('#container');
  jQuery('#tooltip_hide').hide();
  jQuery('#JT').remove();
  bookmark = 0;
});
     
jQuery("#login_link").click(function(){
jQuery("#login_slider").toggle("slow");
jQuery("#why_reg_slider").hide("slow");
jQuery("#reg_slider").hide("slow");
});

jQuery("#login_close").click(function(){
jQuery("#login_slider").hide("slow");
});

jQuery("#reg_link").click(function(){
jQuery("#reg_slider").toggle("slow");
jQuery("#login_slider").hide("slow");
jQuery("#why_reg_slider").hide("slow");
});

jQuery("#reg_close").click(function(){
jQuery("#reg_slider").hide("slow");
});

jQuery("#why_reg_link").click(function(){
jQuery("#why_reg_slider").toggle("slow");
jQuery("#login_slider").hide("slow");
jQuery("#reg_slider").hide("slow");
});

jQuery("#why_reg_close").click(function(){
jQuery("#why_reg_slider").hide("slow");
});

/*CHAT*/
function get_chat()
{
 var login = jQuery("#chat_login").val();
 var hash = jQuery("#chat_hash").val();
 //var t = new Date().getTime();
 var today=new Date();
 var s=today.getTime();
  jQuery("#chat_container").empty();
 //jQuery("#chat_container").load( 'ajax/get_chat_body.php?login='+login+'&hash='+hash + '&time='+new Date().getTime() ,chat_scroll() );
 jQuery.ajax({
   url: "ajax/get_chat_body.php",
   data: {login:login, hash:hash,time:s },
   dataType: "html",
   cache: "false",
   success: function(data){
       //alert(data);
       jQuery("#chat_container").append(data);
       jQuery("#chat_body").scrollTop(3000);
       },
    beforeSend: function(){
        // Handle the beforeSend event
        //jQuery("#chat_body").css( {borderWidth:"5px", borderStyle:"solid"} )
        //jQuery("#chat_form_button").css( {backgroundColor:"grey"} )
    },

    complete: function(){
        //jQuery("#chat_container").append(data);
        //chat_scroll();
        //jQuery("#chat_body").css( {borderWidth:"0px", borderStyle:"none"} )
        //jQuery("#chat_body").css( {backgroundColor:"white"} )
        //jQuery("#chat_form_button").css( {backgroundColor:"white"} )
    }
   });

}

function chat_scroll() {
jQuery("#chat_body").oneTime("0.5s", function() {
jQuery("#chat_body").scrollTop(3000);
});
}

jQuery("#chat_body").everyTime(21321, function() {
get_chat();
});

jQuery("#chat_form_button").click(function(){

 var login = jQuery("#chat_login").val();
 var hash = jQuery("#chat_hash").val();
 var text = jQuery("#chat_form_input").val();
 var today=new Date();
 var s=today.getTime();
 jQuery.ajax({
   url: "ajax/chat_send.php",
   data: {login:login, hash:hash, mess:text, secs:s},
   dataType: "html",
   type:"get",
   cache: "false",
   success: function(data){
       //alert(data);
       jQuery("#chat_form_input").attr("value","");
       get_chat();
       //chat_scroll();
       },
    beforeSend: function(){
        // Handle the beforeSend event
        jQuery("#chat_body").css( {borderWidth:"5px", borderStyle:"solid", borderColor: "#F36C22"} )
        //jQuery("#chat_form_button").css( {backgroundColor:"grey"} )
    },
    
    complete: function(){
        jQuery("#chat_body").css( {borderWidth:"0px", borderStyle:"none"} )
        //jQuery("#chat_body").css( {backgroundColor:"white"} )
        //jQuery("#chat_form_button").css( {backgroundColor:"white"} )
    }
   });
});

jQuery("#chat_open").click(function(){
jQuery("#second_line").hide();
jQuery("#first_line_b").css({display:"block"});
get_chat();
});

jQuery("#exit_chat").click(function(){
jQuery("#first_line_b").hide();
jQuery("#second_line").css({display:"block"});
});


jQuery("#first_line_b").hide();
get_chat();


/* CHAT */


/* billboard */
 jQuery(".billboard_submenu2_element").bind("click", function(event){
 var item_id = jQuery(this).attr("id");
 var today=new Date();
 var s=today.getTime();
 jQuery("#billboard_submenu2 span").removeClass("billboard_submenu2_active");
 jQuery("#billboard_submenu2 span").addClass("billboard_submenu2_element");
 jQuery(this).removeClass("billboard_submenu2_element");
 jQuery(this).addClass("billboard_submenu2_active");

 jQuery.ajax({
   url: "/ajax/get_cinema_mov.php",
   data: { cin_id:item_id, type:"cin_data" },
   dataType: "html",
   cache: "false",
   success: function(data){
        jQuery("#billboard_box").html(data);
        jQuery('#billboard_container').unblock();
       },
    beforeSend: function(){
        jQuery('#billboard_container').block({
        message: "<h3>Идет загрузка...</h3>",
        css: { backgroundColor: "#6b6b6b",color: "#fff", opacity: .5 ,paddingTop: "70px", fontFamily: "Arial",left: "0", width: "405px" ,height: "80px" ,borderWidth: "0" },
        overlayCSS: { backgroundColor: "#c5c5c5"  }
        });
    },
    complete: function(data){
        //jQuery("#chat_form_button").css( {backgroundColor:"white"} )
    }
   });
 
  });
  /**/

});
