function show_e(s_emsg,o_input){
	o_from = document.cbErrorMsg;
	o_e = eval("o_from."+s_emsg)
	document.getElementById("cb_emsg").innerHTML = o_e.value;
	o_input.focus();
	document.getElementById("cb_e").style.display = "block";
	if(isMac&&isIE5)if(document.getElementById("cbNav"))document.getElementById("cbNav").style.visibility = "hidden";
	o_input.className="cb_efield";
	(o_input.type=='text') ? o_input.onkeypress = function (){this.className=''} : o_input.onclick = function (){this.className=''}
}
function close_e(){
	document.getElementById("cb_e").style.display = "none";
	if(isMac&&isIE5)if(document.getElementById("cbNav"))document.getElementById("cbNav").style.visibility = "visible";
}
//check 1
function e_checklength(o_input,i_min,i_max){
	b_valid = true;
	if(o_input.value.length < i_min || o_input.value.length > i_max){
		show_e('e_length',o_input)
		b_valid = false;
	}
	return b_valid;	
}
//check 2
function e_checkspace(o_input){
	b_valid = true;
	if(o_input.value.charCodeAt(0)==32){
		show_e('e_space',o_input)
		b_valid = false;
	}
	return b_valid;
}
//check 3
function e_checkchar(o_input){
	b_valid = true;
	b_charCodeError=false;
	s_checkvalue = o_input.value
	s_checkvalue = s_checkvalue.toLowerCase();
	for(var i=0;i<s_checkvalue.length;i++)if(s_checkvalue.charCodeAt(i)!=46&&s_checkvalue.charCodeAt(i)!=44&&s_checkvalue.charCodeAt(i)!=32&&s_checkvalue.charCodeAt(i)!=39&&(s_checkvalue.charCodeAt(i)<97||s_checkvalue.charCodeAt(i)>122))b_charCodeError=true;
	if(b_charCodeError){
		show_e('e_char',o_input)
		b_valid = false;
	}
	return b_valid;	
}
//check 4
function e_same(o_inputT,o_inputF){
	b_valid = true;
	if(o_inputT.value==o_inputF.value) {
		show_e('e_same',o_inputT)
		b_valid = false;
	}
	return b_valid;
}
//check 5
function e_children(o_select, s_idbit){
	b_valid = true;
	if(o_select.selectedIndex>0){
		minorAges = document.getElementById("cb"+s_idbit+"childages").getElementsByTagName("select")
		for(var i=0;i < o_select.selectedIndex;i++){
			if(minorAges[i].selectedIndex==0){
				show_e('e_child',minorAges[i]);
				b_valid = false;
				i = minorAges.length
			}
		}
	}
	return b_valid;
}
//check 6
function e_dates(o_fromM,o_toM, o_fromD, o_toD){
	b_valid = true;
	if(o_fromM.selectedIndex==o_toM.selectedIndex){
		if(o_fromD.selectedIndex>o_toD.selectedIndex){
			show_e('e_date',o_toD)
			b_valid = false;
		}
	}else if((o_fromM.selectedIndex-o_toM.selectedIndex)==1){
		show_e('e_date',o_toM)
		b_valid = false;
	}
	return b_valid;
}
function checkform(){
	a_arguments = checkform.arguments
	o_form = a_arguments[0]
	a_form = o_form.name.split("form")
	s_type = a_form[1]
	b_submit = true;
	for(var i= 1;i<a_arguments.length;i++){
		switch (a_arguments[i]){
			case 1:
				if(document.getElementById(s_type+"_from")) b_submit = e_checklength(document.getElementById(s_type+"_from"),3,25);		
				if(b_submit) if(document.getElementById(s_type+"_to")) b_submit = e_checklength(document.getElementById(s_type+"_to"),3,25);
			break;
			case 2:
				if(document.getElementById(s_type+"_from")) b_submit = e_checkspace(document.getElementById(s_type+"_from"));				
				if(b_submit) if(document.getElementById(s_type+"_to")) b_submit = e_checkspace(document.getElementById(s_type+"_to"));
			break;
			case 3:
				if(document.getElementById(s_type+"_from")) b_submit = e_checkchar(document.getElementById(s_type+"_from"));				
				if(b_submit) if(document.getElementById(s_type+"_to")) b_submit = e_checkchar(document.getElementById(s_type+"_to"));
			break;
			case 4:
				b_submit = e_same(document.getElementById(s_type+"_from"),document.getElementById(s_type+"_to"))
			break;
			case 5:
				if(document.getElementById(s_type+"_children").selectedIndex>0)b_submit = e_children(document.getElementById(s_type+"_children"), s_type);
			break;
			case 6:
				if(document.getElementById(s_type+"_tomonth")) b_submit = e_dates(document.getElementById(s_type+"_frommonth"),document.getElementById(s_type+"_tomonth"),document.getElementById(s_type+"_fromdate"),document.getElementById(s_type+"_todate"));
			break;
			case 7:
				if(document.getElementById(s_type+"_adults").selectedIndex==0&&document.getElementById(s_type+"_children").selectedIndex==0&&document.getElementById(s_type+"_seniors").selectedIndex==0) {
					show_e('e_pass',document.getElementById(s_type+"_adults"))
					b_submit =false;
				}
			break;
			default:
		}
		if(!b_submit) i=a_arguments.length;
	}
	return b_submit;
}