function getDimensions() {
if (document.all) {document.body.scroll='auto';}
var theheight = document.getElementById("pagebody").clientHeight;
var thewidth = document.getElementById("pagebody").clientWidth;
document.getElementById("wrapped").style.height = theheight + "px";
document.getElementById("wrapped").style.width = thewidth + "px";
var closeOverlayHeight = theheight - 2;
var closeOverlayWidth = thewidth - 2;
var overlayTop = (closeOverlayHeight - 400) / 2;
var overlayLeft = (closeOverlayWidth - 600) / 2;
if (overlayTop < 20) {
overlayTop = 50;
}
if (document.getElementById("closeoverlay")) {
document.getElementById("closeoverlay").style.height = closeOverlayHeight + "px";
document.getElementById("closeoverlay").style.width = closeOverlayWidth + "px";
document.getElementById("overlay").style.top = overlayTop + "px";
document.getElementById("overlay").style.left = overlayLeft + "px";
}
if (document.all) {document.body.scroll='auto';}
}





/* Overlay Funcs */
function updateOverlayTitle(thetitle) {
document.getElementById("overlay-title").innerHTML = thetitle;
}

function updateOverlayIframe(theurl,theheight) {
if (theheight) {} else {theheight = 400;}
document.getElementById("overlay-content").innerHTML = '<iframe style="width:100%;height:' + theheight + 'px;" src="' + theurl + '" frameborder="0"></iframe>';
}


function openPop() {
displayItem("closeoverlay");
displayItem("overlay");
}

function closePopConfirm() {
if (confirm("Would you like to close the overlay window?")) {
closePop();
document.getElementById("overlay-contents").innerHTML = "";
}
}

function closePop() {
hideItem("closeoverlay");
hideItem("overlay");
}



/* initial */
if (document.all) {
document.write("<style>#page{width:780px;}#heading{padding-bottom:0px;}.navbar{height:23px; margin-top:-3px;}#footer {margin-bottom:-3px;}.content{padding-top:6px;}.for-theoverflow {border-width:0px; border-style:none;}.lft-overflow {border-left:1px solid #737373; border-right:1px solid #737373;}.fgi {border-color:#D8D8D8;}</style>");
} 
var startleft = (screen.width - 780) / 2;
if (startleft < 30) startleft = 0;
var startpopup = startleft + 36;
document.write("<style>#popup {padding-left:" + startpopup + "px;}</style>");

var tasksHeight = 120;
var sessionHeight = 85;
if (screen.height < 610) {
} else if (screen.height < 770) {
tasksHeight = 202;
sessionHeight = 135;
} else if (screen.height < 870) {
tasksHeight = 260;
sessionHeight = 173;
} else if (screen.height > 870) {
tasksHeight = 356;
sessionHeight = 237;
} 
document.write('<style>#left-tasks {height:' + tasksHeight + ';} #left-sessions {height:' + sessionHeight + ';}</style>');







//This function callMyAction calls the 
//action URI passed.
//Close the popup if it is popup and closePopup is true
//Reload the parent window. If it is true
//param types: callMyAction(string,string,boolean,boolean);
function callMyAction(actionURI,formId,closePopup,reloadParent){
document.getElementById(formId).action=actionURI;
document.getElementById(formId).method='POST';
document.getElementById(formId).submit();
if(closePopup==true && reloadParent==false){
	window.self.close();
}
if(closePopup==true && reloadParent==true){
	window.opener.location.reload();
	window.self.close();
}
}

//This function displayItem displays the
//item based on id of item.
//param types: displayItem(string);
function displayItem(theid) {
var theidn = document.getElementById(theid);
theidn.style.display = "";
}

//This function hideItem hides the
//item based on id of item.
//param types: hideItem(string);
function hideItem(theid) {
var theidn = document.getElementById(theid);
theidn.style.display = "none";
}

//This function opens a popup window.
//based on url passed.
function smallWinLink(url,width,height) {
win=window.open(url,"smallwin","width=" + width + ",height=" + height + ",scrollbars,resizable,left=10,top=10");
}
//This function trim leading & trailing
//from the string passed.
//param types: trim(string);
function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}

//This function saves/update session description
function saveOrUpdataeDescr(uri,frm,bol1,bol2){
if(trim(document.getElementById('sessionDescription').value)==""){
	alert('Session description can not be empty.');
	document.getElementById('sessionDescription').focus();
	return;
}else{
	callMyAction(uri,frm,bol1,bol2);
}
}
//This function updates withdrwa paper by author.
function withdrawByAuth(uri,frm,bol1,bol2){
var conf = confirm('Are you sure you want to withdraw this paper?');
if(conf==true){
	callMyAction(uri,frm,bol1,bol2);
}else if(conf==false) {
	return;
}
}
//This funtions may need to update -------------

function navbarBtn(theitem,theaction) {
var tabon = document.getElementById('tab-' + theitem + '-on');
var taboff = document.getElementById('tab-' + theitem + '-off');
if (theaction == 1) {
tabon.style.display = "inline";
taboff.style.display = "none";
} else {
tabon.style.display = "none";
taboff.style.display = "inline";
}
}

function logout() {
alert('To log out: Go to "File" then choose "Exit."  This will close your browser, which will also log you out of the system.');
}

function moveBtnOn(imgSrc,imgName,t) {
imgSrc = "/images/buttons/" + imgSrc + "_on.gif";
if (t) {
imgName.src=imgSrc;
} else {
document[imgName].src=imgSrc;
}
}
function moveBtnOff(imgSrc,imgName,t) {
imgSrc = "/images/buttons/" + imgSrc + ".gif";
if (t) {
imgName.src=imgSrc;
} else {
document[imgName].src=imgSrc;
}
}

function managePopupDisplay(turnon) {
var thepage = document.getElementById("page");
var thepop = document.getElementById("popup");
if (turnon) {
thepage.className="trans-page";
thepop.style.display = "";
} else {
thepage.className="";
thepop.style.display = "none";
}
}



//GENERIC VALIDATION CODE - move to another file
	var errorMessages = new Array(0);
	var validateForm;
	var initLength = errorMessages.length;
	_valid = false;

    function clearMessage(){
		errorMessages = new Array(0);
		msgElement = document.getElementById('messages');
		msgElement.innerHTML = "";
		//msgElement = $('messages');
		msgElement.style.display = 'none';
	}
	
	function showMessage(){
		var strMsg = "";
		msgElement = document.getElementById('messages');

		for(i=0; i<errorMessages.length; i++){			
			strMsg = strMsg + '<li>' + errorMessages[i] + '</li>';			
		}

		if(strMsg != ""){
			msgElement.innerHTML = "<font color='red'><UL>"+strMsg+"</UL></font>";		 
			msgElement.style.display = 'block';
			javascript:scroll(0,0);
		}


    }
    
function writeFieldLabel(label){
	return '<b>' + label + '</b>: ';
}


