
function doSubNews ( form ) {	
//******************************************************************************* 
//  Subscribe to news   
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var errorcode=0; 
	var len;
    if (document.form1.Email.value.length ==0 || document.form1.Email.value.indexOf('@', 0) == -1 || document.form1.Email.value.indexOf('.', 0) == -1) 
 	{errormessage=errormessage+"Email address\n"} 
 	
// 	errormessage ="";  // Uncomment to deactivate validation for Testing
   
	if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
	else { 	
  		document.form1.sendemailto.value = "contact@deadlygameschildrenplay.com"; 	 
// 		document.form1.sendemailbcc.value = " "; 	 //* TEST
  		document.form1.sendemailfrom.value  = document.form1.Email.value
 		document.form1.sendemailsubject.value = "GASP: Subscribe";
    	document.form1.redirect.value = "http://www.deadlygameschildrenplay.com/en/subscribe-confirm.html";
  		document.form1.action = "../mailer/formsend.asp";  
  		document.form1.method = "POST";
  		document.form1.submit()
		return(0); 	
   }  
}

function doMemberForm ( form ) {	
//******************************************************************************* 
//  Survey/Poll form   
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	
	if (document.form0.Name.value == "" ) {errormessage=errormessage + "Please enter your name:\n"}	
	if (document.form0.City.value == "" ) {errormessage=errormessage + "Please enter the City/Town you live in:\n"}	

  	var item  = document.form0.Country.selectedIndex;
 	var itemval = document.form0.Country.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the Country you live in:\n";		

  	var item  = document.form0.Province.selectedIndex;
 	var itemval = document.form0.Province.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the Province/State you live in:\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"} 

  	var item  = document.form0.Skills.selectedIndex;
 	var itemval = document.form0.Skills.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the Special Skills you would like to share:\n";		

  	var item  = document.form0.Back_Ground.selectedIndex;
 	var itemval = document.form0.Back_Ground.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the back ground you have:\n";							
 
	if (spaceTrim(document.form0.Comments.value) == "") errormessage=errormessage +  "Please enter comments:\n";				
 
// 	errormessage ="";  // Uncomment to deactivate validation for Testing
   
	if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
	else { 	
  		document.form0.sendemailto.value = "contact@deadlygameschildrenplay.com"; ; 	 
// 		document.form0.sendemailbcc.value = " "; 	 //* TEST
  		document.form0.sendemailfrom.value  = document.form0.Email.value;
  		document.form0.sendemailsubject.value = "GASP: Member - " + document.form0.Email.value;
    	document.form0.redirect.value = "http://www.deadlygameschildrenplay.com/en/gasp-join-confirm.asp";
  		document.form0.action = "../mailer/formsend-member.asp";  
  		document.form0.method = "POST";
  		document.form0.submit()
		return(0); 	
   }  
}



function doCalendarForm ( form ) {	
//******************************************************************************* 
//  Survey/Poll form   
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	
	if (document.form0.Name.value == "" ) {errormessage=errormessage + "Please enter your 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"} 
	if (document.form0.City.value == "" ) {errormessage=errormessage + "Please enter the City/Town of the Event in:\n"}	
	
	var item  = document.form0.Country.selectedIndex;
 	var itemval = document.form0.Country.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the Country you live in:\n";		

  	var item  = document.form0.StateProv.selectedIndex;
 	var itemval = document.form0.StateProv.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the Province/State you live in:\n";		
	
	if (document.form0.Private[0].checked ||
		document.form0.Private[1].checked  ) {	}
			else {errormessage=errormessage + "Do you wish to keep your name private?\n"}
			
	if (document.form0.Dat.value == "" ) {errormessage=errormessage + "Please enter the Date of the Event:\n"}	
	if (document.form0.Tim.value == "" ) {errormessage=errormessage + "Please enter the Time of the Event:\n"}	
	if (document.form0.Description.value == "" ) {errormessage=errormessage + "Please enter the Description of the Event:\n"}	
	if (document.form0.Address.value == "" ) {errormessage=errormessage + "Please enter the Address of the Event:\n"}	

 
// 	errormessage ="";  // Uncomment to deactivate validation for Testing
   
	if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
	else { 	
  		document.form0.sendemailto.value = document.form0.Email.value;
		document.form0.sendemailcc.value = "contact@deadlygameschildrenplay.com";  
// 		document.form0.sendemailbcc.value = " "; 	 //* TEST
  		document.form0.sendemailfrom.value  = document.form0.Email.value;
  		document.form0.sendemailsubject.value = "GASP: Calendar Addition Confirmed";
    	document.form0.redirect.value = "http://www.deadlygameschildrenplay.com/en/involved-calendar-results.asp";
  		document.form0.action = "../mailer/formsend-calendar.asp";  
  		document.form0.method = "POST";
  		document.form0.submit()
		return(0); 	
   }  
}



function doPetitionForm ( form ) {	
//******************************************************************************* 
//  Survey/Poll form   
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	
	if (document.form0.Name.value == "" ) {errormessage=errormessage + "Please enter your 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"} 
			
	var item  = document.form0.Country.selectedIndex;
 	var itemval = document.form0.Country.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the Country you live in:\n";		

  	var item  = document.form0.StateProv.selectedIndex;
 	var itemval = document.form0.StateProv.options[item].value
 	if (itemval == "") errormessage = errormessage + "Please enter the Province/State you live in:\n";		
	
	if (document.form0.Private[0].checked ||
		document.form0.Private[1].checked  ) {	}
			else {errormessage=errormessage + "Do you wish to keep your name private?\n"}

 
// 	errormessage ="";  // Uncomment to deactivate validation for Testing
   
	if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
	else { 	
  		document.form0.sendemailto.value = "contact@deadlygameschildrenplay.com"; ; 	 
// 		document.form0.sendemailbcc.value = " "; 	 //* TEST
  		document.form0.sendemailfrom.value  = "contact@deadlygameschildrenplay.com";
  		document.form0.sendemailsubject.value = "GASP: Petition";
    	document.form0.redirect.value = "http://www.deadlygameschildrenplay.com/en/involved-petition-confirm.asp";
  		document.form0.action = "../mailer/formsend-petition.asp";  
  		document.form0.method = "POST";
  		document.form0.submit()
		return(0); 	
   }  
}

function doPollForm ( form ) {	
//******************************************************************************* 
//  Survey/Poll form   
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var sAge
	
	//* RADIOs
	if (document.form0.Heard_of_Choking_Game[0].checked ||
		document.form0.Heard_of_Choking_Game[1].checked  ) {	}
			else {errormessage=errormessage + "Heard of the choking game?\n"}	
			
	if (document.form0.Know_of_Alt_Name[0].checked ||
		document.form0.Know_of_Alt_Name[1].checked  ) {	}
			else {errormessage=errormessage + "Did you know of the game by any other name?\n"}	
	if (document.form0.Know_of_Alt_Name[0].checked &&
		document.form0.Alt_Name.value == ""  ) {errormessage=errormessage + "Please enter other name known by:\n"}	
	
	if (document.form0.Known_Someone[0].checked ||
		document.form0.Known_Someone[1].checked  ) {	}
			else {errormessage=errormessage + "Do you know of someone that has played?\n"}
			
	if (document.form0.Known_Someone_Still[0].checked ||
		document.form0.Known_Someone_Still[1].checked  ) {	}
			else {errormessage=errormessage + "Do you know someone that still plays?\n"}
			
	if (document.form0.Have_You_Played[0].checked ||
		document.form0.Have_You_Played[1].checked  ) {	}
			else {errormessage=errormessage + "Have you played?\n"}
			
	if (document.form0.Do_You_Still_Play[0].checked ||
		document.form0.Do_You_Still_Play[1].checked  ) {	}
			else {errormessage=errormessage + "Do you still play?\n"}
			
	if (document.form0.Shown_Someone[0].checked ||
		document.form0.Shown_Someone[1].checked  ) {	}
			else {errormessage=errormessage + "Have you shown or told anyone how to play?\n"}
			
	if (document.form0.played_alone[0].checked ||
		document.form0.played_alone[1].checked  ) {	}
			else {errormessage=errormessage + "Have you ever played alone?\n"}
			
	if (document.form0.Gender[0].checked ||
		document.form0.Gender[1].checked  ) {	}
			else {errormessage=errormessage + "Gender\n"}	
	
	sAge = spaceTrim(document.form0.Age.value);	 		
	if (sAge == "" || isInteger(sAge) == false || sAge < 8) errormessage=errormessage +  "Age\n";	 		

//*** Country  SELECT LIST
  	var item  = document.form0.Country.selectedIndex;
 	var itemval = document.form0.Country.options[item].value
 	if (itemval == "") errormessage = errormessage + "Country\n";		

//*** Prov/State  SELECT LIST
  	var item  = document.form0.StateProv.selectedIndex;
 	var itemval = document.form0.StateProv.options[item].value
 	if (itemval == "") errormessage = errormessage + "Province/State\n";							
 
// 	errormessage ="";  // Uncomment to deactivate validation for Testing
   
	if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
	else { 	
  		document.form0.sendemailto.value = "contact@deadlygameschildrenplay.com"; ; 	 
// 		document.form0.sendemailbcc.value = " "; 	 //* TEST
  		document.form0.sendemailfrom.value  = "contact@deadlygameschildrenplay.com"
  		document.form0.sendemailsubject.value = "GASP: Poll";
    	document.form0.redirect.value = "http://www.deadlygameschildrenplay.com/en/involved-survey-confirm.asp";
  		document.form0.action = "../mailer/formsend-poll.asp";  
  		document.form0.method = "POST";
  		document.form0.submit()
		return(0); 	
   }  
}


function doPresentaionForm ( form ) {	
//******************************************************************************* 
//  Presenations Request form   
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var sAttendance
	var sDate
	
	//* RADIOs
	if (document.form0.Type[0].checked ||
		document.form0.Type[1].checked ||			 
		document.form0.Type[2].checked  ) {	}
			else {errormessage=errormessage + "What type of presenation are you requesting?\n"}	
			
	sAttendance = spaceTrim(document.form0.Attendance.value);	 		
	if (sAttendance == "" || isInteger(sAttendance) == false) errormessage=errormessage +  "Please estimate number of attendees\n";	 		
	
	sNumber_Sessions = spaceTrim(document.form0.Number_Sessions.value);	 		
	if (sNumber_Sessions == "" || isInteger(sNumber_Sessions) == false) errormessage=errormessage +  "Please enter number of sessions required\n";	 		
	
	sDate = spaceTrim(document.form0.Presentation_Date.value);	 		
	if (sDate == "") errormessage=errormessage +  "Please specify a date\n";	 		
					
	if (document.form0.Funding_Presenters[0].checked ||
		document.form0.Funding_Presenters[1].checked  ) {	}
			else {errormessage=errormessage + "Is there funding or donations available for presenters?\n"}	
			
	if (document.form0.Funding_Travel[0].checked ||
		document.form0.Funding_Travel[1].checked  ) {	}
			else {errormessage=errormessage + "Is there funding or donations available for travel?\n"}	
			
	if (document.form0.Tax_Receipt[0].checked ||
		document.form0.Tax_Receipt[1].checked  ) {	}
			else {errormessage=errormessage + "Do you require tax receipt?\n"}	
			
	if (document.form0.Previous_Presentation[0].checked ||
		document.form0.Previous_Presentation[1].checked  ) {	}
			else {errormessage=errormessage + "Have you requested a presentation previously?\n"}	
			
	if (document.form0.Referal[0].checked ||
		document.form0.Referal[1].checked ||			 
		document.form0.Referal[2].checked  ) {	}
			else {errormessage=errormessage + "How did you hear about our programs?\n"}
						
	if (document.form0.Brochures[0].checked ||
		document.form0.Brochures[1].checked  ) {	}
			else {errormessage=errormessage + "Will you required GASP Brochures ?\n"}	
			
	if (document.form0.Education_Kit[0].checked ||
		document.form0.Education_Kit[1].checked  ) {	}
			else {errormessage=errormessage + "Will you required GASP Education Kits?\n"}
								
	if (document.form0.Presenter_Survey[0].checked ||
		document.form0.Presenter_Survey[1].checked  ) {	}
			else {errormessage=errormessage + "Would your group be willing to complete a survery on the presenter and presentation materials?\n"}
			
	if (document.form0.Child_Survey[0].checked ||
		document.form0.Child_Survey[1].checked  ) {	}
			else {errormessage=errormessage + "If presentations are given to school age children, would your group allow a survery on the &quot;Choking Game&quot; to be completed by the students?\n"}
			
	if (document.form0.Event_Name.value == "" ) {errormessage=errormessage + "Please enter your Event name:\n"}	
	if (document.form0.Name.value == "" ) {errormessage=errormessage + "Please enter your name:\n"}	
	if (document.form0.Phone.value == "" ) {errormessage=errormessage + "Please enter your phone number:\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 (document.form0.Event_Address.value == "" ) {errormessage=errormessage + "Please enter your name:\n"}	


//*** Country  SELECT LIST
  	var item  = document.form0.Country.selectedIndex;
 	var itemval = document.form0.Country.options[item].value
 	if (itemval == "") errormessage = errormessage + "Country\n";		

//*** Prov/State  SELECT LIST
  	var item  = document.form0.StateProv.selectedIndex;
 	var itemval = document.form0.StateProv.options[item].value
 	if (itemval == "") errormessage = errormessage + "Province/State\n";							
 
// 	errormessage ="";  // Uncomment to deactivate validation for Testing
   
	if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
	else { 	
  		document.form0.sendemailto.value = "contact@deadlygameschildrenplay.com"; ; 	 
// 		document.form0.sendemailbcc.value = " "; 	 //* TEST
  		document.form0.sendemailfrom.value  = "contact@deadlygameschildrenplay.com"
  		document.form0.sendemailsubject.value = "GASP: Presentation Request";
    	document.form0.redirect.value = "http://www.deadlygameschildrenplay.com/en/involved-survey-confirm.asp";
  		document.form0.action = "../mailer/formsend-presentation.asp";  
  		document.form0.method = "POST";
  		document.form0.submit()
		return(0); 	
   }  
}


function clearText(thefield){
//******************************************************************************* 
//  Clear text from input filed on focus  <input type="text" value="Search this site" onFocus="clearText(this)">
//******************************************************************************* 	
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 
function flipImg(imgNam,imgTyp,onoff){
//*******************************************************************************
//	Do the mouse over image flipping.
//******************************************************************************* 		
  	if(document.images){ 	
 		document.images[imgNam].src=eval(imgTyp+onoff+'.src');
  	}
}

function doForm ( form ) {	
//******************************************************************************* 
//  Do the Contact 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 = "cc" - bypass validation.
//***  
	var sEmailto = "contact@deadlygameschildrenplay.com";			// 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"} 
	   if (spaceTrim(document.form0.Comments.value) == "") errormessage=errormessage +  "Comments\n";	
 		
// 	errormessage ="";  // Uncomment to deactivate validation for Testing

if (spaceTrim(document.form0.Comments.value) == "test") {errormessage=""; testFlag = 0;}  //*** FOR TESTING - BYPASS VALDIDATION
if (spaceTrim(document.form0.Comments.value) == "cc") {errormessage=""; testFlag = 1;}  //*** FOR TESTING - BYPASS VALDIDATION


 //  alert(testdir);
	if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
	else { 	
 
//*----------------------------------------------
//* Use /mailer/FORMMAIL.PHP for forms with attachments  		 
//*----------------------------------------------
 
	  	document.form0.recipients.value = sEmailto;
		if (testFlag) { document.form0.recipients.value = " "; } 	 //* TEST - cc in comments sends to me
//	 	document.form0.bcc.value = " "; 	 //* TEST	 	
 	  	document.form0.email.value = document.form0.Email.value
	  	document.form0.subject.value = "GASP: Contact Us - " + document.form0.Email.value;
	  	document.form0.good_url.value = "http://www.deadlygameschildrenplay.com/en/contact-confirm.asp";
	  	document.form0.action = "../mailer/formmail.php";
	  	document.form0.enctype = "multipart/form-data";  
  		document.form0.method = "POST";
  		document.form0.submit()
		return(0); 	
   }  
}
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();    
}
 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 isInteger(s)
//*******************************************************************************
//	is it an integer?
//*******************************************************************************	
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
} 

function openWindow(strURL, iheight, iwidth, itarget, iscroll){
    window.open(strURL, itarget, "height=" + iheight + " width=" + iwidth + " scrollbars=" + iscroll);
  }
