
var popUpActive = false;

boxT = new Image(300,10);
boxT.src="http://"+site+"/imgs/t.gif";
boxB = new Image(300,10);
boxB.src="http://"+site+"/imgs/b.gif";

loadingPic = new Image(32,32); 
loadingPic.src="http://"+site+"/imgs/loader.gif"; 


function popUpClose()
{	

	$("#mask").hide();
	$("#popup").hide();
	
	popUpActive = false;


}


		function register()
		{	


		popUpActive = true;


			var regLayer = document.getElementById("popup");


        var maskHeight = $(document).height();  
         var maskWidth = $(window).width();  

        $('#mask').css({'width':maskWidth,'height':maskHeight,"opacity":0.7});  
          
         $('#mask').fadeIn(100);

		 
		 regLayer.innerHTML = "<div class='box'><table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">  <tr>    <td><div class=\"boxtop\"></div></td>  </tr>  <tr>    <td bgcolor=\"white\">  <div class='boxcontent'>	<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">  <tr>    <td align=\"left\" valign=\"top\"><span style=\"color:#03c6cb;font-size:24px;font-weight:bold;padding-left:10px\">Регистрация</span></td>    <td align=\"right\" valign=\"top\"><a href=\"javascript:void(null)\" title=\"Закрыть\" onclick=\"popUpClose();return false;\"><img border=\"0\" style=\"float:right;padding-right:10px\" src=\"http://"+site+"/imgs/close.png\" /></a></td>  </tr></table><div id=\"popup_msg\"></div><div id=\"regForm\" style=\"padding-top:20px;padding-bottom:20px\"><form action=\"javascript:getRegister()\" id=\"regform\" name=\"regform\" method=\"post\"><table width=\"280\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\" style='padding-right:20px;'><tr><td width=\"110\" align=\"right\">Email: </td><td width=\"170\"><input id=\"email\" name=\"email\" type=\"text\" value=\"\" /></td></tr><tr><td align=\"right\">Пароль: </td><td><input id=\"pass\" name=\"pass\" type=\"password\" maxlength=\"17\" value=\"\" /><div style=\"font-size:12px;color:#03c6cb\">от 7ми символов</div></td></tr><tr><td align=\"right\">еще раз: </td><td><input id=\"pass2\" name=\"pass2\" type=\"password\" maxlength=\"17\" value=\"\" /></td></tr></table><br /><input type='image' src='http://"+site+"/imgs/ok.png'/></form></div></div></td>  </tr>  <tr>    <td height=\"10\"> <div class=\"boxbottom\"></div></td>  </tr></table></div>";



		regLayer.style.position = "fixed";
	$('#popup').fadeIn(500);

			
			regLayer.style.top = "50%";
			regLayer.style.left = "50%";
			regLayer.style.marginLeft = "-150px";
			regLayer.style.marginTop = "-75px";
			
			
			
			regLayer.style.zIndex = "9999";

			$(".boxcontent").css("height","210px");

		}



function authorize()
{	

popUpActive = true;

		

			var authLayer = document.getElementById("popup");
			


        var maskHeight = $(document).height();  
         var maskWidth = $(window).width();  

       
        $('#mask').css({'width':maskWidth,'height':maskHeight,"opacity":0.7});  
           
         $('#mask').fadeIn(100);


				 authLayer.innerHTML = "<div class='box'><table width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">  <tr>    <td><div class=\"boxtop\"></div></td>  </tr>  <tr>    <td bgcolor=\"white\">  <div class='boxcontent'>	<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">  <tr>    <td align=\"left\" valign=\"top\"><span style=\"color:#03c6cb;font-size:24px;font-weight:bold;padding-left:10px\">Авторизация</span></td>    <td align=\"right\" valign=\"top\"><a href=\"javascript:void(null)\" title=\"Закрыть\" onclick=\"popUpClose();return false;\"><img border=\"0\" style=\"float:right;padding-right:10px\" src=\"http://"+site+"/imgs/close.png\" /></a></td>  </tr></table><div id=\"popup_msg\"></div><div id=\"authForm\" style=\"padding-top:20px;padding-bottom:20px\"><form action=\"javascript:getAuth()\" id=\"authform\" name=\"authform\" method=\"post\"><table width=\"280\" border=\"0\" cellpadding=\"3\" cellspacing=\"3\" style='padding-right:20px;'><tr><td width=\"110\" align=\"right\">Email: </td><td width=\"170\"><input id=\"email\" name=\"email\" type=\"text\" value=\"\" /></td></tr><tr><td align=\"right\">Пароль: </td><td><input id=\"pass\" name=\"pass\" type=\"password\" maxlength=\"17\" value=\"\" /></table><br /><input type='image' src='http://"+site+"/imgs/ok.png'/></form></div></div></td>  </tr>  <tr>    <td height=\"10\"> <div class=\"boxbottom\"></div></td>  </tr></table></div>";

		
		authLayer.style.position = "fixed";
	$('#popup').fadeIn(500);

			
			authLayer.style.top = "50%";
			authLayer.style.left = "50%";
			authLayer.style.marginLeft = "-150px";
			authLayer.style.marginTop = "-75px";
			
			
			
			authLayer.style.zIndex = "9999";

			$(".boxcontent").css("height","170px");

}



		function getRegister()
		{

		 var email = $("input#email").val();  
		 var pass = $("input#pass").val();
		 var pass2 = $("input#pass2").val();

		 var dataString = 'm=reg&email='+ email + '&pass=' + pass + '&pass2=' + pass2 ; 
		 
		 $.ajax({
		   type: "POST",
		   url: "http://"+site+"/registered.php",
		   data: dataString,
		   success: function(msg){
		  
			eval(msg);
			var reg_status = reg_response[0];
			var reg_message = reg_response[1];
		
			if (reg_status == true)
			{

				$('.boxcontent').css("height","100px");
				$('.boxcontent').html(reg_message);

				window.location = 'http://'+site+'/';

			}
				
					
			if (reg_status == false)
			   {
	
				$('.boxcontent').css("height","240px");

				$('#popup_msg').css("padding-top","20px");
				
				$('#popup_msg').html(reg_message);


			   }
			 
			 
		   }

		 });

		}




		function getAuth()
		{

		


		 var email = $("input#email").val();  
		 var pass = $("input#pass").val();  
		 var dataString = 'm=auth&email='+ email + '&pass=' + pass ; 
		 
		 $.ajax({
		   type: "POST",
		   url: "http://"+site+"/registered.php",
		   data: dataString,
		   success: function(msg){
		  
				eval(msg);
				var auth_status = reg_response[0];
				var auth_message = reg_response[1];
				
				
				if (auth_status == true)
				{
				

				$('.boxcontent').css("height","100px");
				$('.boxcontent').html(auth_message);
				
				
				window.location = 'http://'+site+'/';
			}
				
					
			if (auth_status == false)
			   {
	
				$('.boxcontent').css("height","200px");

				$('#popup_msg').css("padding-top","20px");
				
				$('#popup_msg').html(auth_message);

			   }
			 
			 
		   }

		 });

		}




function logout()
{
		 

		 var dataString = 'm=logout'; 
		 
		 $.ajax({
		   type: "POST",
		   url: "http://"+site+"/registered.php",
		   data: dataString,
		   success:function(msg){

				window.location = 'http://'+site+'/';


		   }
		 });



}


/////////////////////////////////////////////////////////////

function submitForm()
{

$("#iloading").css("top","-275px");
$("#iloading").css("left","250px");
$("#iloading").html("<img src=\"http://"+site+"/imgs/loader.gif\" />");


$(".ac_results").hide();
document.formsearch.submit();
}


$(document).ready(function() {	

	$("#test").mouseover(function(){
		alert('here');
      $("#sitelogo").css("cursor","pointer");
    });

	$('#mask').click(function () {
		 		
		popUpClose();
		

	});			

	$('#playlink_container').css("top","-950px");
	$('#playlink_container').css("visibility","visible");
	
	 	$('#playlink_container').stop().animate({
			top: -420+"px"
		}, {
			duration: 1000,
			easing: "easeOutBounce"
		});


});



var sitelogoFlashVars
{
};


var sitelogoParams =
{
	bgcolor: '#FFFFFF',
	wmode: 'opaque'
};




swfobject.embedSWF('http://'+site+'/indexlogo.swf', 'sitelogo', '350', '250', '9.0.0', "expressInstall.swf", sitelogoFlashVars, sitelogoParams);

