function openPop(url)
{
	//myWin = window.open(url,'','width=420 height=520 scrollbars=no')
	//var myWidth = screen.width;
	//var myHeight = screen.height;
	//myWin.moveTo(myHeight,myWidth)
	
	leftPos=0;
   
   if (screen != null){
      leftPos = screen.width-600;
   }

   newWindowID = window.open( url, 'newWin', 'width=400,height=510,left=' +leftPos+ ',top=0');;

   newWindowID.focus();

}

function DisplayMenu(Params){
		  if (document.getElementById(Params).style.display == "") {
		    document.getElementById(Params).style.display = "none";		   
		  } else {
		    document.getElementById(Params).style.display = "";		    
		  }
		}
		

function openWin(url,imageWidth,imageHeight){

	leftPos=0;
   
   if (screen != null){
      leftPos = screen.width-600;
   }
   
   
	newWindow = window.open("","newWin","width="+imageWidth+",height="+imageHeight+",left=" +leftPos+ ",top=0");
	newWindow.document.open();
	newWindow.document.write('<html><title>McKenzie Salvage</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 

	newWindow.document.write('<img src='+url+' width='+imageWidth+' height='+imageHeight+'');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function validate(theform)
{
	if(document.frmContact.txtName.value == "")
	{
		alert("Please enter your name.")
		
		frmContact.txtName.focus()
		return false;
	}
	if(document.frmContact.txtAddress.value == "")
	{
		alert("Please enter your address.")
		
		frmContact.txtAddress.focus()
		return false;
	}
	if(document.frmContact.txtPhone.value == "")
	{
		alert("Please enter a contact phone number.")
		
		frmContact.txtPhone.focus()
		return false;
	}
	if(!document.frmContact.chkEmail.checked)
	{
		if(document.frmContact.txtEmail.value == "")
		{
			alert("Please enter your email address, otherwise click \'No email\'\nif you dont have an email address.")
			
			frmContact.txtEmail.focus()
			return false;
		}
	}
	if(document.frmContact.txtEnquiry.value == "")
	{
		alert("Please enter your enquiry.")
		
		frmContact.txtEnquiry.focus()
		return false;
	}
	//else
	//{
	
		if(confirm("Name:  " + document.frmContact.txtName.value + "\n" +
		"Address:  " + document.frmContact.txtAddress.value + "\n" +
		"Phone number:  " + document.frmContact.txtPhone.value + "\n" +
		"Email address:  " + document.frmContact.txtEmail.value + "\n" +
		"Enquiry:  " + document.frmContact.txtEnquiry.value + "\n\n\n" +
		"If you are sure that these details are correct, click OK,\notherwise click Cancel"))
		{
		
			frmContact.submit();
		}else{
			return false;
		}
	//}
}

function validEmail(email) {
	invalidChars = " /:,;"
	var i = 0;
	if (email == "") {
		return false
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) {
			return false
		}
	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) {
		return false
	}
	if (email.indexOf("@",atPos+1) > -1) {
		return false
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {
		return false
	}
	if (periodPos+3 > email.length)	{
		return false
	}
	return true
}

function submitIt(carForm) {
var emailLength
emailLength = document.frmContact.txtEmail.value
	if(emailLength.length > 0){
		if (!validEmail(document.frmContact.txtEmail.value)) {
			alert("Invalid email address.")
			document.frmContact.txtEmail.focus()
			document.frmContact.txtEmail.select()
			return false
		}

		return true
	}else{
		return false
	}
}

function clearForm()
{
	document.frmContact.txtName.selectedIndex = ""
	document.frmContact.txtAddress.selectedIndex = ""
	document.frmContact.txtPhone.value = ""
	document.frmContact.txtEmail.selectedIndex = ""
	document.frmContact.txtEnquiry.selectedIndex = ""
	document.frmContact.chkEmail.checked = false
}