  
function showhide(layer_ref) {
//******************************************************************************* 
//  Hide mask and show after pic on Before and After page
//*******************************************************************************  	
		obj = document.getElementById(layer_ref + '_mask');
		obj.style.visibility = "hidden";	
		
		obj2 = document.getElementById(layer_ref + '_after');
		obj2.style.visibility = "visible";
}

function doBootsForm ( form ) {	
//******************************************************************************* 
//  Validate and send form.  
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var testFlag = 0;  // set to 1 if Comments = "cc" - bypass validation.

 	//* RADIOS
	if (document.form0.WHOSE_BOOTS[0].checked ||
		document.form0.WHOSE_BOOTS[1].checked ||
		document.form0.WHOSE_BOOTS[2].checked ||
		document.form0.WHOSE_BOOTS[3].checked ||
		document.form0.WHOSE_BOOTS[4].checked ||
		document.form0.WHOSE_BOOTS[5].checked ||
		document.form0.WHOSE_BOOTS[6].checked ||
		document.form0.WHOSE_BOOTS[7].checked ||
		document.form0.WHOSE_BOOTS[8].checked ||
		document.form0.WHOSE_BOOTS[9].checked ||
		document.form0.WHOSE_BOOTS[10].checked ) { }
	else { errormessage = errormessage + "Whose Boots?\n"; }

	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"} 
	
				
//   errormessage ="";  // Uncomment to deactivate validation for Testing

	if (spaceTrim(document.form0.Comments.value) == "test") {errormessage=""; testFlag = 0;}  
	if (spaceTrim(document.form0.Comments.value) == "xx") {errormessage=""; testFlag = 1;}   
   
   if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
   else { 
	
		document.form0.sendemailto.value = "wolfgang@wordsatwork.ca";  
		
		if (testFlag) document.form0.sendemailto.value = "pc@twistedpixel.com"; //* TEST - cc in comments 
		
  		document.form0.sendemailbcc.value = "pc@twistedpixel.com"; 			 	
 		document.form0.sendemailsubject.value = "SVENGALI - WHOSE BOOTS?";
 		document.form0.redirect.value = "http://www.svengalisalon.com/test/en/boots-confirm.asp"; 
 //		document.form0.redirect.value = "http://www.svengalisalon.com/en/boots-confirm.asp"; 		
  	 	document.form0.sendemailfrom.value = document.form0.Email.value;
  		document.form0.action = "formsend.asp";; 
  		document.form0.method = "POST";
 		document.form0.submit();
		return(0);  
   }  
}

function doShoesForm ( form ) {	
//******************************************************************************* 
//  Validate and send form.  
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var testFlag = 0;  // set to 1 if Comments = "cc" - bypass validation.

 	//* RADIOS
	if (document.form0.WHOSE_SHOES[0].checked ||
		document.form0.WHOSE_SHOES[1].checked ||
		document.form0.WHOSE_SHOES[2].checked ||
		document.form0.WHOSE_SHOES[3].checked ||
		document.form0.WHOSE_SHOES[4].checked ||
		document.form0.WHOSE_SHOES[5].checked ||
		document.form0.WHOSE_SHOES[6].checked ||
		document.form0.WHOSE_SHOES[7].checked ||
		document.form0.WHOSE_SHOES[8].checked ) { }
	else { errormessage = errormessage + "Whose Shoes?\n"; }

	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"} 
	
				
//   errormessage ="";  // Uncomment to deactivate validation for Testing

	if (spaceTrim(document.form0.Comments.value) == "test") {errormessage=""; testFlag = 0;}  
	if (spaceTrim(document.form0.Comments.value) == "xx") {errormessage=""; testFlag = 1;}   
   
   if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
   else { 
	
		document.form0.sendemailto.value = "nicole@wordsatwork.ca";  
		
		if (testFlag) document.form0.sendemailto.value = "pc@twistedpixel.com"; //* TEST - cc in comments 
		
  		document.form0.sendemailbcc.value = "pc@twistedpixel.com"; 			 	
 		document.form0.sendemailsubject.value = "SVENGALI - Whose Shoes?";
// 		document.form0.redirect.value = "http://www.svengalisalon.com/test/en/shoes-confirm.asp"; 
 		document.form0.redirect.value = "http://www.svengalisalon.com/en/shoes-confirm.asp"; 		
  	 	document.form0.sendemailfrom.value = document.form0.Email.value;
  		document.form0.action = "formsend.asp";; 
  		document.form0.method = "POST";
 		document.form0.submit();
		return(0);  
   }  
}


function doVote ( form ) {	
//******************************************************************************* 
//  Validate and send form.  
//******************************************************************************* 
//	var firstmessage="Please provide the following valid information:\n\n ";
	var firstmessage="\n ";
	var errormessage="";
	var testFlag = 0;  // set to 1 if Comments = "xx" - bypass validation.
	var theCookie = "";
	var voteText = "";  // added to subject line
	
 	//* RADIOS
	if (document.form0.vote[0].checked ||
		document.form0.vote[1].checked ) {
			if (document.form0.vote[0].checked) { voteText = "Thumbs UP"; }
			if (document.form0.vote[1].checked) { voteText = "Thumbs DOWN"; }						
	}
	else { errormessage = errormessage + "Please make your selection by clicking on one of the round radio buttons\n"; }  	
		
//   errormessage ="";  // Uncomment to deactivate validation for Testing
 
	if (spaceTrim(document.form0.Comments.value) == "xx") {errormessage=""; testFlag = 1;}   
	
	if (spaceTrim(document.form0.Comments.value) == "dc") {
//		errormessage=""; 
     	testFlag = 1;	
		delcookie();	
		}  
	
	theCookie = getCookie("done");
	if (theCookie == "y") {
		 errormessage = "Sorry, you have already voted.\n";
	}
   
   if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
   else { 
	
//		document.form0.sendemailto.value = "svengali@svengalisalon.com";  
		document.form0.sendemailto.value = "wolfgang@wordsatwork.ca";
//		document.form0.sendemailto.value = "pc@twistedpixel.com";    
		
		if (testFlag) document.form0.sendemailto.value = "pc@twistedpixel.com"; //* TEST - xx in comments 	
		
		setCookie("done", "y", 30);   //* Set cookie to y = voted
		
			//* IP aquired at top of form page.
			document.form0.ip.value = ip;
			
	  		document.form0.sendemailbcc.value = "pc@twistedpixel.com"; 			 	
	 		document.form0.sendemailsubject.value = "SVENGALI - VOTE " + voteText + " - " + ip;
	  		document.form0.redirect.value = "http://www.svengalisalon.com/en/advote-confirm.asp"; 		
	  	 	document.form0.sendemailfrom.value = "svengali@svengalisalon.com";
	  		document.form0.action = "formsend.asp";  
	  		document.form0.action = "http://www.svengalisalon.com/en/formsend.asp"; 
	  		document.form0.method = "POST";
	 		document.form0.submit();
			return(0);  
	
   }  
} //* End doVote()

function doMakeupForm ( form ) {	
//******************************************************************************* 
//  Validate and send form.  
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var testFlag = 0;  // set to 1 if Comments = "cc" - bypass validation.

	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"} 
	
				
//   errormessage ="";  // Uncomment to deactivate validation for Testing

	if (spaceTrim(document.form0.Comments.value) == "test") {errormessage=""; testFlag = 0;}  
	if (spaceTrim(document.form0.Comments.value) == "xx") {errormessage=""; testFlag = 1;}   
   
   if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
   else { 
	
		document.form0.sendemailto.value = "svengali@svengalisalon.com";  
		
		if (testFlag) {		
			document.form0.sendemailto.value = "pc@twistedpixel.com"; //* TEST - cc in comments 
			document.form0.Email.value = "pc@twistedpixel.com";
		}
 		document.form0.sendemailbcc.value = "pc@twistedpixel.com, wolfgang@wordsatwork.ca"; 			 	
 		document.form0.sendemailsubject.value = "SVENGALI - MAKE-UP BOOKING";
  		document.form0.redirect.value = "http://www.svengalisalon.com/en/services-makeup-confirm.asp"; 		
  	 	document.form0.sendemailfrom.value = document.form0.Email.value;
  		document.form0.action = "formsend.asp";; 
  		document.form0.method = "POST";
 		document.form0.submit();
		return(0);  
   }  
}

function doForm ( form ) {	
//******************************************************************************* 
//  Validate and send form.  
//******************************************************************************* 
	var firstmessage="Please provide the following valid information:\n\n ";
	var errormessage="";
	var testFlag = 0;  // set to 1 if Comments = "cc" - bypass validation.

	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"} 
	
				
//   errormessage ="";  // Uncomment to deactivate validation for Testing

	if (spaceTrim(document.form0.Comments.value) == "test") {errormessage=""; testFlag = 0;}  
	if (spaceTrim(document.form0.Comments.value) == "xx") {errormessage=""; testFlag = 1;}   
   
   if (errormessage !="") { alert (firstmessage + errormessage) ; return false; }
   else { 
	
		document.form0.sendemailto.value = "svengali@svengalisalon.com";  
		
		if (testFlag) document.form0.sendemailto.value = "pc@twistedpixel.com"; //* TEST - cc in comments 
		
  		document.form0.sendemailbcc.value = "pc@twistedpixel.com, wolfgang@wordsatwork.ca"; 			 	
 		document.form0.sendemailsubject.value = "SVENGALI - CONTACT US";
  		document.form0.redirect.value = "http://www.svengalisalon.com/en/contact-confirm.asp"; 		
  	 	document.form0.sendemailfrom.value = document.form0.Email.value;
  		document.form0.action = "formsend.asp";; 
  		document.form0.method = "POST";
 		document.form0.submit();
		return(0);  
   }  
}

 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();    
}


function flipImg(imgNam,imgTyp,onoff){
//*******************************************************************************
//	Do the mouse over image flipping.
//******************************************************************************* 		
  	if(document.images){ 	
 		document.images[imgNam].src=eval(imgTyp+onoff+'.src');
  	}
}

function showgal(pic,w,h) {
//*******************************************************************************
//	Display a window with big pic eg. javascript:showgal('print-svengali.jpg',322,670)
//*******************************************************************************
	 
	var title="Svengali Salon";	 
	
//	if (h > 700) h = 700;
	var wsave = w;
	var h = h + 70;
	var w = w + 40;
 
	var data = '<html><head>';

 	data += '<script type="text/javascript" language="JavaScript"><!--  ';
 	data += 'if(document.images){ lineon = new Image(); lineon.src="../images/ani-line.gif"; lineoff = new Image(); lineoff.src="../images/spacer.gif";'
 	data += ' loadon = new Image(); loadon.src="../images/b-load.gif"; loadoff = new Image(); loadoff.src="../images/b-clickad.gif"; }';
 	data += 'function flipImg(imgNam,imgTyp,onoff){ if(document.images) { document.images[imgNam].src=eval(imgTyp+onoff+".src");  } } ';
 	data += '//--> </script>';
 	data +='<link rel="stylesheet" href="waw.css">';
 	data +='</head>';
	data += '<title>' + title + '</title><body bgcolor="#7E739E" xbackground="../images/bg.gif" leftmargin=0 topmargin=0 marginheight=0 ';
	data += 'xonLoad=\'flipImg("load","load","off");flipImg("line","line","off");\'>';
	data += '<center>';
	data += '';
//	data += '<img xname="load" src="../images/spacer.gif" width="1" height="10" alt="" border=""><br>';
	data += '<img name="load" src="../images/b-clickad.gif" width="142" height="11" alt="" border="0"><br>';
//	data += '<img name="line" src="../images/ani-line.gif" width="398" height="1" alt="" border="0"><br>';
	data += '';

	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="../images/' + pic + '" alt="Click on image to close window." border="0"></a></center>';	
	data += '</td></tr></table>';
	data += '</body></html>';	
 
	var newWindow = window.open('','newWin', "width=" + w + ",height=" + h + ",scrollbars=yes,status=yes,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 setCookie(c_name,value,expiredays)
//*******************************************************************************
//	SET COOKIE  from http://www.w3schools.com/js/js_cookies.asp
//*******************************************************************************
{
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
} 

function delete_cookie ( cookie_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
     
function delcookie() {
//* Delete specific cookie. 	
   delete_cookie ( "done" );
   showcookie();
   }    
 
function showcookie() {
//* Show specific cookie. 	
   var Cvote=getCookie('done');
   alert('Vote cookie= ' + Cvote);
   }
 