function showHideSwitch(theid) {
	if (document.getElementById) {
		var switch_id = document.getElementById(theid);
		var imgid = theid + 'Button';
		var button_id = document.getElementById(imgid);
		if (menus_status_array[theid] != 'show') {
			button_id.setAttribute('ImageUrl', img_close);
			switch_id.className = 'showSwitch';
			menus_status_array[theid] = 'show';
			document.cookie = theid + '=show';
			if (theid == "ddSETTINGS") {
				menus_status_array[ddSETTINGS] = 'hide';
				var theid2 = "ddSETTINGS";
				document.cookie = theid2 + '=hide';
			}
			resetMenu();
		} else {
			button_id.setAttribute('ImageUrl', img_open);
			switch_id.className = 'hideSwitch';
			menus_status_array[theid] = 'hide';
			document.cookie = theid + '=hide';
		}
	}
}
function resetMenu() {
	if (document.getElementById) {
		for (var i = 0; i < menus_array.length; i++) {
			var idname = menus_array[i];
			var switch_id = document.getElementById(idname);
			var imgid = idname + 'Button';
			var button_id = document.getElementById(imgid);
			if (getCookie(idname) == 'show') {
				button_id.setAttribute('ImageUrl', img_open);
			} else {
				button_id.setAttribute('ImageUrl', img_close);
			}
		}
	}
}
var childPopupArray = new Array(30);
function fnDbtNonModalWin(strFullWindowName, strWindowTitle, dialogSize) {
	var targetWin = null;
	var CurrentPopUpIndex = 0;
	for (var PopUpCount = 0; PopUpCount < childPopupArray.length - 1; PopUpCount++) {
		if (childPopupArray[PopUpCount] != undefined)
			if (childPopupArray[PopUpCount][0] == strWindowTitle) {
				targetWin = childPopupArray[PopUpCount][1];
				if (targetWin.closed)
					childPopupArray[PopUpCount] = undefined;
				break;
			}
	}
	if (targetWin != null && targetWin.closed)
		targetWin = null;
	if (targetWin == null) {
		targetWin = window.open(strFullWindowName, '', 'height=1000,width=1200,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=yes');
	}
	else {
		targetWin.location = strFullWindowName;
		targetWin.focus();
	}
	for (var ExistingPopUpCount = 0; ExistingPopUpCount < childPopupArray.length - 1; ExistingPopUpCount++) {
		if (childPopupArray[ExistingPopUpCount] != undefined)
			if (childPopupArray[ExistingPopUpCount][0] == strWindowTitle) {
				childPopupArray[ExistingPopUpCount][1] = targetWin;
				CurrentPopUpIndex = ExistingPopUpCount;
				break;
			}
	}
	if (CurrentPopUpIndex == 0) {
		for (var EmptyPopUpCount = 0; EmptyPopUpCount < childPopupArray.length - 1; EmptyPopUpCount++) {
			if (childPopupArray[EmptyPopUpCount] == undefined) {
				childPopupArray[EmptyPopUpCount] = new Array(2);
				childPopupArray[EmptyPopUpCount][0] = strWindowTitle;
				childPopupArray[EmptyPopUpCount][1] = targetWin;
				break;
			}
		}
	}

}
function setScroll(val, posId) {
	posId.value = val.scrollTop;
}
function scrollTo(what, posId) {
	if (what != "0")
		document.getElementById(what).scrollTop = document.getElementById(posId).value;
}
function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1)
		end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}
menus_array = new Array('ddSETTINGS');
menus_status_array = new Array();
img_close = '../../Images/buttonExpand.gif';
img_open = '../../Images/buttonCollapse.gif';
popwindow = null;
function popUp(pageURL, title, w, h) {
	var left = (screen.width / 2) - (w / 2);
	var top = (screen.height / 2) - (h / 2);
	var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}
function popUpReportViewer(pageURL, title, w, h) {
	var left = (screen.width / 2) - (w / 2);
	var top = (screen.height / 2) - (h / 2);
	var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
	targetWin.moveTo(0, 0);
	targetWin.resizeTo(screen.availWidth, screen.availHeight);
}