
 function validateAddressForm(Continue)
	    {
		    var returnVal = false;
		    		    			
	        var mf = GetMainFormName();				
	        var zipTextboxRef =  GetElementName("address_zip", mf);
	        var zipTextbox = document.forms[mf].elements[zipTextboxRef];
	                   
            if (Continue==true)
            {
            
		        //returnVal = ValidateZip(zipTextbox);
		        
		        if (returnVal)
		        {
		            document.all.spanZipError.style.display = "none";
		        }
		        else
		        {
		            // if zip error stop processing
		            document.all.spanZipError.style.display = "block";
		           
		        }
		        returnVal=isFormValidToBeSubmitted();
		       
            }
            else
            {
                    returnVal = true;
                    
            }
           
           return returnVal;
           		    
	    }
	    

//"address_line1"
function isAddressValid(addressLineId)
{
    var AddressLineKeywords = "APO|A.P.O.|A P O|FPO|F.P.O.|F P O|POB|P.O.B.|POBOX|P.O.BOX|PO BOX|P O BOX|P.O. BOX|POST OFFICE";
    var poboxPattern = new RegExp("^(APO|A\.P\.O\.|A P O|FPO|F\.P\.O\.|F P O|POB|P\.O\.B\.|POBOX|P\.O\.BOX|PO BOX|P O BOX|P\.O\. BOX|POST OFFICE)");
   
   //var AddressLineKeywords = "APO|A.P.O.|A P O|FPO|F.P.O.|F P O|POB|P.O.B.|POBOX|P.O.BOX|PO BOX|P O BOX|P.O. BOX|POST OFFICE";
   // var poboxPattern = new RegExp("(APO|A[\.]P[\.]O[\.]|A P O|FPO|F[\.]P[\.]O[\.]|F P O|POB|P[\.]O[\.]B[\.]|POBOX|P[\.]O[\.]BOX|PO BOX|P O BOX|P[\.]O[\.] BOX|POST OFFICE)[ ]*[0-9]+");
    
    var mf = GetMainFormName();	
    var objtemp = null;
    var addressline =  GetElementName(addressLineId, mf);
	var addresslineObj = document.forms[mf].elements[addressline];
    var addresslineText = addresslineObj.value;
    
    if (poboxPattern.test(addresslineText.toUpperCase()))
    {
        if (addressLineId == 'address_line1')
            objtemp = document.getElementById("address1");
        if (addressLineId == 'address_line2')
            objtemp = document.getElementById("address2");
            
	    if (objtemp!=null) 
	       objtemp.className="ARed_11R";
//	       document.all.spanAddrError.style.display = "block";
            return false;
    }
    else
    {
     if (addressLineId == 'address_line1')
            objtemp = document.getElementById("address1");
        if (addressLineId == 'address_line2')
            objtemp = document.getElementById("address2");
            
	    if (objtemp!=null) 
	       objtemp.className="ADrkstGREY_11R";
	       
//	    document.all.spanAddrError.style.display = "none";
        return true;
	       
           
     }

        
}


function isFormValidToBeSubmitted() {
           
           var IsFormvalid=true;
            var mf = GetMainFormName();				
            
           
	        var addressline1 =  GetElementName("address_line1", mf);
	        var addressline1Obj = document.forms[mf].elements[addressline1];
	        if (addressline1Obj.value=="") {
	          IsFormvalid=false;
	          var objtemp=document.getElementById("address1");
	          if (objtemp!=null) {
	            objtemp.className="ARed_11R"
	            
	          }
	          
	        }
	        else
	        {
	            if (!isAddressValid('address_line1') || !isAddressValid('address_line2'))
	            {
	        	    document.all.spanAddrError.style.display = "block";
	                IsFormvalid = false;
	            }
	            else
	            {
	        	    document.all.spanAddrError.style.display = "none";
	            }
             }
	        
	        //state 
	        
	        var stateChoice =  GetElementName("address_state_choice", mf);
	        var stateChoiceObj = document.forms[mf].elements[stateChoice];
	         var objtemp=document.getElementById("stateLabel");	       
	        if (stateChoiceObj.selectedIndex == -1 || stateChoiceObj.selectedIndex == 0) {
	         IsFormvalid=false;
	           if (objtemp!=null) {
	            objtemp.className="ARed_11R"
	          }
	          
	        }
	        else
	        {
	                if (objtemp!=null) 
	            objtemp.className="ADrkstGREY_11R";
	        }    
	        
	        
	        //f name
	        var fname =  GetElementName("fname", mf);
	        var fnameObj = document.forms[mf].elements[fname];
	         var objtemp=document.getElementById("fnamel");
	        if (fnameObj.value=="") {
	         IsFormvalid=false;
	           if (objtemp!=null) {
	            objtemp.className="ARed_11R"
	          }
	          
	        }
	        else
	        {
	                if (objtemp!=null) 
	            objtemp.className="ADrkstGREY_11R";
	        }      
	            
	        
	        //l name
	         //f name
	        var lname =  GetElementName("lname", mf);
	        var lnameObj = document.forms[mf].elements[lname];
	        var objtemp=document.getElementById("lname1");
	        if (lnameObj.value=="") {
	              IsFormvalid=false;
	              
	              if (objtemp!=null) {
	                objtemp.className="ARed_11R"
	              }
	          
	        }
	        else
	        {
	                if (objtemp!=null) 
	            objtemp.className="ADrkstGREY_11R"
	        }  
	        
	        
	        // city
	        var addresscity =  GetElementName("address_city", mf);
	        var address_cityObj = document.forms[mf].elements[addresscity];
	        var objtemp=document.getElementById("city");
	        if (address_cityObj.value=="") {
	              IsFormvalid=false;
	              
	              if (objtemp!=null) {
	                objtemp.className="ARed_11R"
	              }
	          
	        }
	         else
	        {
	                if (objtemp!=null) 
	            objtemp.className="ADrkstGREY_11R"
	        }  
	        
	        /*
	          // phone
	        var phone =  GetElementName("phone", mf);
	        var phoneObj = document.forms[mf].elements[phone];
	        var objtemp=document.getElementById("dayphone");
	        //var IsPhoneValid=validatePhone(phoneObj.value); //removed this code so phone is always valid
	         var IsPhoneValid=true;
	         if(phoneObj.value.length<10) { //if user enters less than 10 characters
	           IsPhoneValid=false;
	         }
	        if (IsPhoneValid==false) {
	              IsFormvalid=false;
	              var objtemp=document.getElementById("dayphone");
	              if (objtemp!=null) {
	                objtemp.className="ARed_11R"
	              }
	          
	        }
	         else
	        {
	                if (objtemp!=null) 
	            objtemp.className="ADrkstGREY_11R"
	        } 
	        */
	        
	        //email
	        var email1 =  GetElementName("email", mf);
	        if (email1!=null) {
	        var emailObj = document.forms[mf].elements[email1];
	        var objtemp=document.getElementById("emailLabel");
	        if (emailObj.value=="") {
	          IsFormvalid=false;
	          
	          if (objtemp!=null) {
	            objtemp.className="ARed_11R"
	          }
	          
	        }
	       }
	         
	        //email confirmation
	        var email_conf1 =  GetElementName("email_conf", mf);
	        if (email_conf1!=null) {
	        var email_confObj = document.forms[mf].elements[email_conf1];
	        var objtemp=document.getElementById("emailLabelConf");
	        if (email_confObj.value=="") {
	          IsFormvalid=false;
	          
	          if (objtemp!=null) {
	            objtemp.className="ARed_11R"
	          }
	          
	        }
	        }
	        
	          //pass
	        var passLabel1 =  GetElementName("Password", mf);
	        if (passLabel1!=null) {
	        var passLabel1Obj = document.forms[mf].elements[passLabel1];
	         var objtemp=document.getElementById("passLabel");
	        if (passLabel1Obj.value=="") {
	          IsFormvalid=false;
	         
	          if (objtemp!=null) {
	            objtemp.className="ARed_11R"
	          }
	          
	        }
	        }
	        
	        var password_conf1 =  GetElementName("password_conf", mf);
	        if (password_conf1!=null) {
	        var password_confObj = document.forms[mf].elements[password_conf1];
	        var objtemp=document.getElementById("passLabelConf");
	        if (password_confObj.value=="") {
	          IsFormvalid=false;
	          
	          if (objtemp!=null) {
	            objtemp.className="ARed_11R"
	          }
	          
	        }
	       }
	        
	        var zipTextboxRef =  GetElementName("address_zip", mf);
	        var zipTextbox = document.forms[mf].elements[zipTextboxRef];
	        var isZipValid = true;
	        isZipValid = ValidateZip(zipTextbox);
	         if (isZipValid)
		        {
		            document.all.spanZipError.style.display = "none";
		        }
		        else
		        {
		            // if zip error stop processing
		            document.all.spanZipError.style.display = "block";
		            IsFormvalid = false;
		           
		        }
	        
	        
	       
	            

	        
	       
      return IsFormvalid;

}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}




function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
        obj.visibility=v; 
}
}

  function toggleToolTip(objName) {
        var obj = document.getElementById(objName); //$get(objName); 
        obj.style.display = "";
    }
    
    function clearToolTip(objName) {
        var obj = document.getElementById(objName); //$get(objName); 
        obj.style.display = "none";
    }
    
function SetExtendedProp(id)
{
    var querystr = document.location.search;
    var _f = document.forms[0];
    if (querystr!=''){
		querystr=querystr.substring(1,querystr.length);
    }
    if (querystr!=''){
        var prop_array = querystr.split('&');
        for (var i=0;i<prop_array.length;i++){
            var prop=prop_array[i].split('=');
            //check if page has field to update requested extended property 
            for (var j = 0; j < _f.elements.length; j++)
            {
                if (_f.elements[j].id.indexOf(id)>-1){ 
                            _f.elements[j].value=prop[1];
                }
            }           
        }
    }
 
}

function SetLogin(loginname)
{
    var mf = GetMainFormName();
    if (mf==null) return;
    var login = GetElementName("hidden_login",mf)
    if (login!= null)
        document.forms[mf].elements[login].value = loginname;
}
							
function Sethiddenloginvalue(val)
{
	var _f = document.forms[0];
	for (i=0;i<_f.elements.length;i++)
	{
		if (_f.elements[i].id.indexOf('hidden_login') != -1)
			_f.elements[i].value=val;
	}
 }
 									
function GetElementName(n, mf)
{
	if (n==null || n=="") return null;
	var i, s, j;
	for (i=0;i<document.forms[mf].elements.length;i++)
	{
	if (document.forms[mf].elements[i].name.toLowerCase().indexOf(n.toLowerCase()) != -1)
	return document.forms[mf].elements[i].name;

	}
	return null;
}

// CSS Drop Down
var cssdropdown={
    disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
    disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
    enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no

    //No need to edit beyond here////////////////////////
    dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,
    dropmenuimg: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,
    
    getposOffset:function(what, offsettype){
//        var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
        var totaloffset=12;
        var parentEl=what.offsetParent;
        if (parentEl!=null){
          
           if (offsettype=="left"){
          totaloffset=  totaloffset+parentEl.offsetLeft-39;
           }else{
           totaloffset= totaloffset+parentEl.offsetTop;
           }
          
        }
        else
        {
            var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
           
        }
        if (offsettype!="left" && this.ie)
        {
            totaloffset = totaloffset-13;
        }
        return totaloffset;
    },

    swipeeffect:function(){
        if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
            this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
            this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
        }
        else
            return
        this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
    },

    showhide:function(obj, e){
        try {
             _QuickShop_Class.Hide();
             }
        catch (err) {
        
        }     
        if (this.ie || this.firefox)
            this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
        if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
            this.swapimage(this.dropmenuimg, "on");
            if (this.enableswipe==1){
                if (typeof this.swipetimer!="undefined")
                    clearTimeout(this.swipetimer)
                obj.clip="rect(0 auto 0 0)" //hide menu via clipping
                this.bottomclip=0
                this.swipeeffect()
            }
            obj.visibility="visible"
            
        }
        else if (e.type=="click")
        {
            this.swapimage(this.dropmenuimg, "off");
            obj.visibility="hidden";
             
        }
    },

    iecompattest:function(){
        return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    },

    clearbrowseredge:function(obj, whichedge){
        var edgeoffset=0
        if (whichedge=="rightedge"){
            var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
            this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
            if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
                edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
        }
        else{
            var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
            var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
            this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
            if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
                edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
                if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
                    edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
            }
        }
        return edgeoffset
    },

    dropit:function(obj, e, dropmenuID, imageID){
        if (this.dropmenuobj!=null) //hide previous menu
        {
            this.dropmenuobj.style.visibility="hidden" //hide menu
            var keepOn = this.dropmenuimg.getAttribute("keepOn");
            if (keepOn == null)
            {
                this.swapimage(this.dropmenuimg, "off"); // turn off image
            }
        }

        /* <Begin> */
        /* F.N This code hides the drop downs if ie 6.0 only */
        try 
        {
            ToggleDropDowns('hidden');
        }
        catch (err) { }
        /*<end> */

        this.clearhidemenu()
        if (this.ie||this.firefox){
            obj.onmouseout=function(){cssdropdown.delayhidemenu()}
            obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
            this.dropmenuobj=document.getElementById(dropmenuID)
            this.dropmenuimg=document.getElementById(imageID)
            this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
            this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
            this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
            this.showhide(this.dropmenuobj.style, e)
            this.dropmenuobj.x=this.getposOffset(this.dropmenuimg, "left")
            this.dropmenuobj.y=this.getposOffset(this.dropmenuimg, "top")
            this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
            this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
        }
    },

    contains_firefox:function(a, b) {
        while (b.parentNode)
            if ((b = b.parentNode) == a)
                return true;
        return false;
    },

    dynamichide:function(e){
        var evtobj=window.event? window.event : e
        if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
            this.delayhidemenu()
        else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
            this.delayhidemenu()
    },
    
    delayhidemenu:function(){
        var keepOn = this.dropmenuimg.getAttribute("keepOn");
        var imgSrc = ""; 
        if (keepOn == null)
        {
            imgSrc = this.getswapimagesrc(this.dropmenuimg, "off");
        }
        else
        {
            imgSrc = this.getswapimagesrc(this.dropmenuimg, "on");
        }
        var cmd = "cssdropdown.dropmenuimg.src='" + imgSrc + "';cssdropdown.dropmenuobj.style.visibility='hidden'";
        this.delayhide=setTimeout(cmd,this.disappeardelay); //hide menu

        /* F.N This code below will show the drop downs if IE 6.0 only */
        try {
            ToggleDropDowns('visible');
        }
        catch (err) {
            //do nothing
        }
    },
    
    swapimage:function(img, imgState)
    {
        img.src=this.getswapimagesrc(img, imgState);
    },

    // Given an image string, return the off/on state src.
    // ASSUME: the image name will be for the form *_[off | on].*
    getswapimagesrc:function(img, imgState)
    {
        var imgSrc = '';
        if (img != null)
        {
	        var imgStateOn = "_on.";
	        var imgStateOff = "_off.";
	        imgSrc = img.src;
	        var imgPathAndFileName = imgSrc.slice(0, imgSrc.lastIndexOf(".") + 1)
	        var imgFileExtension = imgSrc.slice(imgSrc.lastIndexOf(".") + 1, imgSrc.length);

	        if (imgPathAndFileName.indexOf(imgStateOn) > 0 && imgState == 'off')
	        {
		        imgSrc = imgPathAndFileName.slice(0, imgPathAndFileName.indexOf(imgStateOn)) + imgStateOff + imgFileExtension;
	        }
	        if (imgPathAndFileName.indexOf(imgStateOff) > 0 && imgState == 'on')
	        {
		        imgSrc = imgPathAndFileName.slice(0, imgPathAndFileName.indexOf(imgStateOff)) + imgStateOn + imgFileExtension;
	        }
        }
    	
	    return imgSrc;
    },

    clearhidemenu:function(){
        if (this.delayhide!="undefined")
            clearTimeout(this.delayhide)
    },

    startchrome:function(){
        for (var ids=0; ids<arguments.length; ids++){
        var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
        for (var i=0; i<menuitems.length; i++){
            if (menuitems[i].getAttribute("rel")){
                var relvalue=menuitems[i].getAttribute("rel");
                var imageID=menuitems[i].getAttribute("imgID");
                menuitems[i].onmouseover=function(e){
                    var event=typeof e!="undefined"? e : window.event
                    cssdropdown.dropit(this,event,this.getAttribute("rel"),this.getAttribute("imgID"))
                }
            }
        }
    }
    }
}

//Validate zipcode: Zip should have 5 numeric characters
function ValidateZip(zipTextbox)
{		
	//Check if zip code length is 5
	if(zipTextbox.value.length != 5)
	{
		return false;
	}				
	else			
	{
		//If zipcode length is 5, only allow 0-9 to be entered as the characters
		var checkOK = "0123456789";
		var allValid = true;
		for (var i=0; i < zipTextbox.value.length; i++) 
		{ 
			ch = zipTextbox.value.charAt(i);
			
			for (var j = 0;  j < checkOK.length;  j++)
			{							
				if (ch == checkOK.charAt(j))
					break;							
			}
			
			if (j == checkOK.length)
			{							
				allValid = false;
				break;
			}
		}
		if (!allValid) 
		{
			return false;
		}	
		else
		{
			return true;
		}						
	}
}

// This function will reset the information about
// the shopping cart in the header so that it is empty.
function ClearCartContents()
{
    try
    {
        document.all.ShoppingCartBubble_TotalItems_header.innerHTML = "0";
        document.all.ShoppingCartBubble_SubTotal_header.innerHTML = "$0.00";
    }
    catch (err)
    {
        // Do nothing - continue
    }
}        

function gosearch(absoluteURL)
{	
	var mf = GetMainFormName();		
	if (mf==null) return;
	var searchVal = document.forms[mf].elements["SearchKeywords"].value;
	searchVal = searchVal.toLowerCase();
	if (typeof(absoluteURL)!='undefined') {
	document.forms[mf].action=absoluteURL + "/search/index.aspx?SearchKeywords=" + searchVal;
	}
	else {
	document.forms[mf].action="/search/index.aspx?SearchKeywords=" + searchVal;
	}
	document.forms[mf].submit();
}	

function search_onfocus(el)
{
	var mf = GetMainFormName();
	if (mf==null) return;
	//el.value = '';
	document.forms[mf].target = "_top";
	document.forms[mf].action="/search/index.aspx?SearchKeywords=" + document.forms[mf].elements["SearchKeywords"].value;
}
function isEnter(e,absoluteURL)
{
	if (e.keyCode == 13)
	{		if (typeof(absoluteURL)!='undefined') {
		    gosearch(absoluteURL);
		   }
		   else {
		       gosearch();
		  }
	}	
	return true;
}

var SUBMIT_ID='ctl00$ctl00$brandlayout0$ctl00$mainbody0$ctl00$ctl03$ctl00$ctl00$submit';
var SUBMIT_ID_STEP1_CHECKOUT="ctl00$ctl00$brandlayout0$ctl00$mainbody0$ctl00$ctl04$ctl00$ctl00$submit";
                              
function SubmitForm_OnEnterPressed(e,buttonID) {
   if (e.keyCode == 13) {
          // var mf = GetMainFormName();
          //if (mf==null) return;
          //var _submitid=GetElementName(buttonID,mf);
          //__doPostBack(_submitid, '') ;
            __doPostBack(buttonID, '') ;
    }

}
function search_GoToURL(url)
{
	if (url!="") document.location.href= url;
}

//
// FLASH ACTIVATION
function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, FLASHVARS, AUTOSTART,BGCOLOR)
{
  var d = document.getElementById(DivID);
  var objectTag = '<object classid=' + CLSID + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT +' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
  objectTag = objectTag + '<param name="allowScriptAccess" value="sameDomain">';
  objectTag = objectTag + '<param name="movie" value=' + URL + '>'
  objectTag = objectTag + '<param name="FlashVars" value=' + FLASHVARS + '>';
  objectTag = objectTag + '<param name="quality" value="high">'  
  //objectTag = objectTag + '<param name="bgcolor" value="#000000">'  
  objectTag = objectTag + '<param name="bgcolor" value=' + BGCOLOR +'>'  
  objectTag = objectTag + '<param name="autoStart" value=' + AUTOSTART + '/>';
  objectTag = objectTag + '<embed src="' + URL + '" flashVars="' + FLASHVARS + '" quality="high" bgcolor="' + BGCOLOR + '"  width="' + WIDTH + '" height="' + HEIGHT +'" name="main" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
  objectTag = objectTag + "</object>";
  d.innerHTML = objectTag;
}
				
function CreateTransparentControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, FLASHVARS, AUTOSTART)
{
  var d = document.getElementById(DivID);
  var objectTag = '<object classid=' + CLSID + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT +' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
  objectTag = objectTag + '<param name="allowScriptAccess" value="sameDomain">';
  objectTag = objectTag + '<param name="movie" value=' + URL + '>'
  objectTag = objectTag + '<param name="FlashVars" value=' + FLASHVARS + '>';
  objectTag = objectTag + '<param name="quality" value="high">'  
  objectTag = objectTag + '<param name="autoStart" value=' + AUTOSTART + '/>';
  
  objectTag = objectTag + '<param name="wmode" value="transparent" />'
				
  objectTag = objectTag + '<embed wmode="transparent" src="' + URL + '" flashVars="' + FLASHVARS + '" quality="high" bgcolor="#000000" width="' + WIDTH + '" height="' + HEIGHT +'" name="main" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
  objectTag = objectTag + "</object>";
  d.innerHTML = objectTag;
}


function getswapimagesrc(img, imgState)
{
    var imgSrc = '';
    if (img != null)
    {
        var imgStateOn = "_on.";
        var imgStateOff = "_off.";
        imgSrc = img.src;
        var imgPathAndFileName = imgSrc.slice(0, imgSrc.lastIndexOf(".") + 1).toLowerCase();
        var imgFileExtension = imgSrc.slice(imgSrc.lastIndexOf(".") + 1, imgSrc.length);

        if (imgPathAndFileName.indexOf(imgStateOn) > 0 && imgState == 'off')
        {
	        imgSrc = imgPathAndFileName.slice(0, imgPathAndFileName.indexOf(imgStateOn)) + imgStateOff + imgFileExtension;
        }
        if (imgPathAndFileName.indexOf(imgStateOff) > 0 && imgState == 'on')
        {
	        imgSrc = imgPathAndFileName.slice(0, imgPathAndFileName.indexOf(imgStateOff)) + imgStateOn + imgFileExtension;
        }
    }
	
    img.src = imgSrc;
}


function HideQuickShopiIcon() {

   try {
             _QuickShop_Class.Hide();
             }
        catch (err) {
        
        }   

}

/* 
 * Prevents user from entering more than specific number of characters in a textbox/textarea
 */
function LimitTextLength(textArea, maxLength)
{		
	if (maxLength == 0)
		maxLength = 150;

	if(textArea.value.length > maxLength )
	{		
		textArea.value = textArea.value.substring(0, maxLength);
		textArea.focus();
	}			
}	

// turns on/off the MyDermablend DropDown Menu in the top nav.
   function  ToggleMyDermablendDropDown(display)
   {
   var dropDownMenu=document.getElementById('dropmenu1');  //$get('dropmenu1');
   if(display==true){   dropDownMenu.style.display='';}
   else{dropDownMenu.style.display='none';}
  } 
   
    // correctly handle PNG transparency in Win IE 5.5 & 6.
 //**Please note the size of the image is defined in the code
 function correctSinglePNG(thePNG) 
    {
       var arVersion = navigator.appVersion.split("MSIE")
       var version = parseFloat(arVersion[1])
        if ((version >= 5.5)&& (version < 7.0) && (document.body.filters))  {
      
             var img = thePNG;
             
             var imgName = img.src.toUpperCase()
             if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
             {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                //var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText                
             
                //if (img.align == "left") imgStyle = "float:left;" + imgStyle
                //if (img.align == "right") imgStyle = "float:right;" + imgStyle
                //if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass
                //+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                + " style=\"" + "width:100px;height:100px;" + imgStyle + ";"
                + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                + "(src=\'" + img.src + "\', sizingMethod='crop');\"></span>"; 
                img.outerHTML = strNewHTML;                 
             
             }
         
      }    
}

 // correctly handle PNG transparency in Win IE 5.5 & 6.
 function correctPNG() 
    {
       var arVersion = navigator.appVersion.split("MSIE")
       var version = parseFloat(arVersion[1])
         if ((version >= 5.5)&& (version < 7.0) && (document.body.filters)) 
       {
          for(var i=0; i<document.images.length; i++)
          {
             var img = document.images[i]
             
             var imgName = img.src.toUpperCase()
             if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
             {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText 
                //if (img.align == "left") imgStyle = "float:left;" + imgStyle
                //if (img.align == "right") imgStyle = "float:right;" + imgStyle
                //if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
                + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                + "(src=\'" + img.src + "\', sizingMethod='crop');\"></span>"; 
                img.outerHTML = strNewHTML;
                i = i-1
             }
          }
       }    
    }
    
    
     






