if (document.images){	
	//home
	btn_home_on= new Image();
	btn_home_on.src="/images/btn_home_on.gif";  
	
	btn_home= new Image();
	btn_home.src="/images/btn_home.gif"; 
	
	//about
	btn_treatments_on= new Image();
	btn_treatments_on.src="/images/btn_treatments_on.gif";  
	
	btn_treatments= new Image();
	btn_treatments.src="/images/btn_treatments.gif"; 
	 
	//salons
	btn_products_on= new Image();
	btn_products_on.src="/images/btn_products_on.gif";  
	
	btn_products= new Image();
	btn_products.src="/images/btn_products.gif"; 	 
	
		//salons
	btn_studio_on= new Image();
	btn_studio_on.src="/images/btn_studio_on.gif";  
	
	btn_studio= new Image();
	btn_studio.src="/images/btn_studio.gif"; 	
	
		//salons
	btn_testimonials_on= new Image();
	btn_testimonials_on.src="/images/btn_testimonials_on.gif";  
	
	btn_testimonials= new Image();
	btn_testimonials.src="/images/btn_testimonials.gif"; 	
	 
		//salons
	btn_newsletter_on= new Image();
	btn_newsletter_on.src="/images/btn_newsletter_on.gif";  
	
	btn_newsletter= new Image();
	btn_newsletter.src="/images/btn_newsletter.gif"; 	
	 
	//services
	btn_contact_on= new Image();
	btn_contact_on.src="/images/btn_contact_on.gif";  
	
	btn_contact= new Image();
	btn_contact.src="/images/btn_contact.gif";
	
	
		//services
	btn_yoga_on= new Image();
	btn_yoga_on.src="/images/british_school_of_yoga_on.gif";  
	
	btn_yoga= new Image();
	btn_yoga.src="/images/british_school_of_yoga.gif";
	
	
	
			//services
	btn_guild_on= new Image();
	btn_guild_on.src="/images/guild_beauty_on.gif";  
	
	btn_guild= new Image();
	btn_guild.src="/images/guild_beauty.gif";
	
	
				//services
	btn_tropez_on= new Image();
	btn_tropez_on.src="/images/st_tropez_on.gif";  
	
	btn_tropez= new Image();
	btn_tropez.src="/images/st_tropez.gif";
	
					//services
	btn_zahra_on= new Image();
	btn_zahra_on.src="/images/zahra_on.gif";  
	
	btn_zahra= new Image();
	btn_zahra.src="/images/zahra.gif";
	
		btn_aussie_on= new Image();
	btn_aussie_on.src="/images/australian_on.gif";  
	
	btn_aussie= new Image();
	btn_aussie.src="/images/australian.gif";
   }


function turnoff(imgName){
   if (document.images){
      imgOff=eval(imgName + ".src");
      document[imgName].src= imgOff;
    }
 }


function turnon(imgName){
   if (document.images){
      imgOn=eval(imgName + "_on.src");
      document[imgName].src= imgOn;
    }
 }
 
 var newwindow;
function product_large(url)
{
	newwindow=window.open(url,'name','resizable=1, width=400, height=500');
	if (window.focus) {newwindow.focus()}
}


function validateContact(myForm){
  var field = myForm.contact_email; // email field
  var str = myForm.contact_email.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  
  var str2 = myForm.contact_telephone.value; // email string
  var reg11 = /^\+?0?\d{2,4}[\d -]{6,9}$/;
  var msg = "";
  var msgTop = "The field(s) listed below still need to be entered correctly\n\n"

	if(myForm.contact_name.value == ""){
	msg += "Name:  -- Please enter your name\n"
	}


  if (!reg2.test(str)) { 
  msg += "E-mail:  -- Please enter your e-mail, \"" + str + "\" is an invalid e-mail\n"; 
  }
  
    if (!reg11.test(str2)) { 
  msg += "Telephone:  -- Please enter your telephone, \"" + str + "\" is an invalid number\n"; 
  }
  
  

	if(myForm.contact_comments.value == ""){
	msg += "Message:  -- Please enter a message you would like to send to us\n";
	}
	
	if (msg != ""){
	alert(msgTop + msg);
	//return false;
	}else{
		myForm.submit();
	}
}


function validateEmail(myForm){
  var field = myForm.contact_email; // email field
  var str = myForm.contact_email.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  
  var msg = "";
  var msgTop = "The field(s) listed below still need to be entered correctly\n\n"

	if(myForm.contact_name.value == ""){
	msg += "Name:  -- Please enter your name\n"
	}


  if (!reg2.test(str)) { 
  msg += "E-mail:  -- Please enter your e-mail, \"" + str + "\" is an invalid e-mail\n"; 
  }
  
 	
	if (msg != ""){
	alert(msgTop + msg);
	//return false;
	}else{
		myForm.submit();
	}
}


///-------------------------------------------------------------------------------------------------------


function doWork(xx, yy, xxx){
	var sz = xx.substr(xx.length-1);
	var xy = 'book_service'+sz;
	//var xz = new String("arr"+yy);
	var combo = document.getElementById(xy);
	combo.disabled = false;
	combo.options.length = 0;
	var response = window[xxx];
	//alert(response);
	var items = response.split(";");
	var count = items.length-1;
	for (var i=0;i<count;i++){
		var options = items[i].split("#");
		combo.options[i] =	new Option(options[0],options[1]);
	}
	
	addTime(xx);
}

function addTime(row) {
	if (row == 'x1'){
		var rowx = parseInt(1);
	}else{
		var rowx = parseInt(row.substr(row.length-1));
	}
	iteration = document.booking_form.norows.value;
	if(iteration > 1){
		for (x=rowx; x< iteration; x++){
			var prevTime = document.getElementById('book_service' +x).value;
			
			var currHo	= document.getElementById('book_hours'+x).value;
			
			var currMo = document.getElementById('book_minutes'+x).value;
			var xxxx  = 'book_hours'+(x+1);
			var currH	= document.getElementById(xxxx).value;
			var xxxy =  'book_minutes'+(x+1);
			var currM = document.getElementById(xxxy).value;
	
			var xxx  = Math.ceil(array2[prevTime]/15)*15;
	
			var now =	new Date();
			var hour =	now.setHours(currHo);
			var mins =	now.setMinutes(parseInt(currMo)+xxx);
			
			if (now.getMinutes() == 0){
				var yy = "00";
			}else{
				var yy = now.getMinutes();
			}
			
			//var xvar = (x+1) + "";
			//checkTime(xvar, now.getHours());
			
			document.getElementById(xxxx).value  = now.getHours();
			document.getElementById(xxxy).value = yy;
			var xvar = 's'+(x+1);
			checkTime(xvar, now.getHours());
		}
	}
}
function checkTime2(xx){
	var x = parseInt(xx.substr(xx.length-1))-1;
	if (x >= 1){
	var prevTime = document.booking_form['book_service' + (x)].value;
	var xxx  = Math.ceil(array2[prevTime]/15)*15;
	
	var currHo	= document.booking_form['book_hours'+(x)].value;
	var currMo = document.booking_form['book_minutes'+(x)].value;
	
	var currH	= document.booking_form['book_hours'+ parseInt(x+1)].value;
	var currM = document.booking_form['book_minutes'+ parseInt(x+1)].value;

	var xxx  = Math.ceil(array2[prevTime]/15)*15;

	var old = new Date();
	var hour =	old.setHours(currH);
	var mins =	old.setMinutes(parseInt(currM));

	var now =	new Date();
	var hour =	now.setHours(currHo);
	var mins =	now.setMinutes(parseInt(currMo)+xxx);
	
	var newh = now.getHours();
	var newm = now.getMinutes();
	
	if (old < now){
		alert("Current Time must be greater than - "+newh+":"+newm);
		document.booking_form['book_hours'+(x+1)].value  = now.getHours();
	document.booking_form['book_minutes'+(x+1)].value = now.getMinutes();
	
	}else{
		addTime('it'+(x+1));
	//document.booking_form['book_hours'+(x+1)].value  = now.getHours();
	//document.booking_form['book_minutes'+(x+1)].value = now.getMinutes();
	}
	
	
	}
	
}



function checkTime(xxx, yy){
	//alert(xxx);
	var sz = 'time_am'+xxx.substr(xxx.length-1);
	if (yy >=12){
		document.getElementById(sz).innerHTML = '&nbsp;PM';
	}else{
		document.getElementById(sz).innerHTML = '&nbsp;AM';
	}
	
	addTime(xxx);
}







function validateBooking(myForm){
  var field = myForm.book_email; // email field
  var str = myForm.book_email.value; // email string
  var str2 = myForm.book_number.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  var xxx = myForm.norows.value;
  var msg = "";
  var msgTop = "The field(s) listed below still need to be entered correctly\n\n"
	
	if(myForm.book_first.value == ""){
	msg += "First Name:  -- Please enter your First Name\n"
	}
	
	if(myForm.book_last.value == "" || myForm.book_last.length < 2){
	msg += "Last Name:  -- Please enter your Last Name\n"
	}


  if (!reg2.test(str)) { 
  msg += "E-mail:  -- Please enter your e-mail, \"" + str + "\" is an invalid e-mail\n"; 
  }
  
  	var reg11 = /^\+?0?\d{2,4}[\d -]{6,9}$/;

	if (!reg11.test(str2)) { 
		msg += "Phone Number:  -- Please enter a valid  contact number, \"" + str + "\" is an invalid number\n"; 
	}
  var currd = new Date;
var mydate = new Date;
mydate.setDate(myForm.book_d.value);
mydate.setMonth(myForm.book_m.value - 1);
mydate.setFullYear(myForm.book_y.value);
//alert(mydate + ' - ' + currd);
	if(mydate <= currd){
	msg += "Date: -- Please select a date which is after todays date\n";
	}
	
	for(x=1; x<=xxx;x++){
		//alert(myForm['book_service'+x].length);
		if (myForm['book_service'+x].length <= 1){
			msg += "Treatment "+ x + ": -- Please select a valid treatment\n";	
		}
		
	}
	
	if (msg != ""){
	alert(msgTop + msg);
	//return false;
	}else{
		//return true;
		myForm.submit();
	}
}


function confirmDelete(varx){
	vary = confirm('Are you sure you want to cancel this appointment from the system?\nThe customer will be sent an email notifying them this appointment has been cancelled ONLY IF this appointment was not booked before today.');
	if (vary == true){
		document.location.href = "book_delete.php?id="+ varx;
	}
}
	
function confirmApproval(varx){
	vary = confirm('Are you sure you want to confirm this appointment from the system?\nThe customer will be sent an email notifying them this appointment has been approved.');
	if (vary == true){
		document.location.href = "book_approve.php?id="+ varx;
	}
	
}






function addRowToTable(){
  var tbl = document.getElementById('booking_form_service');
  var norows = document.booking_form.norows.value;
  var lastRow = tbl.rows.length;


  var iteration = lastRow+1;
  var row = tbl.insertRow(lastRow);
  
 
  // right cell
  var cellLeft = row.insertCell(0);

  // select cell
  var cellLeftSel = row.insertCell(1);
  var sel = document.getElementById('book_service_main1').cloneNode(true);
  var selx = document.getElementById('book_service1').cloneNode(true);
  sel.name = 'book_service_main' + iteration;
  sel.id = 'book_service_main' + iteration;
  
  selx.name = 'book_service' + iteration;
  selx.id = 'book_service' + iteration;
  selx.disabled = true;
  var spanx = document.createElement("span");
  spanx.innerHTML = '&nbsp;&nbsp;';
  cellLeftSel.appendChild(sel);
  cellLeftSel.appendChild(spanx);
  cellLeftSel.appendChild(selx);

  
   // right cell
  var cellRight2 = row.insertCell(2);
  var sel2 = document.getElementById('book_hours1').cloneNode(true);
  sel2.name = 'book_hours' + iteration;
  sel2.id = 'book_hours'+iteration;
  var sel3 = document.getElementById('book_minutes1').cloneNode(true);
  sel3.name = 'book_minutes' + iteration;
  sel3.id = 'book_minutes' + iteration;
  
  
  var span = document.createElement("span");
  span.innerHTML = '<strong>Time: </strong>'; 
   
 var span2 = document.createElement("span");
  span2.innerHTML = '&nbsp;:&nbsp;';
  
  var span3 = document.getElementById('time_am1').cloneNode(true);
  span3.id = 'time_am'+iteration;
  span3.innerHTML = '&nbsp;AM';
  
  
  cellRight2.appendChild(span);
  cellRight2.appendChild(sel2);
  cellRight2.appendChild(span2);
  cellRight2.appendChild(sel3);
  cellRight2.appendChild(span3);
  
    
	document.booking_form.norows.value = iteration;
addTime('x1');
  

  }


function removeRowFromTable(){
//	alert(x);
  var tbl = document.getElementById('booking_form_service');
  var norows = document.getElementById('norows').value;

 var lastRow = tbl.rows.length;
  if (lastRow > 1){ 
  	tbl.deleteRow(lastRow-1); 
	norows = lastRow-1;
	
  }else{
  
  }
}

function changeText(){
	var xx = document.getElementById('book_comments');
	xx.style.fontSize = "12px";
	xx.style.color = "#000000";
	xx.style.fontStyle = 'normal';
	if (xx.value == "e.g. Allergies or disabilities"){
		xx.value = "";	
	}
	
}

function changeTextOut(){
var xx = document.getElementById('book_comments');

if (xx.value == ""){
		xx.style.fontSize = "12px";
	xx.style.color = "#666666";
	xx.value = "e.g. Allergies or disabilities";	
	}
}

function changeEnable(xx, yy){
	if (yy.checked == true){
	document.myForm['book_hours'+xx].disabled = false;
	document.myForm['book_minutes'+xx].disabled = false;
	
//	document.myForm['book_d'+xx].disabled = false;
	//document.myForm['book_m'+xx].disabled = false;
//	document.myForm['book_y'+xx].disabled = false;
		
	}else{
	document.myForm['book_hours'+xx].disabled = true;
	document.myForm['book_minutes'+xx].disabled = true;
	
//	document.myForm['book_d'+xx].disabled = true;
//	document.myForm['book_m'+xx].disabled = true;
//	document.myForm['book_y'+xx].disabled = true;
	}
	
}



function popitup(url) {
	newwindow=window.open(url,'name','height=500,width=425');
	if (window.focus) {newwindow.focus()}
	return false;
}




