function getAvailHeight() {
	screenx = screen.width; 
	screeny = screen.height;
	if (document.getElementById && !document.all) {
		height = window.innerHeight;
	} else if (document.all) {
		//height = window.screen.availHeight;
		height = document.body.offsetHeight;
	}
	return height;
}

function getElHeight(el) {
	return getHeight(el.id);
}

function getHeight(el) {
	try {
	el = document.getElementById(el);
	if (document.all) {
		return el.clientHeight;
	} else {
		return el.offsetHeight;
	}
	} catch (ex) {
	}
}

function setHeight() {

	try {
	
	h = Math.round(getAvailHeight() * 0.95);
	//h = h - getHeight("logorow") - getHeight("navrow") - getHeight("copyrightrow");
    h = h - getHeight("logorow") - getHeight("navrow") - 50;
	
	if (getAvailHeight() < 585) {
		h = Math.round(getAvailHeight());
		h = h - getHeight("logorow") - getHeight("navrow");
	}
	
	
	if (h > 625) h = 625;
	//if (h < 400) h = 400;
	
	if (fixed_h>0) h = fixed_h;
	
	old_h = oppreadCookie("crh");

	if (h>0) {
		document.getElementById("bodycontainer").style.height = h + "px";	
		document.getElementById("bodycontainer").height = h;
		oppcreateCookie("crh", h);
	}
	
	//set content frame height
	if (document.getElementById("viewphoto")) {
		var contentRowHeight = getHeight('bodycontainer');
		contentRowHeight = contentRowHeight - 80;		

		if (h>0 && !document.body.getElements) {
			document.getElementById("viewphoto").style.height = contentRowHeight+"px";
		} else {
			old_h = old_h - 80;
			document.getElementById("viewphoto").style.height = old_h+"px";	
		}
		document.getElementById("viewphoto").style.display = "block";
	}
	
	if (safarim==1) {
		document.getElementById("viewphoto").style.height = "";
	}
	
	//get right side image
	if (document.getElementById("sideimage")) {
		var contentRowHeight = getHeight('bodycontainer');
		if (safarim==1) contentRowHeight = 460;
		if (document.getElementById("sideimage").src.length < 5 ) {
			//document.getElementById("sideimage").src = "http://www.onlinepictureproof.com/imageresize2.php?h="+contentRowHeight+"&n="+sideimgsrc;
			document.getElementById("sideimage").src = "http://www.onlinepictureproof.com/imgsrv/"+contentRowHeight+"/"+sideimgsrc;
			document.getElementById("sideimage").style.display = "";
		}
	}
	
	if (h>0 && !document.body.getElements) saveCookie();
	
	if (getHeight("logorow")>getHeight("headertable")) { 
		document.getElementById("logorow").style.height="auto"; 
		document.getElementById("logorow").height="";
		document.getElementById("copyrightrow").style.height="auto"; 
		document.getElementById("copyrightrow").height="";
		oppcreateCookie("lrh","0");
		oppcreateCookie("frh","0");
	}
	
	} catch (ex) {
	}
	
}

function saveCookie() {
	oppcreateCookie("ts", sitename);
	oppcreateCookie("lrh", getHeight("logorow"));
	oppcreateCookie("nrh", getHeight("navrow"));
	oppcreateCookie("frh", getHeight("copyrightrow"));
	oppcreateCookie("trh", getHeight("content_table"));
	heights = getHeight("logorow") + " " + getHeight("navrow") + " " + getHeight("copyrightrow") + " " + getHeight("content_table"); 
}

function resetCookie() {
	oppcreateCookie("ts", "");
	oppcreateCookie("crh","0");
	oppcreateCookie("lrh","0");
	oppcreateCookie("nrh","0");
	oppcreateCookie("frh","0");
	oppcreateCookie("trh","0");
}

currSite = oppreadCookie("ts");
if (currSite != sitename) resetCookie();