// JS Compilation Effects

// Form fields validation
function showContent(){
	$('#loading').hide();	
	$('#content').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() {
	$(".cocktailslist a").each(function(){
		$(this).click(function(){
			id=this.id;
			arr=id.split("_");
			ident=arr[arr.length-1];
			//content=$('#about_content_'+ident).html();
			$('.cocktailscontent').each(function(){
				$(this).show();
			});
			$('.cocktailscontent').each(function(){
				if(this.id!='c_content_'+ident){
					$(this).hide();
				}else{
					$(this).hide().fadeIn();
				}
			});
		});
	});
});


function playvideo() {
	// Overlay content
	var p1 = flowplayer("p1", "swf/flowplayer-3.1.5.swf"); 
	var p2 = flowplayer("p2", "swf/flowplayer-3.1.5.swf"); 
	 
	// setup button action. it will fire our overlay  
	$('a[rel="#vid1"]').overlay({			 
		effect: 'apple', 
		onLoad: function() { p1.load(); }, 
		onClose: function() { p1.unload(); } 
	}); 
	$('a[rel="#vid2"]').overlay({			 
		effect: 'apple', 
		onLoad: function() { p2.load(); }, 
		onClose: function() { p2.unload(); } 
	}); 
}

function pdf_popup_win() {
	$('#rmenu, #lmenu, #wmenu').popupWindow({width:800,	height:600,	centerScreen:1});
}

function cufon_conf() {
	Cufon.set('fontFamily', 'Libel Suit')
		 .replace
			('h1')('h2')('div.subcontentarea h2')
			//('h1, h2, div.services_teaser_panel h2, div.nl-content h2, div.nl-content p, a.link3')
		 ;
	Cufon.replace('h1', {fontSize: '20px'});
	Cufon.replace('h2, div.subcontentarea h2, div.exp_contentarea ul li h3', {fontSize: '27px', color: '-linear-gradient(#d4bc84, #978353)'});
	Cufon.replace('div.exp_contentarea ul li h3, div.taste_contentarea ul li h3, div.specs h3', {fontSize: '24px', color: '-linear-gradient(#d4bc84, #978353)'});
	Cufon.replace('div.exp_contentarea ul li a', {fontSize: '20px', color: '-linear-gradient(#d4bc84, #978353)'});
	Cufon.replace('li.leftpan a', {fontSize: '20px', hover: {textShadow: '0px 0px #b69015', color: '-linear-gradient(#d4bc84, #978353)'}});

}


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/menu.swf', "flashmenu", 938, 125, "9.0.45", "swf/expressinstall.swf", vars, params );
	swfobject.embedSWF('swf/cavalli-flash-slides.swf', "flashslides", 934, 317, "9.0.45", "swf/expressinstall.swf", vars, params );
	swfobject.embedSWF('swf/sounds.swf', "sound", 155, 30, "9.0.45", "swf/expressinstall.swf", vars, params );
}


// General
$(document).ready(function(){
	cufon_conf();
});	


window.onload = function(){
	//$('.submenu ul').show();
	//showContent();
	//popup('popUpDiv');
}







