//var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

function Initialize(pageImage){
	var rightpaneltop = document.getElementById("rightpaneltop");
	if (!rightpaneltop) rightpaneltop = document.getElementById("rightpaneltopHome");
	
	rightpaneltop.style.backgroundImage = "url('" + pageImage + "')";
		
	CreateMenu();
	setNavPointer();
	setHeight();
	
	//pdf box title position adjustment
	var pdftitle = document.getElementById("pdftitle");
	if (pdftitle) pdftitle.style.padding = document.all ? "0 0 1px 9px" : "0 0 2px 9px";
}

function setNavLineHeight() {
	var ln = document.getElementById("navrightline");
	var wrap = document.getElementById("wrap");
		
	ln.style.height = (document.all) ? (parseInt(wrap.style.height) - 258) + "px" : (parseInt(wrap.style.height) - 250) + "px";
}

function setHeight(){
	var content = document.getElementById("content");
	var wrap = document.getElementById("wrap");
	var rightpaneltop = document.getElementById("rightpaneltop");
	if (!rightpaneltop) rightpaneltop = document.getElementById("rightpaneltopHome");
	var pagetitle = document.getElementById("pagetitle");
	var content = document.getElementById("content");
	var	leftpanel = document.getElementById("leftpanel");
	
	var rightPanelHeight = rightpaneltop.offsetHeight + pagetitle.offsetHeight + content.offsetHeight;
	var leftPanelHeight = leftpanel.offsetHeight;
	
	wrap.style.height = (leftPanelHeight > rightPanelHeight) ? leftPanelHeight + 'px' : rightPanelHeight + 'px';
	setNavLineHeight();
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function openWindow(url, name, width, height){
	myWindow = window.open(url, name, "width=" + width + ",height=" + height + ", resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no") ;
}

function openWindowResizable(url, name, width, height){
	myWindow = window.open(url, name, "width=" + width + ",height=" + height + ", resizable=yes,menubar=no,scrollbars=yes,status=no,titlebar=no") ;
}

