
/* *******************************************************************************************
 *         CSS                                                                               *
 ******************************************************************************************* */

if (location.search.toString().indexOf("template=print") != -1) {
	document.writeln("<link rel=\"STYLESHEET\" type=\"text/css\" href=\"/css/style_imcms_net.css.jsp?template=print\">") ;
} else {
	document.writeln("<link rel=\"STYLESHEET\" type=\"text/css\" href=\"/css/style_imcms_net.css.jsp\">") ;
}

/* *******************************************************************************************
 *         onLoad()                                                                          *
 ******************************************************************************************* */

function doLoad(meta) {
	if (meta != "") setActive(meta) ;
	createPrintPage() ;
}

function setActive(meta) {
	if (document.getElementById) {
		if (document.getElementById("leftImg" + meta)) {
			document.getElementById("leftImg" + meta).src = "/images/gui/dot_blue.gif" ;
		}
	}
}

function setTopMenu(meta) {
	if (document.getElementById) {
		if (meta != "" && document.getElementById("topMenu" + meta)) {
			if (arrTopMenu.length > 0) {
				for (var i = 0; i < arrTopMenu.length; i++) {
					document.getElementById("topMenu" + arrTopMenu[i]).className = "navTop" ;
				}
			}
			document.getElementById("topMenu" + meta).className = "navTopActive" ;
		}
	}
}

function createPrintPage() {
	if (document.getElementById) {
		if (document.getElementById("mainContent") && document.getElementById("printDiv")) {
			var mainContent = document.getElementById("mainContent").innerHTML ;
			document.getElementById("printDiv").innerHTML = "" +
				"<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" +
				"<tr>" +
				"	<td>" + mainContent + "</td>" +
				"</tr>" +
				"</table>" ;
		}
	}
}

/* *******************************************************************************************
 *         Set Cookie                                                                        *
 ******************************************************************************************* */

function setCookie(name, value) {
	var sPath = '/';
	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() + 1000*60*60*24*365); // 365 days
	var sCookieCont = name + "=" + escape(value);
	sCookieCont += (expire == null) ? "" : "\; expires=" + expire.toGMTString();
	sCookieCont += "; path=" + sPath;
	document.cookie = sCookieCont;
}

/* *******************************************************************************************
 *         Get Cookie                                                                        *
 ******************************************************************************************* */

function getCookie(name) {
	var search = name + "=";
	if (document.cookie.length > 0) {
		var offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) {
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(offset, end));
		}
	}
	return null ;
}

/* *******************************************************************************************
 *         Popup                                                                             *
 ******************************************************************************************* */

function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll) {
	if (screen) {
		if ((screen.height - winH) < 150) {
			var winX = (screen.width - winW) / 2;
			var winY = 0;
		} else {
			var winX = (screen.width - winW) / 2;
			var winY = (screen.height - winH) / 2;
		}
		var popWindow = window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		window.open(sUrl,sName,"resizable=yes,menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH);
	}
}

//<A HREF="javascript: popWinOpen(600,560,'/path/file.ext','myWin',0,0)">Linktext</A>

