function printpage() {
window.print();  
}

function mailpage(url)
{
docname = "emailtofriend.php?url=" + url;
MyWindow=window.open(docname,'MyWindowETF','toolbar=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=400,height=300,left=250,top=200');
}
function savetofolder(type, contentid, userid, lowdis)
{
docname = "savetofolder.php?type=" + type + "&contentid=" + contentid + "&thisuserid=" + userid + "&lowdis=" + lowdis;
MyWindow=window.open(docname,'MyWindowMyF','toolbar=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=400,height=300,left=250,top=200');
}
function deletefromfolder(type, contentid){
	answer = confirm ("Delete this item?");
if (answer==true){
window.location.href="http://www.healthyhouseinstitute.com/myfolder.php?action=del&contentid=" + contentid + "&type=" + type;
}else{

}
}

function displayprodimg(imagefile, tname, iwidth, iheight){
document.getElementById('mainimage').innerHTML = "<img src=\"http://www.healthyhouseinstitute.com/objimages/" + imagefile + "\" title=\"" + tname + "\" alt=\"" + tname + "\" width=\"" + iwidth + "\" height=\"" + iheight + "\" />";
}

function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var searcher = createRequestObject();


ieMenu = function() {
if (document.all&&document.getElementById) {
categoriesRoot = document.getElementById("categories");
            var thelis=categoriesRoot.getElementsByTagName("LI");
            for(i=0;i<thelis.length;i++){
						   if(thelis[i].lastChild.tagName=="UL"){
               thelis[i].onmouseover=function(){
                    this.lastChild.style.display="block";
                    }
                    thelis[i].onmouseout=function(){
                        this.lastChild.style.display="none";
                    }
                }
            }
        }

}
function showpedia(id) {
docname = "smallpedia.php?id=" + id;
MyWindow=window.open(docname,'MyWindowPed','toolbar=1,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=400,height=300,left=250,top=200');
}
// qTip - CSS Tool Tips - by Craig Erskine
// http://qrayg.com | http://solardreamstudios.com
// Inspired by code from Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com

var qTipTag = "a";
var qTipX = 0;
var qTipY = 25;

tooltip = {
  name : "qTip",
  offsetX : qTipX,
  offsetY : qTipY,
  tip : null
}

tooltip.init = function () {
	var tipNameSpaceURI = "http://www.w3.org/1999/xhtml";
	if(!tipContainerID){ var tipContainerID = "qTip";}
	var tipContainer = document.getElementById(tipContainerID);

	if(!tipContainer) {
	  tipContainer = document.createElementNS ? document.createElementNS(tipNameSpaceURI, "div") : document.createElement("div");
		tipContainer.setAttribute("id", tipContainerID);
	  document.getElementsByTagName("body").item(0).appendChild(tipContainer);
	}

	if (!document.getElementById) return;
	this.tip = document.getElementById (this.name);
	if (this.tip) document.onmousemove = function (evt) {tooltip.move (evt)};

	var a, sTitle;
	var anchors = document.getElementsByTagName (qTipTag);

	for (var i = 0; i < anchors.length; i ++) {
		a = anchors[i];
		sTitle = a.getAttribute("title");
		if(sTitle) {
			a.setAttribute("tiptitle", sTitle);
			a.removeAttribute("title");
			a.onmouseover = function() {tooltip.show(this.getAttribute('tiptitle'))};
			a.onmouseout = function() {tooltip.hide()};
		}
	}
}

tooltip.move = function (evt) {
	var x=0, y=0;
	if (document.all) {//IE
		x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		x += window.event.clientX;
		y += window.event.clientY;
		
	} else {//Good Browsers
		x = evt.pageX;
		y = evt.pageY;
	}
	this.tip.style.left = (x + this.offsetX) + "px";
	this.tip.style.top = (y + this.offsetY) + "px";
}

tooltip.show = function (text) {
	if (!this.tip) return;
	this.tip.innerHTML = "<table><tr><td><img src=\"hhitooltipbg.gif\" width=\"40\" height=\"40\" \></td><td>" + text + "</td></tr></table>";
	this.tip.style.display = "block";
}

tooltip.hide = function () {
	if (!this.tip) return;
	this.tip.innerHTML = "";
	this.tip.style.display = "none";
}
function addbookmark(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}


//Window Onload Manager (WOM) v1.0
// Author: Justin Barlow - www.netlobo.com

function womGo(){
  for(var i = 0;i < woms.length;i++)
    eval(woms[i]);
}

function womAdd(func){
  woms[woms.length] = func;
}
var woms = new Array();

window.onload = function () {
thispage = window.location.href;
if (!thispage.match("smallpedia") && !thispage.match("savetofolder") && !thispage.match("emailtofriend")){
	tooltip.init ();
	
	ieMenu ();
	womGo();
	}
}

