function checkSubmit()	{
	if (document.forms['enquiry'].compname.value=='' || 
		document.forms['enquiry'].contname.value=='' || 
		document.forms['enquiry'].email.value=='' || 
		document.forms['enquiry'].telno.value=='')		{ 
		alert('Please complete all mandatory fields.' ); 
		return false;
	} else { 
		var emailaddress=document.forms['enquiry'].email.value;
		var emailFormat = /^\w(\.?[\w-])*@\w(\.?[\w-])*\.[a-zA-Z]{2,6}(\.[a-zA-Z]{2})?$/i;
		if (emailaddress.search(emailFormat) == -1)	{
			alert("Please specify your email address in the following format: email@emailaddress.com");
			return false; 
		}	else {
			if (navigator.appName =='Netscape') {
				document.getElementById('subbutton').disabled = true;
				document.getElementById('subbutton').style.width = '120px';
				document.getElementById('subbutton').value = 'Please wait...';
			} else {
				document.all.subbutton.disabled=true;
				document.all.subbutton.style.width='120px';
				document.all.subbutton.value='Please wait...';
			}
			return true; 
		}
	} 
} 

function doSelMachine()	 {
	var type=document.forms[0].type.options[document.forms[0].type.selectedIndex].value;
	var subtype=document.forms[0].subtypes.options[document.forms[0].subtypes.selectedIndex].value;
	var man= document.forms[0].manufacturer.options[document.forms[0].manufacturer.selectedIndex].value;
	var model= document.forms[0].model.options[document.forms[0].model.selectedIndex].value;
	var country= document.forms[0].country.options[document.forms[0].country.selectedIndex].value;
	var year = document.forms[0].year.options[document.forms[0].year.selectedIndex].value;
	window.location.href = 'quick_result.php?type=' + type + '&subtype=' + subtype + '&manufacturer=' + man + '&model=' + model + '&year=' + year + '&country=' + country + '&show=Y';
}

//	Function to sort the overview in the machine overview
function sortMachineList(field,sort)	{
	var frm			= document.forms['machineoverview'];
	var type		= escape(frm.type.options[frm.type.selectedIndex].value); 
	var subtype	= escape(frm.subtypes.options[frm.subtypes.selectedIndex].value);
	var man		= escape(frm.manufacturer.options[frm.manufacturer.selectedIndex].value); 
	var model		= escape(frm.model.options[frm.model.selectedIndex].value); 
	var country	= escape(frm.country.options[frm.country.selectedIndex].value); 
	var year		= frm.year.options[frm.year.selectedIndex].value;
	var page		= frm.page.value;
	window.location.href = 'quick_result.php?type='+type+'&subtype='+subtype+'&manufacturer='+man+'&model='+model+'&show=Y&page='+page+'&year='+year+'&country='+country+'&srtfld='+field+'&srt='+ sort;
}

//	Function to do search from the mainpage
function main_search()	{
	var type=escape(document.forms['main_mach_search'].type.options[document.forms['main_mach_search'].type.selectedIndex].value);
	var subtype=escape(document.forms['main_mach_search'].subtypes.options[document.forms['main_mach_search'].subtypes.selectedIndex].value);
	var man=escape(document.forms['main_mach_search'].manufacturer.options[document.forms['main_mach_search'].manufacturer.selectedIndex].value);
	var model=escape(document.forms['main_mach_search'].model.options[document.forms['main_mach_search'].model.selectedIndex].value);
	var year=document.forms['main_mach_search'].year.options[document.forms['main_mach_search'].year.selectedIndex].value;
	window.location.replace('index.php?type=' + type + '&subtype=' + subtype + '&manufacturer=' + man + '&model=' + model + '&year=' + year);
}
function do_main_machine_search()	{
	var type=escape(document.forms['main_mach_search'].type.options[document.forms['main_mach_search'].type.selectedIndex].value);
	var subtype=escape(document.forms['main_mach_search'].subtypes.options[document.forms['main_mach_search'].subtypes.selectedIndex].value);
	var man=escape(document.forms['main_mach_search'].manufacturer.options[document.forms['main_mach_search'].manufacturer.selectedIndex].value);
	var model=escape(document.forms['main_mach_search'].model.options[document.forms['main_mach_search'].model.selectedIndex].value);
	var year=document.forms['main_mach_search'].year.options[document.forms['main_mach_search'].year.selectedIndex].value;
	window.location.href= 'quick_result.php?type=' + type + '&subtype=' + subtype + '&manufacturer=' + man + '&model=' + model + '&year=' + year + '&show=Y';
}
