// JavaScript Document
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
var preloadFlag = false;
function preloadImages(getPath) {
	if (document.images) {
		tab1_2 = newImage(getPath + "images/tab1_2.gif");
		tab1_3 = newImage(getPath + "images/tab1_3.gif");
		tab1_on = newImage(getPath + "images/tab1_on.gif");
		tab2_1 = newImage(getPath + "images/tab2_1.gif");
		tab2_3 = newImage(getPath + "images/tab2_3.gif");
		tab2_on = newImage(getPath + "images/tab2_on.gif");
		tab3_1 = newImage(getPath + "images/tab3_1.gif");
		tab3_2 = newImage(getPath + "images/tab3_2.gif");
		tab3_on = newImage(getPath + "images/tab3_on.gif");
		
		cookbook_tab1_2 = newImage(getPath + "images/cookbook_tab1_2.gif");
		cookbook_tab1_3 = newImage(getPath + "images/cookbook_tab1_3.gif");
		cookbook_tab1_on = newImage(getPath + "images/cookbook_tab1_on.gif");
		cookbook_tab2_1 = newImage(getPath + "images/cookbook_tab2_1.gif");
		cookbook_tab2_3 = newImage(getPath + "images/cookbook_tab2_3.gif");
		cookbook_tab2_on = newImage(getPath + "images/cookbook_tab2_on.gif");
		cookbook_tab3_1 = newImage(getPath + "images/cookbook_tab3_1.gif");
		cookbook_tab3_2 = newImage(getPath + "images/cookbook_tab3_2.gif");
		cookbook_tab3_on = newImage(getPath + "images/cookbook_tab3_on.gif");
		
		preloadFlag = true;
	}
}

function showMenu(targetId,targetId2,targetId3,imgId,imgId2,imgId3,root){ 
  if (document.getElementById){ 
	var target = document.getElementById(targetId);
	var target2 = document.getElementById(targetId2);
	var target3 = document.getElementById(targetId3);
	var image = document.getElementById(imgId);
	var image2 = document.getElementById(imgId2);
	var image3 = document.getElementById(imgId3);
	//var on = document.getElementById(onStateId);
		if (target.style.display == "none"){ 
			target.style.display = "block";
			target2.style.display = "none";
			target3.style.display = "none";
			image.src = root+"images/"+imgId+"_on.gif";
			
			if( imgId == "tab1"){
				image2.src = root+"images/"+imgId2+"_1.gif";
				image3.src = root+"images/"+imgId3+"_1.gif";
			}else if( imgId == "tab2"){
				image2.src = root+"images/"+imgId2+"_2.gif";
				image3.src = root+"images/"+imgId3+"_2.gif";
			}else if( imgId == "tab3"){
				image2.src = root+"images/"+imgId2+"_3.gif";
				image3.src = root+"images/"+imgId3+"_3.gif";
			}
    	}	 
	}
	//return false; 
}


function showMenu_cooking(targetId,targetId2){ 
  if (document.getElementById){ 
	var target = document.getElementById(targetId);
	var target2 = document.getElementById(targetId2);
	//var target3 = document.getElementById(targetId3);
			target.style.display = "block";
			target2.style.display = "block";
			/*target3.style.backgroundImage = "../images/cookingMemories_bg.jpg";
			target3.style.backgroundRepeat = "repeat-y";*/
	} 
}

function hideMenu_cooking(targetId,targetId2){ 
  if (document.getElementById){ 
	var target = document.getElementById(targetId);
	var target2 = document.getElementById(targetId2);
	//var target3 = document.getElementById(targetId3);
			target.style.display = "none";
			target2.style.display = "none";
			/*target3.style.backgroundImage = "../images/leftShadowBg.gif";
			target3.style.backgroundRepeat = "repeat-y";*/
	} 
}

/*showmenu function for getting started*/
function showMenuV2(targetId){ 
  if (document.getElementById){ 
	var target = document.getElementById(targetId);
			target.style.display = "block";
	} 
}

function hideMenuV2(targetId,targetId2){ 
  if (document.getElementById){ 
	var target = document.getElementById(targetId);
			target.style.display = "none";
	} 
}


function showMenuV3(targetId,targetId2,targetId3,imgId,imgId2,imgId3,tabNo, getPath){ 
	if (document.getElementById){ 
	var target = document.getElementById(targetId);
	var target2 = document.getElementById(targetId2);
	var target3 = document.getElementById(targetId3);
	var image = document.getElementById(imgId);
	var image2 = document.getElementById(imgId2);
	var image3 = document.getElementById(imgId3);
	//var on = document.getElementById(onStateId);
		if (target.style.display == "none"){ 
			target.style.display = "block";
			target2.style.display = "none";
			target3.style.display = "none";
			image.src = getPath + "images/"+imgId+"_on.gif";
			
			if( imgId == "cookbook_tab1"){
				image2.src = getPath + "images/"+imgId2+"_1.gif";
				image3.src = getPath + "images/"+imgId3+"_1.gif";
			}else if( imgId == "cookbook_tab2"){
				image2.src = getPath + "images/"+imgId2+"_2.gif";
				image3.src = getPath + "images/"+imgId3+"_2.gif";
			}else if( imgId == "cookbook_tab3"){
				image2.src = getPath + "images/"+imgId2+"_3.gif";
				image3.src = getPath + "images/"+imgId3+"_3.gif";
			}
    	}
    	if($get("CurrentTab"))	 
    	    $get("CurrentTab").innerHTML = tabNo;
	} 
}

get_element = document.all ?
function (s_id) { return document.all[s_id] } :
function (s_id) { return document.getElementById(s_id) };

function getHeight(name) {    
	var tmpElem = get_element(name);
	if(tmpElem.currentStyle) return tmpElem.offsetHeight;       
	else return parseInt(document.defaultView.getComputedStyle(tmpElem, "").getPropertyValue("height"));   
}

function setHeight(name,name1,name2,name3) {
	var tmpElem = get_element(name);
	var height1 = getHeight(name1);
	var height2 = getHeight(name2);
	var height3 = getHeight(name3);
	
	
    tmpElem.style.height = height1- height2-height3-42+"px";
    
}

function setHeight2(name,name1,name2,name3,name4) {
	var tmpElem = get_element(name);
	var height1 = getHeight(name1);
	var height2 = getHeight(name2);
	var height3 = getHeight(name3);
	var height4 = getHeight(name4);
    
    if (navigator.appVersion.indexOf("MSIE")!=-1){
        if(height2 == 20){
            tmpElem.style.height = height1- height2-height3-height4-15+"px";
        }
        else tmpElem.style.height = height1- height2-height3-height4-34+"px";
    }
    else{
        if(height2 == 20){
            tmpElem.style.height = height1- height2-height3-height4-12+"px";
        }
        else tmpElem.style.height = height1- height2-height3-height4-32+"px";
    }
	
}