//
var offsetfrommouse = [15, 15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
//var displayduration=0; //duration in seconds image should remain visible. 0 for always.
var defaultDivHeight = 40;	// maximum image size.
var defaultDivWidth = 40;	// maximum image size.
var iframeHeight = "";

//var timer;
var hiddenID = "";
var onMouseOver = false;
/* DETECT BROWSER */
var bIsIE = false;
function checkIsIE() {
	try {
		if (navigator.userAgent.toUpperCase().indexOf("MSIE") >= 0) {
			bIsIE = true;
			return bIsIE;
		}
	}
	catch (e) {
		return bIsIE;
	}
	return bIsIE;
}
function checkBrw() {
	var agt = navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1) {
		return "Opera";
	}
	if (agt.indexOf("staroffice") != -1) {
		return "Star Office";
	}
	if (agt.indexOf("webtv") != -1) {
		return "WebTV";
	}
	if (agt.indexOf("beonex") != -1) {
		return "Beonex";
	}
	if (agt.indexOf("chimera") != -1) {
		return "Chimera";
	}
	if (agt.indexOf("netpositive") != -1) {
		return "NetPositive";
	}
	if (agt.indexOf("phoenix") != -1) {
		return "Phoenix";
	}
	if (agt.indexOf("firefox") != -1) {
		return "Firefox";
	}
	if (agt.indexOf("safari") != -1) {
		return "Safari";
	}
	if (agt.indexOf("skipstone") != -1) {
		return "SkipStone";
	}
	if (agt.indexOf("msie") != -1) {
		return "Internet Explorer";
	}
	if (agt.indexOf("netscape") != -1) {
		return "Netscape";
	}
	if (agt.indexOf("mozilla/5.0") != -1) {
		return "Mozilla";
	}
	if (agt.indexOf("/") != -1) {
		if (agt.substr(0, agt.indexOf("/")) != "mozilla") {
			return navigator.userAgent.substr(0, agt.indexOf("/"));
		} else {
			return "Netscape";
		}
	} else {
		if (agt.indexOf(" ") != -1) {
			return navigator.userAgent.substr(0, agt.indexOf(" "));
		} else {
			return navigator.userAgent;
		}
	}
}
function gettrailobj() {
	if (document.getElementById) {
		return document.getElementById(hiddenID).style;
	}
}
function gettrailobjnostyle() {
	if (document.getElementById) {
		return document.getElementById(hiddenID);
	}
}
function truebody() {
	if (checkBrw() == "Safari") {
		return document.body;
	} else {
		return document.documentElement;
	}
}
/*function truebody(){
return (!window.opera && document.compatMode && window.safari &&  document.compatMode!="BackCompat")? document.documentElement : document.body
}*/
function hidePopup() {
	if ((parent.document.getElementById("mask")) || (parent.document.getElementById("mask").style.display == "") || (parent.document.getElementById("mask").style.display == "block")) {
		maskWindow("closeIframe");
	}
	if ((document.getElementById("mask")) || (document.getElementById("mask").style.display == "") || (document.getElementById("mask").style.display == "block")) {
		maskWindow("closeDiv");
	}
	gettrailobj().display = "none";
	document.onmousemove = "";
	gettrailobj().left = "-500px";
	hiddenID = "";
}
function hidePopupexpandCollapse() {
	if (hiddenID != "") {
		gettrailobj().display = "none";
		document.onmousemove = "";
		gettrailobj().left = "-500px";
		hiddenID = "";
	}
}
/*function hideIframe(){
	parent.gettrailobj().display= "none";
	document.onmousemove=""
	parent.gettrailobj().left="-500px"
	hiddenID = "";
	iframeHeight = "";
	}*/
function openPopup(id, width, e, onMouseOver) {
	maskWindow("open");
	if (width >= 600) {
		offsetfrommouse = [-200, 15];
	} else {
		offsetfrommouse = [15, 15];
	}
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		width += 0;
		if (hiddenID != "") {
			document.getElementById(hiddenID).style.display = "none";
		}
		hiddenID = id;
		gettrailobj().display = "block";
		gettrailobjnostyle().style.width = width + "px";
		height = gettrailobjnostyle().offsetHeight;
		defaultDivHeight = height;
		defaultDivWidth = width;
		if (onMouseOver == true) {
			document.onmousemove = followmouse;
		} else {
			if (checkBrw() == "Internet Explorer") {
				followmouse();
			} else {
				followmouse(e);
			}
		}
	}
}
function openPopupSub(id, width, e, onMouseOver, sub) {
	var frmObj = document.frmRegistration;
	frmObj.subvalue.value = sub;
	document.getElementById("subjectval").innerHTML = sub;
    //alert(frmObj.subvalue.value);
	if (width >= 600) {
		offsetfrommouse = [-200, 15];
	} else {
		offsetfrommouse = [15, 15];
	}
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		width += 0;
		if (hiddenID != "") {
			document.getElementById(hiddenID).style.display = "none";
		}
		hiddenID = id;
		gettrailobj().display = "block";
		gettrailobjnostyle().style.width = width + "px";
		height = gettrailobjnostyle().offsetHeight;
		defaultDivHeight = height;
		defaultDivWidth = width;
		if (onMouseOver == true) {
			document.onmousemove = followmouse;
		} else {
			if (checkBrw() == "Internet Explorer") {
				followmouse();
			} else {
				followmouse(e);
			}
		}
	}
}
function openPopupLabelTime(id, width, e, onMouseOver, sub) {
    //var frmObj = document.frmRegistration;
    //alert(sub);
    //frmObj.subvalue.value = sub;
	document.getElementById("itemval").innerHTML = sub;
    //alert(frmObj.subvalue.value);
	if (width >= 600) {
		offsetfrommouse = [-200, 15];
	} else {
		offsetfrommouse = [15, 15];
	}
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		width += 0;
		if (hiddenID != "") {
			document.getElementById(hiddenID).style.display = "none";
		}
		hiddenID = id;
		gettrailobj().display = "block";
		gettrailobjnostyle().style.width = width + "px";
		height = gettrailobjnostyle().offsetHeight;
		defaultDivHeight = height;
		defaultDivWidth = width;
		if (onMouseOver == true) {
			document.onmousemove = followmouse;
		} else {
			if (checkBrw() == "Internet Explorer") {
				followmouse();
			} else {
				followmouse(e);
			}
		}
	}
}
/*For Iframe*/
function validi() {
	document.getElementById("validateLan").style.display = "";
}
function refreshIframe() {
	window.location.reload(true);
}
function getIframeHeight(iFrameID) {
	if (document.getElementById && !(document.all)) {
	//alert('FireFox');
		iframeHeight = document.getElementById(iFrameID).contentDocument.body.scrollHeight;
	} else {
		if (document.all) {
	//alert('IE');
			iframeHeight = document.frames(iFrameID).document.body.scrollHeight;
		}
	}
	document.getElementById(iFrameID).style.height = iframeHeight + "px";
	return iframeHeight;
}
function hideIframe(errorMessID, ifrmID, chk) {
	if (parent.document.getElementById("mask")) {
		maskWindow("closeIframe");
	}
	var errorMes = document.getElementById(errorMessID);
	if ((chk == "showError") && (errorMes.style.display != "none")) {
		var orgheight = errorMes.offsetHeight;
	//alert(parseInt(orgheight) + parseInt(parent.document.getElementById('ifrmHt').value));
		parent.gettrailobj().height = parseInt(orgheight) + parseInt(parent.document.getElementById("ifrmHt").value) + "px";
		parent.document.getElementById(ifrmID).style.height = parseInt(orgheight) + parseInt(parent.document.getElementById("ifrmHt").value) + "px";
	} else {
		parent.gettrailobj().display = "none";
		document.onmousemove = "";
		parent.gettrailobj().left = "-10000px";
		hiddenID = "";
		iframeHeight = "";
	}
	return true;
}
function doIt(iFrameID) {
//	alert(iFrameID)
	gettrailobj().display = "block";
	getIframeHeight(iFrameID);
}
function openIframeSession(id, iFrameID, width, e, refreshIfrm, url) {

	//if(hiddenID != ""){
		//if(document.getElementById("viewCalendar")){
		//activateTab();
		//}
		//document.getElementById(hiddenID).style.display="none";
		//}
	if (refreshIfrm == "refreshIfrm") {
		var ifrm = document.getElementById(iFrameID);
		ifrm.src = url;
	}
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		width += 0;
		if (hiddenID != "") {
			document.getElementById(hiddenID).style.display = "none";
		}
		hiddenID = id;
		gettrailobj().display = "block";
		//alert(getIframeHeight(iFrameID));
		//alert("getIframeHeight = "+getIframeHeight(iFrameID));	
		document.getElementById("ifrmHt").value = getIframeHeight(iFrameID);
		gettrailobjnostyle().style.width = width + "px";
		height = iframeHeight;
		if (hiddenID != "") {
			if (document.getElementById("viewCalendar")) {
				activateTab();
			}
			document.getElementById(hiddenID).style.display = "none";
		}
		if (refreshIfrm == "refreshIfrm") {
			var ifrm = document.getElementById(iFrameID);
			ifrm.src = url;
		}
		defaultDivHeight = height;
		defaultDivWidth = width;
		if (checkBrw() == "Internet Explorer") {
			followmouse();
		} else {
			followmouse(e);
		}
		setTimeout("doIt('" + iFrameID + "')", 500);
	}
}
function openIframeCalendar(id, iFrameID, width, e, url, listingid) {
	maskWindow("open");
	var ifrm = document.getElementById(iFrameID);
	ifrm.src = url;
	if (hiddenID != "") {
		activateTab(listingid);
		document.getElementById(hiddenID).style.display = "none";
	}
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		if (hiddenID != "") {
			document.getElementById(hiddenID).style.display = "none";
		}
		hiddenID = id;
		gettrailobj().display = "block";
		gettrailobjnostyle().style.width = width + "px";
		height = 491;
		defaultDivHeight = height;
		defaultDivWidth = width;
		//height = 491 + "px";
		//alert(height)
		if (checkBrw() == "Internet Explorer") {
			followmouse();
		} else {
			followmouse(e);
		}
	}
	findDivPos(id);
	defaultDivPosLt = defaultDivPosLt + "";
	if (((defaultDivPosLt).charAt(0)) == "-") {
		gettrailobjnostyle().style.left = 210 + "px";
	}
}
function followmouse(e) {
	var xcoord = offsetfrommouse[0];
	var ycoord = offsetfrommouse[1];
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - 15;
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if (typeof e != "undefined") {
		if (docwidth - e.pageX < defaultDivWidth + 2 * offsetfrommouse[0]) {
			xcoord = e.pageX - xcoord - defaultDivWidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultDivHeight + 2 * offsetfrommouse[1]) {
			ycoord += e.pageY - Math.max(0, (2 * offsetfrommouse[1] + defaultDivHeight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}
	} else {
		if (typeof window.event != "undefined") {
			if (docwidth - event.clientX < defaultDivWidth + 2 * offsetfrommouse[0]) {
				xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultDivWidth; // Move to the left side of the cursor
			} else {
				xcoord += truebody().scrollLeft + event.clientX;
			}
			if (docheight - event.clientY < (defaultDivHeight + 2 * offsetfrommouse[1])) {
				ycoord += event.clientY + truebody().scrollTop - Math.max(0, (2 * offsetfrommouse[1] + defaultDivHeight + event.clientY - docheight));
			} else {
				ycoord += truebody().scrollTop + event.clientY;
			}
		}
	}
	gettrailobj().left = xcoord + "px";
	gettrailobj().top = ycoord + "px";
}
function hidePopupexpandCollapse() {
	if (hiddenID != "") {
		gettrailobj().display = "none";
		document.onmousemove = "";
		gettrailobj().left = "-500px";
		hiddenID = "";
	}
}
function openIframe(id, iFrameID, width, e, refreshIfrm, url) {



 //if(hiddenID != ""){
  //if(document.getElementById("viewCalendar")){
  //activateTab();
  //}
  //document.getElementById(hiddenID).style.display="none";
  //}
	if (refreshIfrm == "refreshIfrm") {
		var ifrm = document.getElementById(iFrameID);
		ifrm.src = url;
	}
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		width += 0;
		if (hiddenID != "") {
			document.getElementById(hiddenID).style.display = "none";
		}
		hiddenID = id;
		gettrailobj().display = "block";
  //alert(getIframeHeight(iFrameID));
  //alert("getIframeHeight = "+getIframeHeight(iFrameID)); 
		document.getElementById("ifrmHt").value = getIframeHeight(iFrameID);
		gettrailobjnostyle().style.width = width + "px";
		height = iframeHeight;
		if (hiddenID != "") {
			if (document.getElementById("viewCalendar")) {
				activateTab();
			}
			document.getElementById(hiddenID).style.display = "none";
		}
		if (refreshIfrm == "refreshIfrm") {
			var ifrm = document.getElementById(iFrameID);
			ifrm.src = url;
		}
		defaultDivHeight = height;
		defaultDivWidth = width;
		if (checkBrw() == "Internet Explorer") {
			followmouse();
		} else {
			followmouse(e);
		}
		setTimeout("doIt('" + iFrameID + "')", 500);
	}
}
function openModifyIframe(id, iFrameID, width, e, refreshIfrm, url) {
	maskWindow("open");


 //if(hiddenID != ""){
  //if(document.getElementById("viewCalendar")){
  //activateTab();
  //}
  //document.getElementById(hiddenID).style.display="none";
  //}
	if (refreshIfrm == "refreshIfrm") {
		var ifrm = document.getElementById(iFrameID);
		ifrm.src = url;
	}
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		width += 0;
		if (hiddenID != "") {
			document.getElementById(hiddenID).style.display = "none";
		}
		hiddenID = id;
		gettrailobj().display = "block";
  //alert(getIframeHeight(iFrameID));
  //alert("getIframeHeight = "+getIframeHeight(iFrameID)); 
		document.getElementById("ifrmHt").value = getIframeHeight(iFrameID);
		gettrailobjnostyle().style.width = width + "px";
		height = iframeHeight;
		defaultDivHeight = height;
		defaultDivWidth = width;
		if (checkBrw() == "Internet Explorer") {
			followmouse();
		} else {
			followmouse(e);
		}
  //setTimeout("doIt('"+iFrameID+"')",500);
	}
}
var px = -1, py = -1, cx = -1, cy = -1;
function openHiddenIframe(id, iFrameID, width, e, refreshIfrm, url) {
	maskWindow("open");
	if (checkBrw() == "Internet Explorer") {
		px = -1;
		py = -1;
		if (typeof window.event != "undefined") {
			cx = window.event.clientX;
			cy = window.event.clientY;
		}
	} else {
		px = e.pageX;
		py = e.pageY;
		cx = -1;
		cy = -1;
	}
		//alert("px:"+px+" py:"+py+" cx:"+cx+" cy:"+cy);
	if (hiddenID != "") {
		document.getElementById(hiddenID).style.display = "none";
	}
	if (refreshIfrm == "refreshIfrm") {
		var ifrm = document.getElementById(iFrameID);
		ifrm.src = url + "&browserTime=" + escape(new Date());
	}
	mainDivID = id;
	ifrmID = iFrameID;
	//assignIdGlbVar();
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		hiddenID = id;
		gettrailobj().display = "block";
		gettrailobjnostyle().style.width = width + "px";
	}
}

function openHiddenIframeReq(id, iFrameID, width, e, refreshIfrm, url) {
	maskWindow("open");
	if (hiddenID != "") {
		document.getElementById(hiddenID).style.display = "none";
	}
	if (refreshIfrm == "refreshIfrm") {
		var ifrm = document.getElementById(iFrameID);
		ifrm.src = url + "&browserTime=" + escape(new Date());
	}
	mainDivID = id;
	ifrmID = iFrameID;
	//assignIdGlbVar();
	var height = document.getElementById(id).offsetHeight;
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - offsetfrommouse[0];
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if ((navigator.userAgent.indexOf("Konqueror") == -1 || navigator.userAgent.indexOf("Firefox") != -1 || (navigator.userAgent.indexOf("Opera") == -1 && navigator.appVersion.indexOf("MSIE") != -1)) && (docwidth > 650 && docheight > 500)) {
		(width == 0) ? width = defaultDivWidth : "";
		hiddenID = id;
		gettrailobj().display = "block";
		gettrailobj().left = "200px";
		gettrailobj().right = "200px";
		gettrailobjnostyle().style.width = width + "px";
	}
}

function openSecondlevelIframe(iFrameID, url) {
	parent.document.getElementById(iFrameID).src = url;
}
function openSecondLevelPopup(iframeId,widt,url){
	var ifrmId = parent.document.getElementById(iframeId);	
	ifrmId.src = url;	
	ifrmId.style.width = widt + "px";
	parent.document.getElementById(ifrmId.parentNode.id).style.width = ifrmId.style.width;
	}

/* For Iframe */
var mainDivID = "";
var ifrmID = "";
function assignIdGlbVar() {
	document.getElementById("mainDivIDHt").value = mainDivID;
	document.getElementById("ifrmIDHt").value = ifrmID;
}
function setIfrmDivHt(ifrmId, mainDiv) {
	try {
		var ifmWrapper = document.getElementById(ifrmId);
		var mainContentDiv = document.getElementById(mainDiv);
		if (mainContentDiv) {
			if (!window.XMLHttpRequest) {
				mainContentDiv.style.width = (ifmWrapper.offsetWidth - 22) + "px";
			}
			if (ifmWrapper.offsetHeight >= 470) {
				if(mainContentDiv.offsetHeight > 450 || mainContentDiv.offsetHeight < 0) {
					mainContentDiv.style.height = 450 + "px";
				} else {
					mainContentDiv.style.height = mainContentDiv.offsetHeight + "px";
				}
			}
		}
		var ifmWrapperHt = ifmWrapper.offsetHeight;
		window.top.resizeParentElem(window.top.mainDivID, window.top.ifrmID, ifmWrapperHt);
	}
	catch (e) {
	}
}
function resizeParentElem(id, ifmHt, divHt) {
	hiddenId = id;
	var divId = document.getElementById(id);
	divId.style.height = divHt + "px";
	var ifrm = document.getElementById(ifmHt);
	ifrm.style.height = divHt + "px";
	defaultDivHeight = divId.offsetHeight;
	defaultDivWidth = divId.offsetWidth;
	//alert(defaultDivWidth);
	//document.getElementById('ifrmHt').value = divId.offsetHeight;
	followMouseIframe(px, py, cx, cy);
	findDivPos(id);
	defaultDivPosLt = defaultDivPosLt + "";
	if (((defaultDivPosLt).charAt(0)) == "-") {
		divId.style.left = 210 + "px";
	}
}
var defaultDivPosLt = "";
function findDivPos(id) {
	id = parent.document.getElementById(id);
	var curleft = curtop = 0;
	if (id.offsetParent) {
		curleft += id.offsetLeft;
		curtop += id.offsetTop;
	}
	while (id = id.offsetParent) {
	}
	defaultDivPosLt = curleft;
	 //defaultDivPosRt = curtop;
	return [curleft, curtop];
}
function followMouseIframe(pageX, pageY, clientX, clientY) {
	var xcoord = offsetfrommouse[0];
	var ycoord = offsetfrommouse[1];
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth : pageXOffset + window.innerWidth - 15;
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);
	if (pageX > -1) {
		if (docwidth - pageX < defaultDivWidth + 2 * offsetfrommouse[0]) {
			xcoord = pageX - xcoord - defaultDivWidth; // Move to the left side of the cursor
		} else {
			xcoord += pageX;
		}
		if (docheight - pageY < defaultDivHeight + 2 * offsetfrommouse[1]) {
			ycoord += pageY - Math.max(0, (2 * offsetfrommouse[1] + defaultDivHeight + pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += pageY;
		}
	} else {
		if (docwidth - cx < defaultDivWidth + 2 * offsetfrommouse[0]) {
			xcoord = cx + truebody().scrollLeft - xcoord - defaultDivWidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft + cx;
		}
		if (docheight - cy < (defaultDivHeight + 2 * offsetfrommouse[1])) {
			ycoord += cy + truebody().scrollTop - Math.max(0, (2 * offsetfrommouse[1] + defaultDivHeight + cy - docheight));
		} else {
			ycoord += truebody().scrollTop + cy;
		}
	}
	//alert(offsetfrommouse)
	gettrailobj().left = xcoord + "px";
	gettrailobj().top = ycoord + "px";
}
function maskWindow(flag) {
	var windowHeight = "";
	var bodyHeight = document.getElementsByTagName("body")[0].offsetHeight;
	var finalHeight = "";
	var maskDiv = document.getElementById("mask");
	if (!document.all) {
		windowHeight = window.innerHeight;
	} else {
		windowHeight = document.documentElement.clientHeight;
	}
	if (flag == "open") {
		//var wrapperHeight = document.getElementById("wrapper").offsetHeight;
		var wrapperHeight = "";
		if (document.getElementById("wrapper")) {
			wrapperHeight = document.getElementById("wrapper").offsetHeight;
		} else {
			if (document.getElementById("homeWrapper")) {//homeWrapper only for  home page
				wrapperHeight = document.getElementById("homeWrapper").offsetHeight;
			}
		}
		maskDiv.style.display = "block";
		if (bodyHeight >= windowHeight) {
			finalHeight = bodyHeight;
			maskDiv.style.height = finalHeight + "px";
		} else {
			finalHeight = windowHeight;
			maskDiv.style.height = finalHeight + "px";
		}
	} else {
		if (flag == "closeIframe") {
		//parent.maskDiv.style.display = 'none';
			parent.document.getElementById("mask").style.display = "none";
		} else {
			if (flag == "closeDiv") {
				maskDiv.style.display = "none";
			}
		}
	}
}
function remove(element) {
	if (element) {
		element.parentNode.removeChild(element);
	}
}
/****************  Function for Help  and Next step popup START here ********************************/
function openHelpInfoIfrm(id, iFrameID, width, e, url) {
	if (hiddenID != "") {
		document.getElementById(hiddenID).style.display = "none";
	}
	var ifrm = document.getElementById(iFrameID);
	ifrm.src = url;
	maskWindow("open");
	mainDivID = id;
	ifrmID = iFrameID;
	hiddenID = id;
	gettrailobj().display = "block";
	gettrailobjnostyle().style.width = width + "px";
}
function setHelpInfoIfrmHt(ifrmId, mainDiv) {
	var ifmWrapper = document.getElementById(ifrmId);
	var mainContentDiv = document.getElementById(mainDiv);
	if (mainContentDiv) {
		if (!window.XMLHttpRequest) {
			mainContentDiv.style.width = (ifmWrapper.offsetWidth - 22) + "px";
		}
		if (mainContentDiv.offsetHeight >= 200) {
			mainContentDiv.style.height = 200 + "px";
		}
	}
	var ifmWrapperHt = ifmWrapper.offsetHeight;
	window.top.resizeHelpInfo(window.top.mainDivID, window.top.ifrmID, ifmWrapperHt);
}
function findEleLeft(objId) {
	var obj = document.getElementById(objId);
	var iLeft = 0;
	while (obj.tagName != "BODY") {
		iLeft += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return iLeft;
}
function findEleTop(objId) {
	var obj = document.getElementById(objId);
	var iTop = 0;
	while (obj.tagName != "BODY") {
		iTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return iTop;
}
function resizeHelpInfo(id, ifmHt, divHt) {
	hiddenId = id;
	try {
		var logoContainer = document.getElementById("logoContainer");
		var divId = document.getElementById(id);
		divId.style.height = divHt + "px";
		var ifrm = document.getElementById(ifmHt);
		ifrm.style.height = divHt + "px";
		document.getElementById("ifrmHt").value = divId.offsetHeight;
		divId.style.top = logoContainer.offsetHeight - 15 + "px";
		divId.style.left = findEleLeft("logoContainer") + "px";
	}
	catch (e) {
	}
}
function setHtWdt() {
	var helpIfrm = top.document.getElementById("helpIfrm");
	var helpDiv = top.document.getElementById("helpDiv");
	if (top.helpDivWt != "") {
		helpDiv.style.width = top.helpDivWt + "px";
		helpIfrm.style.width = top.helpDivWt + "px";
	}
	if (top.helpDivHt != "") {
		helpDiv.style.height = top.helpDivHt + "px";
		helpIfrm.style.height = top.helpDivHt + "px";
	}
}
var helpDivWt = "";
var helpDivHt = "";
var helpScroller = "";
var restoreHelp = true;
function minMaxHelp(obj) {
	var obj = document.images[obj.id];
	var windowHeight = "";
	if (!document.all) {
		windowHeight = parent.window.innerHeight;
	} else {
		windowHeight = parent.document.documentElement.clientHeight;
	}
	var divId = document.getElementById("ifmWrapper");
	var helpIfrm = top.document.getElementById("helpIfrm");
	var helpInfoScroller = document.getElementById("helpInfoScroller");
	var helpDiv = top.document.getElementById("helpDiv");
	//var restoreHelp = (helpDiv.style.height == '') ? 0 :1;
	if (restoreHelp) {
		top.helpDivWt = helpIfrm.offsetWidth;
		top.helpDivHt = helpIfrm.offsetHeight;
		top.helpScroller = helpInfoScroller.offsetHeight;
		helpDiv.style.height = "";
		helpDiv.style.width = "";
		obj.src = "Images/Icon_RestoreDown.png";
		obj.alt = "Restore Down";
		obj.title = "Restore Down";
		helpIfrm.style.width = parent.document.getElementById("wrapper").offsetWidth + "px";
		helpInfoScroller.style.height = windowHeight - findDivPos("helpDiv")[0] - 127 + "px"; //127 for header and footer and rounded corners
		helpIfrm.style.height = document.getElementById("ifmWrapper").offsetHeight + "px";
		restoreHelp = false;
	} else {
		obj.src = "Images/Icon_Maximize.png";
		obj.alt = "Maximize";
		obj.title = "Maximize";
		helpIfrm.style.width = top.helpDivWt + "px";
		helpInfoScroller.style.height = top.helpScroller + "px";
		helpIfrm.style.height = top.helpDivHt + "px";
		restoreHelp = true;
	}
}
/****************  Function for Help  and Next step popup END here ********************************/
/********** Student Profile Created Pop up display: Start**********/
function getScrollHt() {
	var scrollHt;
	if (document.all) {
		scrollHt = document.documentElement.scrollTop;
	} else {
		scrollHt = window.pageYOffset;
	}
	return scrollHt;
}
function openDivPopup(divId, divW) {
	var windowHeight = "";
	var windowWidth = "";
	if (!document.all) {
		windowHeight = window.innerHeight;
		windowWidth = window.innerWidth;
	} else {
		windowHeight = document.documentElement.clientHeight;
		windowWidth = document.documentElement.clientWidth;
	}
	maskWindow("open");
	var divEle = document.getElementById(divId);
	divEle.style.display = "";
	divEle.style.width = divW + "px";
	var wrapper = document.getElementById("mask");
	divEle.style.top = getScrollHt() + (windowHeight - divEle.offsetHeight) / 2 + "px";
	divEle.style.left = (windowWidth - divEle.offsetWidth) / 2 + "px";
}
function hideDivPopup(divId) {
	maskWindow("closeDiv");
	var divEle = document.getElementById(divId);
	divEle.style.display = "none";
	divEle.style.width = "";
	divEle.style.left = "-100%";
}
/********** Student Profile Created Pop up display: End**********/