
function validateZipAddress(zipCode,city,stateProvince){


	if(trim(zipCode.value).length < 1 && trim(city.value).length < 1 && trim(stateProvince.value).length < 1){
		alert("Please enter either ZipCode or City and State for Store search");
		zipCode.focus();
		return false;
	}
	else if(trim(zipCode.value).length < 1 && trim(city.value).length < 1 ){
		alert("Please enter City for Store search");
		stateProvince.focus();
		return false;
	}
	else if(trim(zipCode.value).length < 1 && trim(stateProvince.value).length < 1){
		alert("Please enter State for Store search");
		city.focus();
		return false;
	}
	else if(trim(zipCode.value).length > 0 && trim(zipCode.value).search(/^\d{5}$/)==-1)
	{
		alert("Invalid ZipCode");	
		zipCode.focus();
		return false;
	}
	
  	document.forms[0].submit();
  	return true;
}


function fnCheckIntegerKey(){
      if( (event.keyCode <= 47 || event.keyCode >= 58)){
            return false;
      }
      return true;
}
function fnCheckValidQty(qtykey){

if(document.getElementById(qtykey).value == "" ||  document.getElementById(qtykey).value == 0){
alert("Please enter a valid numeric value in the quantity field");
}else{
document.forms[qtykey].submit();
}

}

    function trim(strInput)
    {
        var boolFlag=true;
        var iCount=0;
        var strOutput="";

        while((boolFlag)&&(iCount <= (strInput.length-1)))
        {
            if (strInput.charAt(iCount)!=" ")
            {
                strOutput =strInput.substring(iCount);
                boolFlag=false;
            }
            iCount++;
        }

        iCount=(strOutput.length - 1);
        boolFlag=true;
        var strResult="";

        while((boolFlag)&&(iCount>=0))
        {
            if (strOutput.charAt(iCount)!=" ")
            {
                strResult=strOutput.substring(0,iCount+1);
                boolFlag=false;
            }
            iCount--;
        }
        return strResult;
    }


function fnRemoveText(){
if(document.getElementById('postalCode').value == "Zip Code"){
	document.getElementById('postalCode').value = "";
}

}
function fnHideButtons(){
 opacity('center_area1', 0, 100, 500)
			document.getElementById('center_area3').style.display = "none"
			document.getElementById('center_area2').style.display = "none"
			document.getElementById('center_area1').style.display = "block"

document.getElementById('button_1').style.display = "block"
document.getElementById('button_1g').style.display = "none"
document.getElementById('button_2').style.display = "none"
document.getElementById('button_2g').style.display = "block"
document.getElementById('button_3').style.display = "none"
document.getElementById('button_3g').style.display = "block"


InitializeTimer()
}
var stp = 0;

function fnImageSwap2(btn,frm){
	if(frm == 2){
	stp = 1;
	}
	if(btn == "button_1g"){
			 opacity('center_area1', 0, 100, 500)
			document.getElementById('center_area3').style.display = "none"
			document.getElementById('center_area2').style.display = "none"
			document.getElementById('center_area1').style.display = "block"
			
			document.getElementById('button_1').style.display = "block"
			document.getElementById('button_1g').style.display = "none"
			
			document.getElementById('button_2').style.display = "none"
			document.getElementById('button_2g').style.display = "block"
			
			document.getElementById('button_3').style.display = "none"
			document.getElementById('button_3g').style.display = "block"
			
		
		}

	
	if(btn == "button_2g"){

		 opacity('center_area2', 0, 100, 500)
			document.getElementById('center_area3').style.display = "none"
			document.getElementById('center_area2').style.display = "block"
			document.getElementById('center_area1').style.display = "none"

			document.getElementById('button_1').style.display = "none"
			document.getElementById('button_1g').style.display = "block"
			
			document.getElementById('button_2').style.display = "block"
			document.getElementById('button_2g').style.display = "none"
			
			document.getElementById('button_3').style.display = "none"
			document.getElementById('button_3g').style.display = "block"
	

	}
	
		if(btn == "button_3g"){

		 opacity('center_area3', 0, 100, 500)
			document.getElementById('center_area3').style.display = "block"
			document.getElementById('center_area2').style.display = "none"
			document.getElementById('center_area1').style.display = "none"
			
			document.getElementById('button_1').style.display = "none"
			document.getElementById('button_1g').style.display = "block"
			
			document.getElementById('button_2').style.display = "none"
			document.getElementById('button_2g').style.display = "block"
			
			document.getElementById('button_3').style.display = "block"
			document.getElementById('button_3g').style.display = "none"
			
		
		
	}
	
}


 var secs
 var timerID = null
 var timerRunning = false
 var delay = 1900
 var cnt=0;
 function InitializeTimer()
 {
     secs = 4
     StopTheClock()
     StartTheTimer()
 }
 
 function StopTheClock()
 {
     if(timerRunning)
         clearTimeout(timerID)
     timerRunning = false
 }
 
 function StartTheTimer()
 {
     if (secs==0)
     {
         StopTheClock()
        
         cnt = cnt + 1;
         if(cnt == 1){
         opacity('center_area1', 100, 0, 500)
         
         fnImageSwap2('button_2g',1);
         if(stp != 1)
         InitializeTimer()
         }
	  if(cnt == 2){
	  opacity('center_area2', 100, 0, 500)
	  fnImageSwap2('button_3g',1);
	  if(stp != 1)
	   InitializeTimer()
	  }

         if(cnt == 3){
         opacity('center_area3', 100, 0, 500)
         fnImageSwap2('button_1g',1);
          cnt = 0;
          if(stp != 1)
          InitializeTimer()
         }

         
     }
     else
     {
     	if(stp != 1){
         self.status = secs
         secs = secs - 1
         timerRunning = true
         timerID = self.setTimeout("StartTheTimer()", delay)
         }
     }
 }

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}


function opacity(id, opacStart, opacEnd, millisec) {


    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
} 




function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

