function show(imgObj){
     var el = document.getElementById(imgObj);
	 if (el)
		el.style.visibility='visible';
}
function hide(imgObj){
     var el = document.getElementById(imgObj);
	 if (el)
		el.style.visibility='hidden';
}
function changeImage(imgObj,imgRef){
     var el = document.getElementById(imgObj);
	 if (el)
		el.src=imgRef;
}
function GetPageWidth () {
	if (document.body.scrollWidth > document.body.clientWidth)
		return document.body.scrollWidth;
	else
		return document.body.clientWidth;
}
function GetPageHeight () {
	if (document.body.scrollHeight > document.body.clientHeight)
		return document.body.scrollHeight;
	else
		return document.body.clientHeight;
}
function resizeOverlay() {
	var objModalPanel = document.getElementById('modalPanel');
	
	if(objModalPanel){
		var newWidth=GetPageWidth();
		var newHeight=GetPageHeight();
	
		objModalPanel.style.width = newWidth + "px";
		objModalPanel.style.height = newHeight + "px";
	}
	
	centerJobDialog();
}
function scrollDialogs() {
	centerJobDialog();
}
function showJobDialog(jobId){
	var jobWindowFrame = document.getElementById('jobWindowFrame');
	if (jobWindowFrame) {
		jobWindowFrame.src = "";
		jobWindowFrame.src = "./job.php?id="+jobId;
	}
	
	resizeOverlay();
	
	if (document.body && document.body.offsetWidth) {
		window.onresize = resizeOverlay;
		window.onscroll = scrollDialogs;
	}
	
	var modalPanel = document.getElementById('modalPanel');
	if (modalPanel) {
		modalPanel.style.display='block';
	}
	
	centerJobDialog();
}
function centerJobDialog(){
	var dialogObj = document.getElementById('jobWindow');
	
	if (dialogObj) {
		centerDiv(dialogObj);
		dialogObj.style.display='block';
	}
}
function centerDiv(divObj) {
	var scrollPosTop;
	var scrollPosLeft;
	
	if (window.pageYOffset) {
	   scrollPosTop = window.pageYOffset;
	   scrollPosLeft = window.pageXOffset;
	} else if (document.compatMode && document.compatMode == "CSS1Compat") {
	   scrollPosTop = document.documentElement.scrollTop;
	   scrollPosLeft = document.documentElement.scrollLeft;
	} else if (document.body) {
	   scrollPosTop = document.body.scrollTop;
	   scrollPosLeft = document.body.scrollLeft;
	}
	
	var innerHeight;
	var innerWidth;
	
	if (window.innerHeight) {
	   innerHeight = window.innerHeight;
	   innerWidth = window.innerWidth;
	} else if (document.compatMode && document.compatMode == "CSS1Compat") {
	   innerHeight = document.documentElement.clientHeight;
	   innerWidth = document.documentElement.clientWidth;
	} else if (document.body) {
	   innerHeight = document.body.clientHeight;
	   innerWidth = document.body.clientWidth;
	}
	
	var divTop = (innerHeight - parseInt(divObj.style.height)) / 2;
	var divLeft = (innerWidth - parseInt(divObj.style.width)) / 2;

	divObj.style.left = (divLeft + scrollPosLeft) + "px";
	divObj.style.top = (divTop + scrollPosTop) + "px";
}
function closeJobDialog() {
	if (document.body && document.body.offsetWidth) {
		window.onresize = null;
		window.onscroll = null;
	}
	
	var dialogObj = document.getElementById('jobWindow');
	
	if (dialogObj) {
		dialogObj.style.display='none';
	}
	
	var modalPanel = document.getElementById('modalPanel');
	if (modalPanel) {
		modalPanel.style.display='none';
	}
}
