// JS Compilation Effects

// Form fields validation
function showContent(){
	$('.loading').hide();	
	$('.content_area').show().css('visibility','visible');
} 

function validateOnSubmit() {

	var emailFilter=/^.+@.+\..{2,3}$/;
	$(".validationresponse:visible").hide();

	if (jQuery.trim(document.formdata.txtFullname.value) == "") {
		document.formdata.txtFullname.value="";
		document.formdata.txtFullname.focus();
		addResponse("txtFullname",'Your full name is required');
		return false;
	}
	if (jQuery.trim(document.formdata.txtEmail.value) == "") {
		document.formdata.txtEmail.value="";
		document.formdata.txtEmail.focus();
		addResponse("txtEmail",'Email address is required');
		return false;
	}
	if (!(emailFilter.test(document.formdata.txtEmail.value))) {
		document.formdata.txtEmail.focus();
		addResponse("txtEmail",'Please enter a valid email address');
		return false;
	}
	if (jQuery.trim(document.formdata.txtBusinessTel.value) == "") {
		document.formdata.txtBusinessTel.value="";
		document.formdata.txtBusinessTel.focus();
		addResponse("txtBusinessTel",'Your Business Telephone required');
		return false;
	}
	if (jQuery.trim(document.formdata.txtMobile.value) == "") {
		document.formdata.txtMobile.value="";
		document.formdata.txtMobile.focus();
		addResponse("txtMobile",'Your mobile required');
		return false;
	}
	if (jQuery.trim(document.formdata.txtSubject.value) == "") {
		document.formdata.txtSubject.value="";
		document.formdata.txtSubject.focus();
		addResponse("txtSubject",'Subject is required');
		return false;
	}

	if (jQuery.trim(document.formdata.txtMessage.value) == "") {
		document.formdata.txtMessage.value="";
		document.formdata.txtMessage.focus();
		addResponse("txtMessage",'Your message required','textarea');
		return false;
	}

	if(jQuery.trim(document.formdata.captcha_code.value) == '') {
			document.formdata.captcha_code.value="";
			document.formdata.captcha_code.focus();
			addResponsenew("captcha_code",'Please enter the captcha code');
			return false;
	}
//	var capt =document.formdata.getElementById('captcha_code');


	return true;
}


function isAlphaNumeric(e){
	var unicode=e.charCode? e.charCode : e.keyCode
	if (unicode!=8 && unicode!=13 && unicode!=9){
		str=String.fromCharCode(unicode);
		var re = /^[a-z A-Z]+$/;
		 // validation fails if the input doesn't match the regular expression
		if(!re.test(str)){
			return false;
		}
	}
	return true;
}

function addResponse(name,msg,type) {
	if(type==null) { type="input" }
	$(type+"[name="+name+"]").next(".validationresponse").html(msg);
	$(type+"[name="+name+"]").next(".validationresponse").show('slow');
	return false;
}

function addResponsenew(name,msg){
	$("[name="+name+"]").parent().children(".validationresponse").html(msg);
	$("[name="+name+"]").parent().children(".validationresponse").show('slow');
	return false;
}

function addResponseCustom(id,msg) {
	$("#"+id).html(msg);
	$("#"+id).show('slow');
	return false;
}

// detect flash browser
function getFlashMovieObject(movieName) { 
	if (window.document[movieName]) { 
		return window.document[movieName]; 
	} 
	if (navigator.appName.indexOf("Microsoft Internet") == -1) { 
		if (document.embeds && document.embeds[movieName]) 
			return document.embeds[movieName]; 
	} 
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1) 
	{ 
		return document.getElementById(movieName); 
	} 
} 


$(function() {
	$(".month-list a").each(function(){
		$(this).click(function(){
			id=this.id;
			arr=id.split("_");
			ident=arr[arr.length-1];
			//content=$('#about_content_'+ident).html();
			$('.press_content').each(function(){
				$(this).show();
			});
			$('.press_content').each(function(){
				if(this.id!='press_content_'+ident){
					$(this).hide();
				}else{
					$(this).hide().fadeIn();
				}
			});
		});
	});
});

$(function() {
	$(".press_content_list a").each(function(){
		$(this).click(function(){
			id=this.id;
			arr=id.split("_");
			ident=arr[arr.length-1];
			//content=$('#about_content_'+ident).html();
			$('.press_textcontent').each(function(){
				$(this).show();
			});
			$('.press_textcontent').each(function(){
				if(this.id!='textpress_content_'+ident){
					$(this).hide();
				}else{
					$(this).hide().fadeIn();
				}
			});
		});
	});
});


function cuber_conf() {
  var vars = { xml_location : 'CU3ER-config.xml' };
  var params = { wmode: 'transparent' };
	//swfobject.embedSWF('swf/CU3ER.swf', "cu3er", 938, 287, "9.0.45", "swf/expressinstall.swf", vars, params );
	swfobject.embedSWF('swf/sounds.swf', "bgsound", 20, 15, "9.0.45", "swf/expressinstall.swf", vars, params );
	swfobject.embedSWF('swf/nurai-inside-bg-flash.swf', "bgFlashScr", 1010, 250, "9.0.45", "swf/expressinstall.swf", vars, params );
	swfobject.embedSWF('swf/nurai-inside-bg-flash-no-brown-wave.swf', "bgFlashScr1", 1010, 250, "9.0.45", "swf/expressinstall.swf", vars, params );
	swfobject.embedSWF('swf/press_video1.swf', "prvideo1", 300, 250, "9.0.45", "swf/expressinstall.swf", vars, params );
	//swfobject.embedSWF('details.swf', "floorplan", 1010, 500, "9.0.45", "swf/expressinstall.swf", vars, params );
}


function cufon_conf() {
	Cufon.set('fontFamily', 'HelveticaNeue')
		 .replace
			//('h1')('h2')('ul.mainmenu li a')('div.topmenu ul li a')
		 ;
	//Cufon.replace('div.innercontent_lvl1 h2, div.sub-innercontent h2', {fontSize: '22px', hover: {textShadow: '2px 2px #7b5f51', color: '-linear-gradient(#ffffff, #7b5f51)'}});
	//Cufon.replace('a.test', {fontSize: '20px', hover: {textShadow: '2px 2px #7b5f51', color: '-linear-gradient(#ffffff, #7b5f51)'}});
	//Cufon.replace('ul.mainmenu_main li a', {fontSize: '22px', textShadow: '0px 1px #b29983', hover: {textShadow: '0px 0px #5b2b04', color: '-linear-gradient(#5b2b04, #5b2b04)'}});
	//Cufon.replace('ul.mainmenu li a, span.title', {fontSize: '18px', hover: {textShadow: '0px 0px #7b5f51', color: '-linear-gradient(#ffffff, #7b5f51)'}});
	//Cufon.replace('span.title', {fontSize: '18px', hover: {textShadow: '0px 0px #7b5f51', color: '-linear-gradient(#ffffff, #7b5f51)'}});
	//Cufon.replace('div.topmenu ul li a', {fontSize: '9px', hover: {textShadow: '0px 0px #7b5f51', color: '-linear-gradient(#ffffff, #7b5f51)'}});
	Cufon.replace('ul.sub-menulist li a', {fontSize: '14px'});
	Cufon.replace('ul.sublink-menulist li a', {fontSize: '16px', hover: {textShadow: '0px 0px #7b5f51', color: '-linear-gradient(#572606, #572606)'}});

//Cufon.replace('ul.country_destination_list li a', {fontSize: '14px', hover: {textShadow: '0px 0px #b69015', color: '-linear-gradient(#ffffff, #e2cd88)'}});
}


// General
$(document).ready(function(){
						   

	// Main menu site navigation
	cufon_conf();



});	


window.onload = function(){
	//$('.submenu ul').show();
	showContent();
	//popup('popUpDiv');
}







