	var thesite = "http://www.motolimo.com";
	var test = "/test";  //Set to blank for production.
	test = "";

function doContact ( form ) {	
//******************************************************************************* 
//  CONTACT US FORM
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var errorcode=0; 
	var len;
	var testFlag = 0;  // set to 1 if Comments = "xx", 2 if "test" - bypass validation.
//***  
	var sEmailto = "";			// Default receipient 
	
 	if (spaceTrim(document.form0.Name.value) == "") errormessage=errormessage + "Name\n"; 
	
	if (document.form0.Email.value.length ==0 || document.form0.Email.value.indexOf('@', 0) == -1 || document.form0.Email.value.indexOf('.', 0) == -1) {errormessage=errormessage+"Email address\n"}  	
 
//  	errormessage ="";  // Uncomment to deactivate validation for Testing

//* If comments start with xx, set testFlag on - for developer testing 
	var sComments = spaceTrim(document.form0.Comments.value);
	if (sComments.substring(0,2) == "xx") {errormessage=""; testFlag = 1;}
	if (sComments.substring(0,4) == "test") {errormessage=""; testFlag = 2;} 
 

	if (errormessage !="") { alert (firstmessage + errormessage) ;}
	else { 	
 		sEmailto = "nscn@sympatico.ca"; // Default recipient 	
 	  	document.form0.recipients.value = sEmailto;
 	  	document.form0.recipients.value =  "nscn@sympatico.ca"; // Default recipient 
		
		if (testFlag == 1) {
			document.form0.recipients.value = "pc@twistedpixel.com";
			document.form0.Email.value 		= "pc@twistedpixel.com"; 
		}
		if (testFlag == 2) {
			document.form0.recipients.value = document.form0.Email.value;
		}		
 
		document.form0.bcc.value = "pc@twistedpixel.com";			 	 	
 	  	document.form0.email.value = document.form0.Email.value;
	  	document.form0.subject.value = "MOTO - CONTACT US";
 	
		document.form0.good_url.value = thesite + test + "/confirm.html";
 		document.form0.action = thesite + "/mailer/formmail.php";  
 		
//	  	document.form0.enctype = "multipart/form-data";      //* For attachments
  		document.form0.method = "POST";
 	  	document.form0.submit()
  		return(0); 	
   }  
}

function doQuote ( form ) {	
//******************************************************************************* 
//  QUOTE FORM
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var errorcode=0; 
	var len;
	var testFlag = 0;  // set to 1 if Comments = "xx", 2 if "test" - bypass validation.
//***  
	var sEmailto = "";			// Default receipient 
	
 	if (spaceTrim(document.form0.Name.value) == "") errormessage=errormessage + "Name\n";
 	if (spaceTrim(document.form0.Telephone.value) == "") errormessage=errormessage + "Telephone\n";
	
	if (document.form0.Email.value.length ==0 || document.form0.Email.value.indexOf('@', 0) == -1 || document.form0.Email.value.indexOf('.', 0) == -1) {errormessage=errormessage+"Email address\n"}  	
 	if (spaceTrim(document.form0.Pickup_Address.value) == "") errormessage=errormessage + "PickupAddress\n";
 	if (spaceTrim(document.form0.Destination_Address.value) == "") errormessage=errormessage + "Destination Address\n";
// 	if (spaceTrim(document.form0.Make_and_Model.value) == "") errormessage=errormessage + "Make and Model\n";
 
//  	errormessage ="";  // Uncomment to deactivate validation for Testing

//* If comments start with xx, set testFlag on - for developer testing 
	var sComments = spaceTrim(document.form0.Comments.value);
	if (sComments.substring(0,2) == "xx") {errormessage=""; testFlag = 1;}
	if (sComments.substring(0,4) == "test") {errormessage=""; testFlag = 2;} 
	

	if (errormessage !="") { alert (firstmessage + errormessage) ;}
	else { 	
 		sEmailto = "nscn@sympatico.ca"; // Default recipient 	
 	  	document.form0.recipients.value = sEmailto;
 	  	document.form0.recipients.value =  "nscn@sympatico.ca"; // Default recipient 
		
		if (testFlag == 1) {
			document.form0.recipients.value = "pc@twistedpixel.com";
			document.form0.Email.value 		= "pc@twistedpixel.com"; 
		}
		if (testFlag == 2) {
			document.form0.recipients.value = document.form0.Email.value;
		}		
 
		document.form0.bcc.value = "pc@twistedpixel.com";			 	 	
 	  	document.form0.email.value = document.form0.Email.value;
	  	document.form0.subject.value = "MOTO - REQUEST QUOTE";
 	
		document.form0.good_url.value = thesite + test + "/confirm.html";
 		document.form0.action = thesite + "/mailer/formmail.php";  
 		
//	  	document.form0.enctype = "multipart/form-data";      //* For attachments
  		document.form0.method = "POST";
 	  	document.form0.submit()
  		return(0); 	
   }  
}

function doPickup ( form ) {	
//******************************************************************************* 
//  PICKUP FORM
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var errorcode=0; 
	var len;
	var testFlag = 0;  // set to 1 if Comments = "xx", 2 if "test" - bypass validation.
//***  
	var sEmailto = "";			// Default receipient 
	
 	if (spaceTrim(document.form0.Name.value) == "") errormessage=errormessage + "Name\n";
 	if (spaceTrim(document.form0.Telephone.value) == "") errormessage=errormessage + "Telephone\n";
	
	if (document.form0.Email.value.length ==0 || document.form0.Email.value.indexOf('@', 0) == -1 || document.form0.Email.value.indexOf('.', 0) == -1) {errormessage=errormessage+"Email address\n"}  	
 	if (spaceTrim(document.form0.Pickup_Address.value) == "") errormessage=errormessage + "PickupAddress\n";
 	if (spaceTrim(document.form0.Destination_Address.value) == "") errormessage=errormessage + "Destination Address\n";
 	if (spaceTrim(document.form0.Make_and_Model.value) == "") errormessage=errormessage + "Make and Model\n";
 	if (spaceTrim(document.form0.Pickup_Date_Time.value) == "") errormessage=errormessage + "Pickup Date and Time\n";

 
//  	errormessage ="";  // Uncomment to deactivate validation for Testing

//* If comments start with xx, set testFlag on - for developer testing 
	var sComments = spaceTrim(document.form0.Comments.value);
	if (sComments.substring(0,2) == "xx") {errormessage=""; testFlag = 1;}
	if (sComments.substring(0,4) == "test") {errormessage=""; testFlag = 2;} 
	

	if (errormessage !="") { alert (firstmessage + errormessage) ;}
	else { 	
 		sEmailto = "nscn@sympatico.ca"; // Default recipient 	
 	  	document.form0.recipients.value = sEmailto;
 	  	document.form0.recipients.value =  "nscn@sympatico.ca"; // Default recipient 
		
		if (testFlag == 1) {
			document.form0.recipients.value = "pc@twistedpixel.com";
			document.form0.Email.value 		= "pc@twistedpixel.com"; 
		}
		if (testFlag == 2) {
			document.form0.recipients.value = document.form0.Email.value;
		}		
 
		document.form0.bcc.value = "pc@twistedpixel.com";			 	 	
 	  	document.form0.email.value = document.form0.Email.value;
	  	document.form0.subject.value = "MOTO - PICKUP SCHEDULE";
 	
		document.form0.good_url.value = thesite + test + "/pickup-confirm.html";
 		document.form0.action = thesite + "/mailer/formmail.php";  
 		
//	  	document.form0.enctype = "multipart/form-data";      //* For attachments
  		document.form0.method = "POST";
 	  	document.form0.submit()
  		return(0); 	
   }  
}



function showCard() {
//*******************************************************************************
//	Display a window with image   
//*******************************************************************************
 
	var scroll="yes";
	var theDir = "Img/";
	var pic = "express-toy-transit-card.gif";
	var w = 430;
	var h = 480; 
	
	var data = '<html><head><title>Click image to close window</title><body bgcolor="#FFFFFF"  leftmargin=0 topmargin=0 marginheight="0" >';
	data += '<center>';
	data += '<a href="javascript:self.close()" onMouseOver="self.status=\'Click on image to close window.\'; return true" onMouseOut="self.status=\'\'; return true">';
	data += '<img src="' + theDir + pic + '" alt="Click on image to close window." border="0"></a></center>';
	data += '</body></html>';		
	newWindow = window.open('','newWin', "width=" + w + ",height=" + h + ",scrollbars=" + scroll + ",status=yes,menubar=1,toolbar=1;resizable=yes", "alwaysRaised");	
	newWindow.document.write(data);
	newWindow.document.close('newWin'); //* Close the data stream
	newWindow.resizeTo(w,h);			//* Resize the window for latest image 
	newWindow.focus(); 					//* Bring to front	
}

function NewWindow(mypage, myname, w, h, scroll)
{
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function spaceTrim(InString) {
//*******************************************************************************
// Trim leading and trailing spaces of form input fields
//*******************************************************************************
	var LoopCtrl=true;
	while (LoopCtrl) {
		if (InString.indexOf("  ") != -1) {
			Temp = InString.substring(0, InString.indexOf("  "))
			InString = Temp + InString.substring(InString.indexOf("  ")+1, 
				InString.length)
		} else
			LoopCtrl = false;
	}
	if (InString.substring(0, 1) == " ")
		InString = InString.substring(1, InString.length)
	if (InString.substring (InString.length-1) == " ")
		InString = InString.substring(0, InString.length-1)
	return (InString)
}

function doClear ( form ) {	
//*******************************************************************************
// Clear Form  -  
//*******************************************************************************	
//alert(pagelang);
    var msg_e = "Are you sure that you want to clear all the data you have entered on this form?";
    var msg_f = "Voulez-vous vraiment effacer toutes les données?";
    var clearmsg = msg_e;
 // if (pagelang == "f") clearmsg = msg_f;
    
	var confirmOK = confirm(clearmsg);
  	if (confirmOK) document.form0.reset();    
} 