var popupDivId='';
var browseNodeId;
var innerDocWidth = 0, innerDocHeight = 0;

  
if( typeof( window.innerWidth ) == 'number' )
{
	//Non-IE
	innerDocWidth = window.innerWidth;
	innerDocHeight = window.innerHeight;
}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
{
	//IE 6+ in 'standards compliant mode'
	innerDocWidth = document.documentElement.clientWidth;
	innerDocHeight = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
{
	//IE 4 compatible
	innerDocWidth = document.body.clientWidth;
	innerDocHeight = document.body.clientHeight;
}
 
function showDivPopup(id)
{
 	popupDivId = id;
	totalHeightWithScroll=document.body.scrollHeight;		
	totalWidthWithScroll=document.body.scrollWidth;
 
	if(totalHeightWithScroll<innerDocHeight)
	{
			totalHeightWithScroll=innerDocHeight;
	}
	
	divHeight = document.getElementById(popupDivId).scrollHeight;
	divWidth = document.getElementById(popupDivId).scrollWidth;
	document.getElementById(popupDivId).style.top=currentDocHeight + innerDocHeight/2 - (divHeight/2) +"px";
 	document.getElementById(popupDivId).style.left=currentDocWidth + innerDocWidth/2 - (divWidth/2) +"px";
	
	document.getElementById("blockSection").style.display='block';
	document.getElementById("blockSection").style.height=totalHeightWithScroll+"px";
	document.getElementById("blockSection").style.width=totalWidthWithScroll+"px";
	document.getElementById(popupDivId).style.display='block';
	document.getElementById(popupDivId).style.visibility='visible';
}

function hideDivPopup(id)
{
	document.getElementById("blockSection").style.display='none';
  document.getElementById(id).style.visible='hidden';
	document.getElementById(id).style.display='none';
	popupDivId = 0;
}


function scrollDetector(){	 // detect scroll browser event and change position of loading banner

	if (navigator.appName == "Microsoft Internet Explorer")
	{	 
		currentDocHeight=document.documentElement.scrollTop;
		currentDocWidth=document.documentElement.scrollLeft;
	}
	else
	{
		currentDocHeight=window.pageYOffset
		currentDocWidth=window.pageXOffset
	}
	if(popupDivId!=0)
	{
		divHeight = document.getElementById(popupDivId).scrollHeight;
		divWidth = document.getElementById(popupDivId).scrollWidth;
		document.getElementById(popupDivId).style.top=currentDocHeight + innerDocHeight/2 - (divHeight/2) +"px";
 	  document.getElementById(popupDivId).style.left=currentDocWidth + innerDocWidth/2 - (divWidth/2) +"px";
	}
}
 
// set event to capture scrolling event
setInterval("scrollDetector()", 5);


// Post Public Message

function openPage(url)
{
	var w = 600;
	var h = 600;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	windowprops = "height="+h+",width="+w+",top="+wint+",left="+winl+",location=no,"+"scrollbars=yes,menubars=no,toolbars=no,resizable=no,status=no,directories=no";
	var modifyst=window.open(url,"winse",windowprops);
	modifyst.focus;
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
