// JavaScript Document
 function validator(pickLocation)  {
  
  if (pickLocation.Referrer.selectedIndex == 0) {
       alert('How did you hear about us?');
       pickLocation.Referrer.focus();
       return false;
     }
     
    if (pickLocation.Amount.value=="" && pickLocation.package.selectedIndex == 0)  {
      alert("Please select a package or enter an amount for anything  in the salon.");
      pickLocation.Amount.focus();
      return (false);
      }
  
    if (pickLocation.To.value=="")  {
      alert("Please enter the name of the person this gift certificate is for.");
      pickLocation.To.focus();
      return (false);
      }
  
    if (pickLocation.From.value=="")  {
      alert("Please enter the name of the person this gift certificate is from.");
      pickLocation.From.focus();
      return (false);
      }
  
  if (!pickLocation.Where_To_Send[0].checked && 
  !pickLocation.Where_To_Send[1].checked) {
      // no radio button is selected
      alert("Where do you want this gift certificate sent?");
      return false;
      }
    if (pickLocation.Recipient_Address.value=="" && pickLocation.Where_To_Send[1].checked)  {
      alert("Please enter the recipient's address.");
      pickLocation.Recipient_Address.focus();
      return (false);
      }
  
    if (pickLocation.Recipient_City.value=="" && pickLocation.Where_To_Send[1].checked)  {
      alert("Please enter the recipient's city.");
      pickLocation.Recipient_City.focus();
      return (false);
      }
  
  if (pickLocation.Recipient_State.selectedIndex == 0 && pickLocation.Where_To_Send[1].checked) {
      alert("Please select the recipient's state.");
       pickLocation.Recipient_State.focus();
       return false;
     } 
  
    if (pickLocation.Recipient_Zip.value=="" && pickLocation.Where_To_Send[1].checked)  {
      alert("Please enter the recipient's zip code.");
      pickLocation.Recipient_Zip.focus();
      return (false);
      }
    if (pickLocation.Address.value=="")  {
      alert("Please enter the card holder's address.");
      pickLocation.Address.focus();
      return (false);
      }    
  
    if (pickLocation.City.value=="")  {
      alert("Please enter the card holder's city.");
      pickLocation.City.focus();
      return (false);
      }    
  
  if (pickLocation.State.selectedIndex == 0) {
      alert("Please select the card holder's state.");
       pickLocation.State.focus();
       return false;
     } 
  
    if (pickLocation.Zip.value=="")  {
      alert("Please enter the card zip code.");
      pickLocation.Zip.focus();
      return (false);
      }      
   
     if (pickLocation.Phone.value=="")  {
      alert("Please enter your phone number.");
      pickLocation.Phone.focus();
      return (false);
      }      
    
    if (pickLocation.Email.value=="")  {
      alert("Please enter your e-mail address.");
      pickLocation.Email.focus();
      return (false);
      }
      else if ((pickLocation.Email.value.indexOf ('@',0) == -1 || pickLocation.Email.value.indexOf ('.',0) == -1) && pickLocation.Email.value != "")
          {
          alert("Please verify that your email address is valid.");
          pickLocation.Email.focus();
          return (false);
          } 
  }
 
 var newwindow;
  function newWindow(url)
      {
      newwindow=window.open(url,'name','height=200, width=200, scrollbars=0, left=600, top=20');
      if (window.focus) {newwindow.focus()}
      }

var imgOld;
	function rollon (imgName) {
		if (document.images && parent.Preloaded && (imgName != parent.Triggered)) {
			document.images[imgName].src = parent.btn[imgName] + "_o.png";
		}
	}
	
	function rolloff (imgName) {
		if (document.images && (imgName != parent.Triggered)) {
			document.images[imgName].src = parent.btn[imgName] + ".png";
		}
	}
	
		function trigger (imgName) {
				if (document.images && parent.Preloaded) {
					imgOld = parent.Triggered;
					if (imgOld.indexOf('1') != -1) {
							document.images[imgOld].src = parent.btn[imgOld] + ".png";
						} else {
								parent.footer.document.images[imgOld].src = parent.btn[imgOld] + ".png";
					}
					document.images[imgName].src = parent.btn[imgName] + "_d.png";
					parent.Triggered = imgName;
				}
			}


var imgOld;
			function rollon (imgName) {
				if (document.images && parent.Preloaded && (imgName != parent.Triggered)) {
					document.images[imgName].src = parent.btn[imgName] + "_o.png";
				}
			}

			function rolloff (imgName) {
				if (document.images && (imgName != parent.Triggered)) {
					document.images[imgName].src = parent.btn[imgName] + ".png";
				}
			}
			
			function trigger (imgName) {
				if (document.images && parent.Preloaded) {
					imgOld = parent.Triggered;
					if (imgOld.indexOf('1') == -1) {
							/*if (imgOld != "news2") { */
								document.images[imgOld].src = parent.btn[imgOld] + ".png";
							/*} else {
								parent.footer.document.images[imgOld].src = parent.btn[imgOld] + ".png";
							};*/
						} else {
						parent.header.document.images[imgOld].src = parent.btn[imgOld] + ".png";	
					}
					document.images[imgName].src = parent.btn[imgName] + "_d.png";
					parent.Triggered = imgName;
				}
			}


function IsNumeric(strString)
  /*  Make sure numbers are in numeric fields.  */  
    {
    var strValidChars = "0123456789.-";
    var strChar;
    var blnResult = true;
  
    for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
        {
          blnResult = false;
        }
      }
      return blnResult;
    }


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

var sTargetURL = "Home.asp";

function doRedirect()
{
    setTimeout( "window.location.href = sTargetURL", 13*1000 );
    //  The 131000 equals 13 seconds.
}


var zeromsg="You can't enter 0 or non-numeric value for product quantity. Please try again !";

// Switch menu item in header. Executed from any page.
function switchHeader (imgName) {
	parent.parent.header.trigger (imgName);
}

// Switch menu item in footer. Executed from any page.
function switchFooter (imgName) {
	parent.parent.footer.trigger (imgName);
}

function menuRefresh() {
	parent.footer.document.location.reload();
}

function setPrev (prevHref) {
	parent.prev2 = true;
	parent.prevHref = prevHref;
	menuRefresh ();
}
function setNext (nextHref) {
	parent.next2 = true;
	parent.nextHref = nextHref;
	menuRefresh ();
}
function clearNP () {
	parent.prev2 = false;
	parent.next2 = false;
	menuRefresh ();
}

function setfocus(mycontrol) {
  mycontrol.focus();
  mycontrol.select();
}

//This is used for the splash page of Index.asp
var fadeimages=new Array()
fadeimages[0]=["strips/portal/amb_portal_1o.jpg", "Home.asp", ""]
fadeimages[1]=["strips/portal/amb_portal_2o.jpg", "Home.asp", ""]
fadeimages[2]=["strips/portal/amb_portal_3o.jpg", "Home.asp", ""]
fadeimages[3]=["strips/portal/amb_portal_4o.jpg", "Home.asp", ""]
fadeimages[4]=["strips/portal/amb_portal_5o.jpg", "Home.asp", ""]
fadeimages[5]=["strips/portal/amb_portal_6o.jpg", "Home.asp", ""]
fadeimages[6]=["strips/portal/amb_portal_7o.jpg", "Home.asp", ""]
fadeimages[7]=["strips/portal/amb_portal_8o.jpg", "Home.asp", ""]
fadeimages[8]=["strips/portal/amb_portal_9o.jpg", "Home.asp", ""]





//Not sure where this is used
//Not sure where this is used
//Not sure where this is used
//Not sure where this is used
//Not sure where this is used
var fadeimages2=new Array()
fadeimages2[0]=["strips/home/amb_home_1o.jpg", "", ""]
fadeimages2[1]=["strips/home/amb_home_2o.jpg", "", ""]
fadeimages2[2]=["strips/home/amb_home_3o.jpg", "", ""]
fadeimages2[3]=["strips/home/amb_home_4o.jpg", "", ""]
fadeimages2[4]=["strips/home/amb_home_5o.jpg", "", ""]
fadeimages2[5]=["strips/home/amb_home_6o.jpg", "", ""]
fadeimages2[6]=["strips/home/amb_home_7o.jpg", "", ""]
fadeimages2[7]=["strips/home/amb_home_8o.jpg", "", ""]
fadeimages2[8]=["strips/home/amb_home_9o.jpg", "", ""]






var fadeimages3=new Array()
fadeimages3[0]=["strips/spa/amb_spa_1o.jpg", "", ""]
fadeimages3[1]=["strips/spa/amb_spa_2o.jpg", "", ""]
fadeimages3[2]=["strips/spa/amb_spa_3o.jpg", "", ""]
fadeimages3[3]=["strips/spa/amb_spa_4o.jpg", "", ""]
fadeimages3[4]=["strips/spa/amb_spa_5o.jpg", "", ""]
fadeimages3[5]=["strips/spa/amb_spa_6o.jpg", "", ""]
fadeimages3[6]=["strips/spa/amb_spa_7o.jpg", "", ""]
fadeimages3[7]=["strips/spa/amb_spa_8o.jpg", "", ""]
fadeimages3[8]=["strips/spa/amb_spa_9o.jpg", "", ""]

var fadeimages4=new Array()
fadeimages4[0]=["strips/salon/amb_salon_1o.jpg", "", ""]
fadeimages4[1]=["strips/salon/amb_salon_2o.jpg", "", ""]
fadeimages4[2]=["strips/salon/amb_salon_3o.jpg", "", ""]
fadeimages4[3]=["strips/salon/amb_salon_4o.jpg", "", ""]
fadeimages4[4]=["strips/salon/amb_salon_5o.jpg", "", ""]
fadeimages4[5]=["strips/salon/amb_salon_6o.jpg", "", ""]
fadeimages4[6]=["strips/salon/amb_salon_7o.jpg", "", ""]
fadeimages4[7]=["strips/salon/amb_salon_8o.jpg", "", ""]
fadeimages4[8]=["strips/salon/amb_salon_9o.jpg", "", ""]

var fadeimages5=new Array()
fadeimages5[0]=["strips/products/amb_products_1o.png", "", ""]
fadeimages5[1]=["strips/products/amb_products_2o.png", "", ""]
fadeimages5[2]=["strips/products/amb_products_3o.png", "", ""]
fadeimages5[3]=["strips/products/amb_products_4o.png", "", ""]
fadeimages5[4]=["strips/products/amb_products_5o.png", "", ""]
fadeimages5[5]=["strips/products/amb_products_6o.jpg", "", ""]
fadeimages5[6]=["strips/products/amb_products_7o.jpg", "", ""]
fadeimages5[7]=["strips/products/amb_products_8o.jpg", "", ""]
fadeimages5[8]=["strips/products/amb_products_9o.png", "", ""]
fadeimages5[9]=["strips/products/amb_products_10o.jpg", "", ""]
fadeimages5[10]=["strips/products/amb_products_11o.jpg", "", ""]

var fadeimages6=new Array()
fadeimages6[0]=["strips/work/amb_model_chad_1o.jpg", "", ""]
fadeimages6[1]=["strips/work/amb_model_rk_1o.jpg", "", ""]
fadeimages6[2]=["strips/work/amb_model_sm_1o.jpg", "", ""]
fadeimages6[3]=["strips/work/amb_model_sm_2o.jpg", "", ""]



//This is used on HOME.asp
var fadeimages7=new Array()
fadeimages7[0]=["strips/mixed/amb_mixed_1o.jpg", "", ""]

fadeimages7[1]=["strips/mixed/amb_mixed_2o.jpg", "", ""]

fadeimages7[2]=["strips/mixed/amb_mixed_3o.jpg", "", ""]

fadeimages7[3]=["strips/mixed/amb_mixed_4o.jpg", "", ""]

fadeimages7[4]=["strips/mixed/amb_mixed_5o.jpg", "", ""]

fadeimages7[5]=["strips/mixed/amb_mixed_6o.jpg", "", ""]

fadeimages7[6]=["strips/mixed/amb_mixed_7o.jpg", "", ""]

fadeimages7[7]=["strips/mixed/amb_mixed_8o.jpg", "", ""]

fadeimages7[8]=["strips/mixed/amb_mixed_9o.jpg", "", ""]


/* var fadeimages3=new Array() //2nd array set example. Remove or add more sets as needed.
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["strips/amb_image_1.png", "", ""] //plain image syntax
fadeimages[1]=["strips/amb_image_2.png", "http://www.cssdrive.com", ""] //image with link syntax
fadeimages[2]=["strips/amb_image_3.png", "http://www.javascriptkit.com", "_new"] //image with link and target syntax
*/
 
var fadebgcolor="#FAF7F2"
 
////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}
