    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    function HideShow(objname)
    { 
        if (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOf["MSIE 5"] != -1) 
        {
            if (document.getElementById(objname).style.display=="block") 
                document.getElementById(objname).style.display="none";
            else
                document.getElementById(objname).style.display="block";
        }
    } 

    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	function JustShow(objname) 
    { 
        if (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOf["MSIE 5"] != -1) 
        {
            document.getElementById(objname).style.display="block";
        }
    } 

    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    function JustHide(objname) 
    { 
        if (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOf["MSIE 5"] != -1) 
        {
            document.getElementById(objname).style.display="none";
        }
    } 

    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    function imgToggle(imgName,strOnExt,strOffExt) {
        var MYarVersion = navigator.appVersion.split("MSIE")
        var MYversion = parseFloat(MYarVersion[1])

        if (!(MYversion >= 5.5) && !(document.body.filters)) {
            if (document.images) {
                if (strOnExt.length > 0)  
                {
                    document[imgName].src = eval(imgName + strOnExt + ".src"); 
                } 
                else 
                {
                    document[imgName].src = eval(imgName + strOffExt + ".src"); 
                }
            }
        }
    }


function imgSwap(oImg)
{
   var strOver  = "_on"    // image to be used with mouse over
   var strOff = "_off"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}



    function containsDOM (container, containee) {
        var isParent = false;
        do {
            if ((isParent = container == containee))
            break;
            containee = containee.parentNode;
        }
        while (containee != null);
        return isParent;
    }

    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    function checkMouseEnter (element, evt) {
        if (element.contains && evt.fromElement) {
            return !element.contains(evt.fromElement);
        }
        else if (evt.relatedTarget) {
            return !containsDOM(element, evt.relatedTarget);
        }
    }

    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    function checkMouseLeave (element, evt) {
        if (element.contains && evt.toElement) {
            return !element.contains(evt.toElement);
        }
        else if (evt.relatedTarget) {
            return !containsDOM(element, evt.relatedTarget);
        }
    }

// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	function popupCloseUp (imageName)
	{
		var imagePath = "/downloads/productPhotos/QDFPopups/"+ imageName;
		var imageWindow = "imageWindow";
		var imageProperties = "width=820,height=500,scrollbars=0,resizable=0,menubar=0,status=0,location=0,toolbar=0";
		window.open (imagePath,imageWindow,imageProperties);
	}

    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	function openHBD() {
		var HBDlink = 'http://hbd.hearthnhome.com/ui/?DID=quadrafire.com&BIDs=3';
		HBDwin=window.open(HBDlink ,'HBD','height=585, width=780, status=no, toolbar=no, location=no, menubar=no, directories=no, resizable=no, scrollbars=no');
		if (window.focus) {HBDwin.focus()};
	}
	
	
	//Customization 1/22/2009 Tweedy ITSR: 76988 - QuadraFire changes
	function openPG() {
		var PGlink = '/photogallery/index.html';
		PGwin=window.open(PGlink ,'PG');
		if (window.focus) {PGwin.focus()};
	}




//Customization 1/23/2009 Tweedy ITSR: 76988 - QuadraFire changes
function CheckEntries(form){
	if (document.form1.postalcode.value==""){
		alert("Please enter a Postal Code to find a dealer near you.")
		return (false);
	}else{
		if(!isValidZipcode(document.form1.postalcode.value)){
			if(!isValidPostalcode(document.form1.postalcode.value)){
				alert("Please enter a valid postal code")
				return (false);
			}
		}
		else{
		return (true);
		}
	}
}
function validate(){
	if (document.form1.postalcode.value==""){
		alert("Please enter a Postal Code to find a dealer near you.")
		return (false);
	}else{
		if(!isValidZipcode(document.form1.postalcode.value)){
			if(!isValidPostalcode(document.form1.postalcode.value)){
				alert("Please enter a valid postal code")
				return (false);
			}
		}
		else{
		document.form1.submit();
		}
	}
}
// Check that a US zip code is valid
function isValidZipcode(zipcode) {
   zipcode = removeSpaces(zipcode);
   if (!(zipcode.length == 5 || zipcode.length == 9 || zipcode.length == 10)) return false;
   if ((zipcode.length == 5 || zipcode.length == 9) && !IsNumeric(zipcode)) return false;
   if (zipcode.length == 10 && zipcode.search && zipcode.search(/^\d{5}-\d{4}$/) == -1) return false;
   return true;
}
// Check that a Canadian postal code is valid
function isValidPostalcode(postalcode) {
   if (postalcode.search) {
      postalcode = removeSpaces(postalcode);
      if (postalcode.length == 6 && postalcode.search(/^[a-zA-Z]\d[a-zA-Z]\d[a-zA-Z]\d$/) != -1) return true;
      else if (postalcode.length == 7 && postalcode.search(/^[a-zA-Z]\d[a-zA-Z]-\d[a-zA-Z]\d$/) != -1) return true;
      else return false;
   }
   return true;
}
function IsNumeric(sText){
	var ValidChars = "0123456789";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++){ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
		}
	}
return IsNumber;
}
// Remove all spaces from a string
function removeSpaces(string) {
   var newString = '';
   for (var i = 0; i < string.length; i++) {
      if (string.charAt(i) != ' ') newString += string.charAt(i);
   }
   return newString;
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}