function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}

$(document).ready(function(){

$("#mail").defaultvalue("Электронная почта для уведомления об открытии");

$("#mail").keyup(function(){
		var email = $("#mail").val();
		if(email != 0)
		{
		if(isValidEmailAddress(email))
		{
		
			$(this).animate({backgroundColor:"#E1FCC6"});
			$("#submit").show("fast");
		
		} else {
		
			$(this).animate({backgroundColor:"#FFDCF3"});
			$("#submit").hide("fast");
		
		}
		
		} else {
		
			$(this).animate({backgroundColor:"#fffff"});
			$("#submit").hide("fast");
		}
	});
	
	
/*$("#mail").onPaste(function() {
	$(this).keyup()
});*/



$("#logotype").hover(function(){
	
	colors = new Array(13)
	colors[0]="fce05f"
	colors[1]="fcf361"
	colors[2]="fcf361"
	colors[3]="eafd81"
	colors[4]="adfc5f"
	colors[5]="5ffcb4"
	colors[5]="9ffde2"
	colors[6]="5feffc"
	colors[7]="5fd5fc"
	colors[8]="5f9afc"
	colors[9]="5f5ffc"
	colors[10]="ac5ffc"
	colors[11]="e45ffc"
	colors[12]="ff9edc"
	colors[13]="ff9edc"
	
	tcolors = new Array(13)
	tcolors[0]="7e7030"
	tcolors[1]="736f2c"
	tcolors[2]="615e25"
	tcolors[3]="596031"
	tcolors[4]="446325"
	tcolors[5]="245f44"
	tcolors[5]="41675c"
	tcolors[6]="29666c"
	tcolors[7]="fff"
	tcolors[8]="fff"
	tcolors[9]="fff"
	tcolors[10]="fff"
	tcolors[11]="fff"
	tcolors[12]="59374d"
	tcolors[13]="59374d"
	
	var color = new String;
	var tcolor = new String;
	var numcolor = Math.round(Math.random()*13);
	color = colors[numcolor];
	tcolor = tcolors[numcolor];
	$("#info").animate({ backgroundColor:"#"+ color, color:"#" + tcolor });
	$("#info-content").animate({ backgroundColor:"#"+ color });
	$("#info-content table td").animate({ color:"#" + tcolor });
});

$("#info").toggle(function(){
	$(this).animate({top:"0px"});
	$("#info-content").animate({top:"0px"});
},
function(){
	$(this).animate({top:"165px"});
	$("#info-content").animate({top:"165px"});
});

});

