$(function(){


	$("#home").mouseover(function(){
		//alert($(this).children().children().html());
		//$("#menu01").show();
		$("#menu01").show();
	}).mouseout(function(){ 
		$("#menu01").hide();
	});
	$("#contactsUs").mouseover(function(){
		$("#menu02").show();
	}).mouseout(function(){ 
		$("#menu02").hide();
	});
	/*$("#partyr").mouseover(function(){
		$("#menu03").show();
	}).mouseout(function(){ 
		$("#menu03").hide();
	});	
	$("#jobs").mouseover(function(){
		$("#menu04").show();
	}).mouseout(function(){ 
		$("#menu04").hide();
	});
	$("#spe").mouseover(function(){
		$("#menu05").show();
	}).mouseout(function(){ 
		$("#menu05").hide();
	});	*/
	
	$('#submit_form').click(function(){
		var name = $("#name").val();
		var email = $("#email").val();
		if(name == ""){
			alert("Name is required");
			return;
		}
		if(email == ""){
			alert("Email is required");
			return;
		}
		if(!validateEmail(email)){
			alert("Please input a valid email address.");
			return; 
		}
		$("#emailUs").submit();
		});	
	function validateEmail(email) {
		if (email.length <= 0) {		
			return false;
		} else {
			var splitted = email.match("^(.+)@(.+)$");
			if (splitted == null) {
				return false;
			}
			if (splitted[1] != null ) {
				var regexp_user=/^\"?[\w-_\.]*\"?$/;
				if(splitted[1].match(regexp_user) == null) return false;
			}
			if (splitted[2] != null)	{
				var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
				if (splitted[2].match(regexp_domain) == null) {
					var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
					if (splitted[2].match(regexp_ip) == null) {
						return false;
					}
				}
				return true;
			}
			return false;
		}
	}
});
function openWindow(tPage, tWidth, tHeight) {
		var windowWidth = window.screen.width;
	    var windowHeight = window.screen.height;
	    var curLeft = windowWidth/2 - 200;
	    var curTop = windowHeight/2 - 170;
		var win = window.open(tPage,'','toolbar=no,scrollbars=no,resizable=yes,width=' + tWidth + ',height=' + tHeight + ',top=' + curTop + ',left=' + curLeft);
		win.focus();
	}