var lwr = 'abcdefghijklmnopqrstuvwxyz';
var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var dig = '1234567890';
var space= ' ';
var symbol='-';
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
function isValid(parm,val) 
{
  for (i=0; i<parm.length; i++) 
  {
    if (val.indexOf(parm.charAt(i),0) == -1) return false;
  }
  return true;
}
function isEmpty(textvalue) {
	textvalue=textvalue.replace(/\s/g,"");
	if(textvalue.length>0)
		return false;
	else
		return true;
}
function validURL(url){
	var elval= url.value.replace(/[\n\r\s]+/,"");
	if(elval =="") return true;
	var str=url.value;
	if(1){
		var filter=/^((ht|f)tp(s?))(:((\/\/)(?!\/)))(((w){3}\.)?)([a-zA-Z0-9\-_\.]+(\.(com|edu|gov|int|mil|net|org|biz|info|name|pro|museum|co\.uk|in)))((?!\/))(([a-zA-Z0-9\-_\/]*)?)$/i      
	}
	if (filter.test(str))
		testresults=true;
	else
		testresults=false;
		
	return (testresults);
}

function validateFileExtension(fileName,fileType)
{

	// for mac/linux, else assume windows
    if (navigator.appVersion.indexOf('Mac') != -1 || navigator.appVersion.indexOf('Linux') != -1)
        var fileSplit = '/';
    else
        var fileSplit = '\\';

    if(fileType == 'F') 
    	var allowedFileTypes = new Array('.bmp', '.gif', '.jpg', '.jpeg', '.doc', '.docx', '.pdf', '.ppt', '.vsd', '.xls', '.pub','.BMP', '.GIF', '.JPG', '.JPEG', '.DOC', '.DOCX', '.PDF', '.PPT', '.VSD', '.XLS', '.PUB', '.txt', '.TXT'); // valid filetypes
    else
    	var allowedFileTypes = new Array('.bmp', '.gif', '.jpg', '.jpeg', '.png','.BMP', '.GIF', '.JPG', '.JPEG', '.PNG', '.txt', '.TXT'); // valid filetypes
    	
    var extension = fileName.substr(fileName.lastIndexOf('.'), fileName.length);
    var valid = 0;
    
    for(var i in allowedFileTypes)
    {
        if(allowedFileTypes[i] == extension)
        {
            valid = 1;
            break;
        }
    }
    
    if(valid == 1)
        return true;
    else
        return false;
    
}


function extractFileNameFromPath(temp1) 
{
	fileName="";
	
	var temp2 = null;// new Array(); 
	
	if (temp1.indexOf(':') !=-1)
	{
		temp1 = temp1.substring(2); 
		temp2 = temp1.split("\\");
	}
	else 
	{
		temp2 = temp1.split("/");
	}       
	
	for(i=0; i<temp2.length; i++) 
	{
		fileName = temp2[i];
	}
	
	return fileName;
}


function checkDomain(nname)
{
	var arr = new Array(
	'.com','.net','.org','.biz','.coop','.info','.museum','.name',
	'.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',
	'.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',
	'.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',
	'.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',
	'.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',
	'.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',
	'.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',
	'.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',
	'.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',
	'.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',
	'.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
	'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',
	'.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',
	'.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',
	'.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',
	'.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',
	'.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',
	'.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',
	'.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',
	'.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',
	'.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',
	'.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',
	'.wf','.ye','.yt','.yu','.za','.zm','.zw');

	var mai = nname;
	var val = true;
	
	var dot = mai.lastIndexOf(".");
	var dname = mai.substring(0,dot);
	var ext = mai.substring(dot,mai.length);
	//alert(ext);
		
	if(dot>2 && dot<57)
	{
		for(var i=0; i<arr.length; i++)
		{
		  if(ext == arr[i])
		  {
		 	val = true;
			break;
		  }	
		  else
		  {
		 	val = false;
		  }
		}
		if(val == false)
		{
		  	 alert("Your domain extension "+ext+" is not correct.");
			 return false;
		}
		else
		{
			for(var j=0; j<dname.length; j++)
			{
			  var dh = dname.charAt(j);
			  var hh = dh.charCodeAt(0);
			  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)
			  {
				 if((j==0 || j==dname.length-1) && hh == 45)	
			  	 {
			 	  	 alert("Domain name should not begin are end with '-'.");
				      return false;
			 	 }
			  }
			else	{
			  	 alert("Your domain name should not have special characters.");
				 return false;
			  }
			}
		}
	}
	else
	{
		alert("Your domain name is not valid.");
		return false;
	}	
	
	return true;
}


function viewToolTip(id,parentId,posX,posY)
{
	
	it = document.getElementById(id);
	 if ((it.style.top == '' || it.style.top == 0) 
        && (it.style.left == '' || it.style.left == 0))
    {
        // need to fixate default size (MSIE problem)
        it.style.width = it.offsetWidth + 'px';
        it.style.height = it.offsetHeight + 'px';
        
        img = document.getElementById(parentId); 
    
        // if tooltip is too wide, shift left to be within parent 
        if (posX + it.offsetWidth > img.offsetWidth) posX = img.offsetWidth - it.offsetWidth;
        if (posX < 0 ) posX = 0; 
        
        x = xstooltip_findPosX(img) + posX;
        y = xstooltip_findPosY(img) + posY;
        
        it.style.top = y + 'px';
        it.style.left = x + 'px';
    }
    


	it.style.visibility = 'visible'; 
}

function xstooltip_findPosX(obj) 
{
  var curleft = 0;
  if (obj.offsetParent) 
  {
    while (obj.offsetParent) 
        {
            curleft += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}

function xstooltip_findPosY(obj) 
{
    var curtop = 0;
    if (obj.offsetParent) 
    {
        while (obj.offsetParent) 
        {
            curtop += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}


function hideToolTip(id)
{
    it = document.getElementById(id); 
    it.style.visibility = 'hidden'; 
}

function get_subcategories(){
	var d=document.getElementById('subcategories');
	 d.style.display = 'block'; 
}
/*
function get_subknife(){
	var d=document.getElementById('subknife');
	 d.style.display = 'block'; 
}
*/


 function checkAll(chk) {

 	for (var i=0;i < document.forms[0].elements.length;i++)
	{
		var e = document.forms[0].elements[i];
		if (e.type == "checkbox")
		{
			e.checked = chk.checked;
		}
	}
 }
 
function checkAllNew(chk,frm,frm2) {

	var formelements = eval("document."+frm+".elements");
 	
 	//alert(formelements.length);
 	for (var i=0;i < formelements.length;i++)
	{
		//alert(formelements[i].type);
		var e = formelements[i];
		if (e.type == "checkbox")
		{
			e.checked = chk.checked;
		}
	}
 } 
 
 
 
 function selectActionNew(frm1,frm2) {
 	
	var formelements1 = eval("document."+frm1);
	var formelements2 = eval("document."+frm2);
 	
	
 	
 	if (isEmpty(document.getElementById('selAction').value)) {
		 alert("Please select the action to be performed.");
		 document.getElementById('selAction').focus();
		 return false;
	 }
	

	 if (checkFormNew(frm1 ,frm2) == true) {
		formelements1.selectedAction.value = formelements2.selAction.value;
		//document.forms[0].mode.value = "performAction";
		
		if (formelements1.selectedAction.value != "delete") {
			formelements1.mode.value = "performAction";
		}
		else {
			formelements1.mode.value = "performDelete";
		}
		
		formelements1.submit();
	 }
	 else {
		 return false;
	 }
 }

function checkFormNew(frm1, frm2)
{
	
	var formelements1 = eval("document."+frm1);
	var formelements2 = eval("document."+frm2);

	var count=0;
	var msg;
	for (var i=0;i < formelements1.elements.length;i++)
	{
		var e = formelements1.elements[i];
		if (e.type == "checkbox")
		{
			if(e.checked)
				count=count+1;
		}
	}

	if(count==0)
	{
		alert("Please select atleast one record");	
		return false;	
	}
	else
	{
		if (formelements2.selAction.value != "delete"){
			msg="Are you sure that you want to change the status?";
		}
		else {
			msg="Are you sure that you want to delete the selected record(s)?";
		}
		return confirm(msg);
	}

}//checkform

function selectAction() {
	 if (isEmpty(document.getElementById('selAction').value)) {
		 alert("Please select the action to be performed.");
		 document.getElementById('selAction').focus();
		 return false;
	 }


	 if (checkForm() == true) {
		document.forms[0].selectedAction.value = document.forms[1].selAction.value;
		//document.forms[0].mode.value = "performAction";
		
		if (document.forms[0].selectedAction.value != "delete") {
			document.forms[0].mode.value = "performAction";
		}
		else {
			document.forms[0].mode.value = "performDelete";
		}
		
		document.forms[0].submit();
	 }
	 else {
		 return false;
	 }
 }

function checkForm()
{
	var count=0;
	var msg;
	for (var i=0;i < document.forms[0].elements.length;i++)
	{
		var e = document.forms[0].elements[i];
		if (e.type == "checkbox")
		{
			if(e.checked)
				count=count+1;
		}
	}

	if(count==0)
	{
		alert("Please select atleast one record");	
		return false;	
	}
	else
	{
		if (document.forms[1].selAction.value != "delete"){
			msg="Are you sure that you want to change the status?";
		}
		else {
			msg="Are you sure that you want to delete the selected record(s)?";
		}
		return confirm(msg);
	}

}//checkform




function setUsageCharge() {
	newKnifeCost = parseFloat(document.getElementById('KniferegisterNewCost').value);
	oneTwentithCost = parseFloat(newKnifeCost/20);
	// 25 is hardcoded as per the client's document Knife Register Brief 3.
	// if 1/20th cost of new knife is less than 25 then the minimum usage charge will be $25;
	if (oneTwentithCost > 25) {
		document.getElementById('KniferegisterUsageCharge').value = oneTwentithCost;
	}
	else {
		document.getElementById('KniferegisterUsageCharge').value = 25;
	}
}

function hideShowKnifeAdvanceSearch()
{
	showStatus = document.getElementById('searchKnifeDiv').style.display;
	if(showStatus == 'block')
	{	
		document.getElementById('hidIsDivBlock').value = "No";
		document.getElementById('advanceSearch').innerHTML = "Advance Search";
		document.getElementById('advanceSearch').title = "Advance Search";
		document.getElementById('searchKnifeDiv').style.display = "none";
	}	
	else
	{
		document.getElementById('hidIsDivBlock').value = "Yes";
		document.getElementById('advanceSearch').innerHTML = "Simple Search";
		document.getElementById('advanceSearch').title = "Simple Search";
		document.getElementById('searchKnifeDiv').style.display = "block";        
	}	
}

function hideShowProcurementAdvanceSearch()
{
	showStatus = document.getElementById('searchProcurementDiv').style.display;
	if(showStatus == 'block')
	{	
		document.getElementById('hidIsDivBlock').value = "No";
		document.getElementById('advanceSearch').innerHTML = "Advance Search";
		document.getElementById('advanceSearch').title = "Advance Search";
		document.getElementById('searchProcurementDiv').style.display = "none";
	}	
	else
	{
		document.getElementById('hidIsDivBlock').value = "Yes";
		document.getElementById('advanceSearch').innerHTML = "Simple Search";
		document.getElementById('advanceSearch').title = "Simple Search";
		document.getElementById('searchProcurementDiv').style.display = "block";        
	}	
}


//----------------------- Miscellaneous functions ---------------------//

// This function is used to validate a given e-mail 
// address for the proper syntax

function validateEmail(email)
{
	
	if (email == ""){
		return false;
	}
	badStuff = ";:/,' \"\\";
	for (i=0; i<badStuff.length; i++){
		badCheck = badStuff.charAt(i)
		if (email.indexOf(badCheck,0) != -1){
			return false;
		}
	}
	posOfAtSign = email.indexOf("@",1)
	if (posOfAtSign == -1){
		return false;
	}
	if (email.indexOf("@",posOfAtSign+1) != -1){
		return false;
	}
	posOfPeriod = email.indexOf(".", posOfAtSign)
	if (posOfPeriod == -1){
		return false;
	}
	if (posOfPeriod+2 > email.length){
		return false;
	}
	return true
}

//The function is to check the extension of the file.

function checkFileExtension(file)
{
	
	if(file != "") {
		extArray = new Array(".pdf", ".indd");
		while (file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();

		for (var i = 0; i < extArray.length; i++) {
			if (extArray[i] == ext) {
				allowSubmit =1 ; break;
			}
			else {	
				allowSubmit=2;
			}
	}

	if(allowSubmit==2) {
		alert("Only files with following extensions are allowed:  " 
		+ (extArray.join("  ")));
		return false;
	}
	  return true;
	}
	else {
		return false;
	}
}


//The function is to check the specified extension of the file.

function checkFileExtensionArray(file, extArray)
{
	
	if(file != "") {
		//extArray = new Array(".pdf", ".indd");
		while (file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();

		for (var i = 0; i < extArray.length; i++) {
			if (extArray[i] == ext) {
				allowSubmit =1 ; break;
			}
			else {	
				allowSubmit=2;
			}
	}

	if(allowSubmit==2) {
		alert("Only files with following extensions are allowed:  " 
		+ (extArray.join("  ")));
		return false;
	}
	  return true;
	}
	else {
		return false;
	}
}

//The function is to open the popup window of given width and height for a given URL

function openPopUpWindow(url, width, height) {
	window.open(url, 'popupwindow', 'width=' + width + ', height=' + height + ', scrollbars = yes, statusbar = no');
}

// The function add the option in a drop down list.

function addOption(selectBoxId, text, value) {
	 var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	elementId = eval("document.getElementById('" + selectBoxId + "')");
	elementId.options.add(optn);
}


function redirectToPage(pagePath) {
	window.location.href = pagePath;
}

function validate_finishingstatus(){
	
	if (isEmpty(document.getElementById('FinishingProcessId').value)) {
		alert("Please select the process.");
		document.getElementById('FinishingProcessId').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('FinishingMcodes').value)) {
		alert("Please select machine code.");
		document.getElementById('FinishingMcodes').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('FinishingWorkstatus').value)) {
		alert("Please select Status.");
		document.getElementById('FinishingWorkstatus').focus();
		return false;
	}	

	alert("Work status will be saved when clicked.");
	return false;

}

function getGoingTOPoscodesForCity(path,cityId)
{
	new Ajax.Updater('going_postcode_div',''+ path +'/bookingdetails/getpostcodeforcity/'+cityId, {asynchronous:true, evalScripts:true});
}

function getCollectionPoscodesForCity(path,cityId)
{
	new Ajax.Updater('colection_postcode_div',''+ path +'/bookingdetails/getpostcodeforcollectioncity/'+cityId, {asynchronous:true, evalScripts:true});
}

function getGoingTOPoscodesForCityForHome(path,cityId)
{
	new Ajax.Updater('going_postcode_div',''+ path +'/chauffeurs/getpostcodeforcity/'+cityId, {asynchronous:true, evalScripts:true});
}

function getCollectionPoscodesForCityForHome(path,cityId)
{
	new Ajax.Updater('colection_postcode_div',''+ path +'/chauffeurs/getpostcodeforcollectioncity/'+cityId, {asynchronous:true, evalScripts:true});
}

/**
	This function will for client side validation for Contact Us page.
*/

function validate_contactus(){
		
	//Validations for Passenger Details
	if (isEmpty(document.getElementById('ContactName').value)) 
	{
		alert("Please enter your name.");
		document.getElementById('ContactName').focus();
		return false;
	}	
	
	if (isEmpty(document.getElementById('ContactEmail').value)) 
	{
		alert("Please enter your email address.");
		document.getElementById('ContactEmail').focus();
		return false;
	}
	
	if(!validateEmail(document.getElementById('ContactEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('ContactEmail').focus();
		return false;
	}
	
	if (isEmpty(document.getElementById('day_to_contact').value)) {
		alert("Please enter day to contact.");
		document.getElementById('day_to_contact').focus();
		return false;
	}		

	//Validations for best time to contact start here.
	if ((isEmpty(document.getElementById('ContactBestTimeHourRequired').value)) && (isEmpty(document.getElementById('ContactBestTimeMinuteRequired').value))) 
	{
		alert("Please select time to contact.");
		document.getElementById('ContactBestTimeHourRequired').focus();
		return false;
	}
	
	if ((isEmpty(document.getElementById('ContactBestTimeHourRequired').value)) && (!isEmpty(document.getElementById('ContactBestTimeMinuteRequired').value))) 
	{
		alert("Please select valid time to contact.");
		document.getElementById('ContactBestTimeHourRequired').focus();
		return false;
	}

	if ((!isEmpty(document.getElementById('ContactBestTimeHourRequired').value)) && (isEmpty(document.getElementById('ContactBestTimeMinuteRequired').value))) 
	{
		alert("Please select valid time to contact.");
		document.getElementById('ContactBestTimeHourRequired').focus();
		return false;
	}
	//Validations for best time to contact end here.
	
	if (isEmpty(document.getElementById('ContactEnquiryFeedback').value)) 
	{
		alert("Please enter your feedback/enquiry.");
		document.getElementById('ContactEnquiryFeedback').focus();
		return false;
	}	

}




/**
	This function will for client side validation for Contact Us page.
*/

function validate_quote(){
	
if (isEmpty(document.getElementById('eventdate').value)) 
	{
		alert("Please enter event date");
		document.getElementById('eventdate').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationInitials').value)) 
	{
		alert("Please enter initials");
		document.getElementById('AccommodationInitials').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('dob').value)) 
	{
		alert("Please enter your Date of birth");
		document.getElementById('dob').focus();
		return false;
	}	
		if (!document.getElementById('dob').value=="")
	 {
		 $condition=validate_dob();
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	if (isEmpty(document.getElementById('AccommodationNationality').value)) 
	{
		alert("Please enter your nationality");
		document.getElementById('AccommodationNationality').focus();
		return false;
	}	
	if (document.accommodation.gender_Male.checked==false) 
	{
		if (document.accommodation.gender_Female.checked==false) 
		{
			alert("Please select your gender");
			document.getElementById('gender_Male').focus();
			return false;
		}
	}		
	if (document.accommodation.maritial_status_Married.checked==false) 
	{
		if (document.accommodation.maritial_status_Single.checked==false) 
		{
			alert("Please select your maritial status");
			document.getElementById('maritial_status_Married').focus();
			return false;
		}
	}		
	if (isEmpty(document.getElementById('AccommodationPermanentAddress').value)) 
	{
		alert("Please enter your permanent address");
		document.getElementById('AccommodationPermanentAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationCorrAddress').value)) 
	{
		alert("Please enter your correspondance address");
		document.getElementById('AccommodationCorrAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationPermanentCountry').value)) 
	{
		alert("Please enter your country");
		document.getElementById('AccommodationPermanentCountry').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationCorrCountry').value)) 
	{
			alert("Please enter your country");
		document.getElementById('AccommodationCorrCountry').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationPermanentPhone').value)) 
	{
		alert("Please enter telephone no");
		document.getElementById('AccommodationPermanentPhone').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationCorrPhone').value)) 
	{
		alert("Please enter telephone no");
		document.getElementById('AccommodationCorrPhone').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationEmail').value)) 
	{
		alert("Please enter your email id");
		document.getElementById('AccommodationEmail').focus();
		return false;
	}	
	if(!validateEmail(document.getElementById('AccommodationEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('AccommodationEmail').focus();
		return false;
	}
		if (isEmpty(document.getElementById('AccommodationCourse').value)) 
	{
		alert("Please select your course");
		document.getElementById('AccommodationCourse').focus();
		return false;
	}	
		if (isEmpty(document.getElementById('start').value)) 
	{
		alert("Please enter course start date");
		document.getElementById('start').focus();
		return false;
	}	
		if (isEmpty(document.getElementById('enddate').value)) 
	{
		alert("Please enter course end date");
		document.getElementById('enddate').focus();
		return false;
	}	
	if (document.accommodation.type_accommodation_HostFamily.checked==false) 
	{
		if (document.accommodation.type_accommodation_SelfCatering.checked==false) 
		{
			alert("please select the type of accommodation");
			document.getElementById('type_accommodation_HostFamily').focus();
			return false;
		}
	}	
	if (document.accommodation.share_room_Yes.checked==false) 
	{
		if (document.accommodation.share_room_No.checked==false) 
		{
			alert("please select whether you want to share a room");
			document.getElementById('share_room_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.vegetarian_Yes.checked==false) 
	{
		if (document.accommodation.vegetarian_No.checked==false) 
		{
			alert("please select whether you are vegetarian or not");
			document.getElementById('vegetarian_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.food_canteat_Yes.checked==false) 
	{
		if (document.accommodation.food_canteat_No.checked==false) 
		{
			alert("please enter if there are any foods you cant eat");
			document.getElementById('food_canteat_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.medical_prob_Yes.checked==false) 
	{
		if (document.accommodation.medical_prob_No.checked==false) 
		{
			alert("Do you have medical problems");
			document.getElementById('medical_prob_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.smoke_Yes.checked==false) 
	{
		if (document.accommodation.smoke_No.checked==false) 
		{
			alert("Do you smoke");
			document.getElementById('smoke_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.live_smokers_Yes.checked==false) 
	{
		if (document.accommodation.live_smokers_No.checked==false) 
		{
			alert("Are you willing to live in a household with smokers?");
			document.getElementById('live_smokers_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.travel_overseas_Yes.checked==false) 
	{
		if (document.accommodation.travel_overseas_No.checked==false) 
		{
			alert("Have you travelled overseas before?");
			document.getElementById('travel_overseas_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.visit_before_Yes.checked==false) 
	{
		if (document.accommodation.visit_before_No.checked==false) 
		{
			alert("Have you visited this country before?");
			document.getElementById('visit_before_Yes').focus();
			return false;
		}
	}	
	
}

/**
	This function will for client side validation for Customer Registration Page.
*/

function validate_register(){
		
	//Validations for Passenger Details
	if (isEmpty(document.getElementById('CustomerUsername').value)) 
	{
		alert("Please enter your username.");
		document.getElementById('CustomerUsername').focus();
		return false;
	}	
	
	if (isEmpty(document.getElementById('CustomerPassword').value)) 
	{
		alert("Please enter your password.");
		document.getElementById('CustomerPassword').focus();
		return false;
	}	
	
	if (isEmpty(document.getElementById('CustomerName').value)) 
	{
		alert("Please enter your name.");
		document.getElementById('CustomerName').focus();
		return false;
	}	
	
	if (isEmpty(document.getElementById('CustomerEmail').value)) 
	{
		alert("Please enter your email address.");
		document.getElementById('CustomerEmail').focus();
		return false;
	}
	
	if(!validateEmail(document.getElementById('CustomerEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('CustomerEmail').focus();
		return false;
	}
	
	if (isEmpty(document.getElementById('CustomerCaptchacode').value)) 
	{
		alert("Please enter the characters you see in the picture below.");
		document.getElementById('CustomerCaptchacode').focus();
		return false;
	}	

}

/**
	This function will show/hide domain name fields depending on weather Yes or No is selected.
*/
function showQuoteDomainField(divYesItem,divNoItem,inputYesItem,inputNoItem) {
	
	if (document.getElementById(divYesItem).checked) 
	{
		document.getElementById(inputYesItem).style.display = 'block';
		document.getElementById(inputNoItem).style.display = 'none';
	}
	else if (document.getElementById(divNoItem).checked) 
	{
		document.getElementById(inputYesItem).style.display = 'none';
		document.getElementById(inputNoItem).style.display = 'block';
	}
}


/**
	This function will show/hide quotation page fields except domain name depending on weather Yes or No is selected.
*/

function showQuoteFields(divYesItem,divNoItem,textYesItem,inputYesItem,textNoItem,inputNoItem) {
	
	if (document.getElementById(divYesItem).checked) 
	{
		document.getElementById(textYesItem).style.display = 'block';
		document.getElementById(inputYesItem).style.display = 'block';
		document.getElementById(textNoItem).style.display = 'none';
		document.getElementById(inputNoItem).style.display = 'none';
	}
	else if (document.getElementById(divNoItem).checked) 
	{
		document.getElementById(textYesItem).style.display = 'none';
		document.getElementById(inputYesItem).style.display = 'none';
		document.getElementById(textNoItem).style.display = 'block';
		document.getElementById(inputNoItem).style.display = 'block';
	}
}

/**
	This function will for client side validation for Customer Login Page.
*/

function validate_login()
{
	if (isEmpty(document.getElementById('HeaderCustomerUsername').value)) 
	{
		alert("Please enter username.");
		document.getElementById('HeaderCustomerUsername').focus();
		return false;
	}
	
	if (isEmpty(document.getElementById('HeaderCustomerPassword').value)) 
	{
		alert("Please enter password.");
		document.getElementById('HeaderCustomerPassword').focus();
		return false;
	}
}

function changeImage (imageUrl,image,divToChange)
{
	var frm = eval("document.images."+divToChange);
	//document.images.myImage.src=imageUrl+"/"+a+"/"+b+"."+c;
	frm.src=imageUrl + "/" + image;
}

/*function changeBack (a,imageUrl,divToChange)
{
	var frm = eval("document.images."+divToChange);
	frm.src= imageUrl+"/"+a+"/mainimage.jpg";
	//document.images.myImage.src= imageUrl+"/"+a+"/mainimage.jpg";
}*/
function toggle()
{
	
	if(document.getElementById('QuoteEventType').value=='21')
	{
		document.getElementById('otherevent').style.display = 'block';
	}
	 if(document.getElementById('QuoteEventType').value!='21')
	{
		document.getElementById('otherevent').style.display = 'none';
	}
	
	if(document.getElementById('QuoteEventTypeFur').value =='21')
	{
		document.getElementById('othereventFur').style.display = 'block';
		
	}
	if(document.getElementById('QuoteEventTypeFur').value!='21')
	{
		document.getElementById('othereventFur').style.display = 'none';
	}

}
function togglefur()
{
		if(document.getElementById('QuoteEventTypeFur').value =='21')
	{
		document.getElementById('othereventFur').style.display = 'block';
		
	}
	if(document.getElementById('QuoteEventTypeFur').value!='21')
	{
		document.getElementById('othereventFur').style.display = 'none';
	}
}
function validate_marquee()
{
	if (isEmpty(document.getElementById('eventdate').value)) 
	{
		alert("Please enter event date");
		document.getElementById('eventdate').focus();
		return false;
	}	
	if (!document.getElementById('eventdate').value=="")
	 {
		 $condition=validate_currentdate('eventdate');
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	if (isEmpty(document.getElementById('QuoteEventType').value)) 
	{
		alert("Please select event type");
		document.getElementById('QuoteEventType').focus();
		return false;
	}	

	if (isEmpty(document.getElementById('QuoteSitting').value)) 
	{
		alert("Please enter no of guests seated");
		document.getElementById('QuoteSitting').focus();
		return false;
	}	
	if (!isValid(document.getElementById("QuoteSitting").value,dig))
	 {
		 alert("Enter only digits in no of guests seated ");
		 document.getElementById('QuoteSitting').focus();
		 return false;
	 }
	if (isEmpty(document.getElementById('QuoteStanding').value)) 
	{
		alert("Please enter no of guests standing");
		document.getElementById('QuoteStanding').focus();
		return false;
	}	
	if (!isValid(document.getElementById("QuoteStanding").value,dig))
	 {
		 alert("Enter only digits in no of guests standing");
		 document.getElementById('QuoteStanding').focus();
		 return false;
	 } 
	if (isEmpty(document.getElementById('QuoteName').value))
	{
		alert("Please enter your Name.");
		document.getElementById('QuoteName').focus();
		return false;
	}	
		if (!isValid(document.getElementById("QuoteName").value,lwr+upr+space))
	 {
	 alert("Enter only alphabets in Name");
	 document.getElementById('QuoteName').focus();
	 return false;
	 }
	 if (isEmpty(document.getElementById('QuoteEmail').value)) 
	{
		alert("Please enter your email address.");
		 document.getElementById('QuoteEmail').focus();
		return false;
	}
	
	if(!validateEmail(document.getElementById('QuoteEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('QuoteEmail').focus();
		return false;
	}
	if (isEmpty(document.getElementById('QuoteAddress').value)) 
	{
		alert("Please enter address");
		document.getElementById('QuoteAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteEventaddress').value)) 
	{
		alert("Please enter event address");
		document.getElementById('QuoteEventaddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteTown').value)) 
	{
		alert("Please enter town");
		document.getElementById('QuoteTown').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteEventtown').value)) 
	{
		alert("Please enter event town");
		document.getElementById('QuoteEventtown').focus();
		return false;
	}
	if (isEmpty(document.getElementById('QuoteTel').value)) 
	{
		alert("Please enter the telephone no.");
		document.getElementById('QuoteTel').focus();
		return false;
	}	
	if (!isValid(document.getElementById("QuoteTel").value,dig))
	 {
		 alert("Please enter the correct telephone no. ");
		 document.getElementById('QuoteTel').focus();
		 return false;
	 }

}
function validate_furniture()
{
if (isEmpty(document.getElementById('eventdateFur').value)) 
	{
		alert("Please enter event date");
		document.getElementById('eventdateFur').focus();
		return false;
	}	
if (!document.getElementById('eventdateFur').value=="")
	 {
		 $condition=validate_currentdate('eventdateFur');
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	if (isEmpty(document.getElementById('QuoteEventTypeFur').value)) 
	{
		alert("Please select event type");
		document.getElementById('QuoteEventTypeFur').focus();
		return false;
	}				 
	if (isEmpty(document.getElementById('QuoteNameFur').value))
	{
		alert("Please enter your Name.");
		document.getElementById('QuoteNameFur').focus();
		return false;
	}	
		if (!isValid(document.getElementById("QuoteNameFur").value,lwr+upr+space))
	 {
	 alert("Enter only alphabets in Name");
	 document.getElementById('QuoteNameFur').focus();
	 return false;
	 }
	 if (isEmpty(document.getElementById('QuoteEmailFur').value)) 
	{
		alert("Please enter your email address.");
		 document.getElementById('QuoteEmailFur').focus();
		return false;
	}
	
	if(!validateEmail(document.getElementById('QuoteEmailFur').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('QuoteEmailFur').focus();
		return false;
	}
	if (isEmpty(document.getElementById('QuoteAddressFur').value)) 
	{
		alert("Please enter address");
		document.getElementById('QuoteAddressFur').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteEventaddressFur').value)) 
	{
		alert("Please enter event address");
		document.getElementById('QuoteEventaddressFur').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteTownFur').value)) 
	{
		alert("Please enter town");
		document.getElementById('QuoteTownFur').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteEventtownFur').value)) 
	{
		alert("Please enter event town");
		document.getElementById('QuoteEventtownFur').focus();
		return false;
	}
	if (isEmpty(document.getElementById('QuoteTelFur').value)) 
	{
		alert("Please enter the telephone no.");
		document.getElementById('QuoteTelFur').focus();
		return false;
	}	
	if (!isValid(document.getElementById("QuoteTelFur").value,dig))
	 {
		 alert("Please enter the correct telephone no. ");
		 document.getElementById('QuoteTelFur').focus();
		 return false;
	 }
}
function validate_marquee_furniture()
{
	if (isEmpty(document.getElementById('eventdate').value)) 
	{
		alert("Please enter event date");
		document.getElementById('eventdate').focus();
		return false;
	}	
	if (!document.getElementById('eventdate').value=="")
	 {
		 $condition=validate_currentdate('eventdate');
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	if (isEmpty(document.getElementById('QuoteEventType').value)) 
	{
		alert("Please select event type");
		document.getElementById('QuoteEventType').focus();
		return false;
	}	

	if (isEmpty(document.getElementById('QuoteSitting').value)) 
	{
		alert("Please enter no of guests seated");
		document.getElementById('QuoteSitting').focus();
		return false;
	}	
	if (!isValid(document.getElementById("QuoteSitting").value,dig))
	 {
		 alert("Enter only digits in no of guests seated ");
		 document.getElementById('QuoteSitting').focus();
		 return false;
	 }
	if (isEmpty(document.getElementById('QuoteStanding').value)) 
	{
		alert("Please enter no of guests standing");
		document.getElementById('QuoteStanding').focus();
		return false;
	}	
	if (!isValid(document.getElementById("QuoteStanding").value,dig))
	 {
		 alert("Enter only digits in no of guests standing");
		 document.getElementById('QuoteStanding').focus();
		 return false;
	 } 
	 
	 
	if (isEmpty(document.getElementById('QuoteName').value))
	{
		alert("Please enter your Name.");
		document.getElementById('QuoteName').focus();
		return false;
	}	
		if (!isValid(document.getElementById("QuoteName").value,lwr+upr+space))
	 {
	 alert("Enter only alphabets in Name");
	 document.getElementById('QuoteName').focus();
	 return false;
	 }
	 if (isEmpty(document.getElementById('QuoteEmail').value)) 
	{
		alert("Please enter your email address.");
		 document.getElementById('QuoteEmail').focus();
		return false;
	}
	
	if(!validateEmail(document.getElementById('QuoteEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('QuoteEmail').focus();
		return false;
	}
	if (isEmpty(document.getElementById('QuoteAddress').value)) 
	{
		alert("Please enter address");
		document.getElementById('QuoteAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteEventaddress').value)) 
	{
		alert("Please enter event address");
		document.getElementById('QuoteEventaddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteTown').value)) 
	{
		alert("Please enter town");
		document.getElementById('QuoteTown').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('QuoteEventtown').value)) 
	{
		alert("Please enter event town");
		document.getElementById('QuoteEventtown').focus();
		return false;
	}
	if (isEmpty(document.getElementById('QuoteTel').value)) 
	{
		alert("Please enter the telephone no.");
		document.getElementById('QuoteTel').focus();
		return false;
	}	
	if (!isValid(document.getElementById("QuoteTel").value,dig))
	 {
		 alert("Please enter the correct telephone no. ");
		 document.getElementById('QuoteTel').focus();
		 return false;
	 }
}
function validate_currentdate(id)
{
	var mydate= new Date();
	var currentyear=mydate.getFullYear();
	var currentmonth=mydate.getMonth()+1;
	var currenttoday=mydate.getDate();
    var date = document.getElementById(id).value;
	date = date.split("-");
	
   if (date[2] == currentyear && date[1] == currentmonth)
	{
		if (date[0] < currenttoday)
		{
			alert ("Date should be greater than current date");
			document.getElementById(id).value="";
			document.getElementById(id).focus();
			return false;
		}
	}
	 if (date[2] == currentyear && date[1] < currentmonth)
	{
			alert ("Date should be greater than current date");
			document.getElementById(id).value=""
			document.getElementById(id).focus();
			return false;
	}
	 if (date[2]< currentyear )
	{
			alert ("Date should be greater than current date");
			document.getElementById(id).value=""
			document.getElementById(id).focus();
			return false;
	}
	
}