function openWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}


function randomQuote() {
i = Math.round(Math.random()*2)+1;
	switch (i) {
		case 1:
		document.write("<span class='accentHel9'><b>Just so you know:</b></span><span class='accentHel9Grey'> The U.S. Environmental Protection Agency (U.S. EPA) has ranked indoor air pollution as a high priority public health risk. (1990)</span>");
		break;
		case 2:
		document.write("<span class='accentHel9'><b>Just so you know:</b></span><span class='accentHel9Grey'> Air pollution contributes to lung disease, including respiratory tract infections, asthma, and lung cancer. (American Lung Association 1999)</span>");
		break;
		case 3:
		document.write("<span class='accentHel9'><b>Just so you know:</b></span><span class='accentHel9Grey'> Asthma is the leading serious chronic illness among children accounting for 10 million lost school days annually. (American Lung Association 2002)</span>");
		break;
	}
}

function randomImage() {
i = Math.round(Math.random()*5)+1;
	switch (i) {
		case 1:
		document.write("<img src='images/homepage/rotate/1.jpg' width='305' height='230' hspace='8' vspace='8'>");
		break;
		case 2:
		document.write("<img src='images/homepage/rotate/2.jpg' width='305' height='230' hspace='8' vspace='8'>");
		break;
		case 3:
		document.write("<img src='images/homepage/rotate/3.jpg' width='305' height='230' hspace='8' vspace='8'>");
		break;
		case 4:
		document.write("<img src='images/homepage/rotate/4.jpg' width='305' height='230' hspace='8' vspace='8'>");
		break;
		case 5:
		document.write("<img src='images/homepage/rotate/5.jpg' width='305' height='230' hspace='8' vspace='8'>");
		break;
		case 6:
		document.write("<img src='images/homepage/rotate/6.jpg' width='305' height='230' hspace='8' vspace='8'>");
		break;
	}
}


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 buildDepth(iterations){
    var iterations=iterations-3;
    var depthStr="";
    for (i=0;i<iterations;i++){
        depthStr=depthStr + "../";
    }
    return depthStr;
}
function buildBreadCrumbTrail(){
    var constituentFolders = new Array();
    var currentURL = document.location.toString();
	while (currentURL.indexOf("_")>0){
	whereIsIt = currentURL.indexOf("_");
	partA = currentURL.substring(0, whereIsIt);
	partB = currentURL.substring(whereIsIt + 1);
	currentURL = partA + " " + partB
	}
    constituentFolders=currentURL.split("/");
    var outputStr="<a href='/index.html' class='breadcrumbBlue'>Home</a><span class='breadcrumbBlack'> &gt; </span>";
    for (count=3;count<(constituentFolders.length-1);count++){
        outputStr=outputStr + "<a href='" + buildDepth((constituentFolders.length-count)+1) + "index.htm' class='breadcrumbBlue'>" + constituentFolders[count] + "</a><span class='breadcrumbBlack'> &gt; </span>";
    }
	lastSlash = currentURL.lastIndexOf("/");
	pageName = currentURL.substring(lastSlash+ 1);
	dotLoaction = pageName.indexOf(".");
	pageTitle = pageName.substring(0, eval(dotLoaction));
	if (pageTitle == "index"){
	document.write(outputStr);
	} else{
	outputStr=outputStr + "<span class='breadcrumbBlack'>"+pageTitle+"</span>";
	document.write(outputStr);
	}  
}
function buildPageTitle(){
    var constituentFolders = new Array();
    var currentURL = document.location.toString();
	while (currentURL.indexOf("_")>0){
	whereIsIt = currentURL.indexOf("_");
	partA = currentURL.substring(0, whereIsIt);
	partB = currentURL.substring(whereIsIt + 1);
	currentURL = partA + " " + partB
	}
    constituentFolders=currentURL.split("/");
	var outputStr= "<title>"
    for (count=3;count<(constituentFolders.length-1);count++){
        outputStr=outputStr + constituentFolders[count] + " &gt; ";
    }
	lastSlash = currentURL.lastIndexOf("/");
	pageName = currentURL.substring(lastSlash+ 1);
	dotLoaction = pageName.indexOf(".");
	pageTitle = pageName.substring(0, eval(dotLoaction));
	if (pageTitle == "index"){
	outputStr=outputStr + "</title>";
	document.write(outputStr);
	} else{
	outputStr=outputStr + pageTitle + "</title>";
	document.write(outputStr);
	}  
}
function displayHeader(){
thisLocation = document.location.toString();
printString = "<img src='/images/secondary_nav.jpg' width='1000' height='40' border='0'>";
if (thisLocation.indexOf("Healthy_Mattresses") > 0){
printString = "<img src='/images/header-healthy_mattress.jpg' width='1000' height='40' border='0'>";
}
if (thisLocation.indexOf("Natural_Bedding") > 0){
printString = "<img src='/images/header-natural_bedding.jpg' width='1000' height='40' border='0'>";
}
if (thisLocation.indexOf("Clean_Air") > 0){
printString = "<img src='/images/header-clean_air.jpg' width='1000' height='40' border='0'>";
}
if (thisLocation.indexOf("Eco_Design") > 0){
printString = "<img src='/images/header-eco_design.jpg' width='1000' height='40' border='0'>";
}
if (thisLocation.indexOf("HEPA_Vacuums") > 0){
printString = "<img src='/images/header-hepa_vacuums.jpg' width='1000' height='40' border='0'>";
}
document.write(printString);

}

// Javascript for the CMS CSS Menu Module
// Copyright (c) 2005 Alexander Endresen
// Released under General Public Licence
// This script will emulate the css :hover effect on the menu elements in IE

// The variables
var cssid = "primary-nav"; // CSS ID for the menuwrapper
var menuadd = "h";  // Character to be added to the specific classes upon hovering. So for example, if this is set to "h", class "menuparent" will become "menuparenth" when hovered over.
var menuh = "menuh"; // Classname for hovering over all other menu items

if (window.attachEvent) window.attachEvent("onload", cssHover);

function cssHover() {
	var sfEls = document.getElementById(cssid).getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {

		sfEls[i].onmouseover=function() {
			if (this.className != "") {
				this.className = this.className + menuadd;
			}
			else {	
				this.className = menuh;
			}
		}

		sfEls[i].onmouseout=function() {
			if (this.className == menuh) {
				this.className = "";
			}
			else {
				this.className = this.className.replace(new RegExp(menuadd + "$"), "");
			}
		}
	}
}



