function openSendRepWindow()
{

	var comdivs=new Array('report_to_msg', 'eMsg');
	var cdiv;
	var x;
	for (x in comdivs)
	{
		cdiv = document.getElementById(comdivs[x]);
		if (cdiv!=undefined)
			cdiv.innerHTML = '&nbsp;';
	}
		
	showDIV('sendDIV'); showHDIV('shadowDIV');	
}

function openAuthWindow()
{

	var comdivs=new Array('firstname_comment', 'lastname_comment', 'login_comment', 'email_comment', 'password_comment', 'cpassword_comment', 'other_comment', 'loginmsg' );
	var cdiv;
	var x;
	for (x in comdivs)
	{
		cdiv = document.getElementById(comdivs[x]);
		if (cdiv!=undefined)
			cdiv.innerHTML = '&nbsp;';
	}
		
	showDIV('authDIV'); showHDIV('shadowDIV'); ShowCancelBt();
}

function openUploadXML(){
	showDIV('uploadxmlDIV'); showHDIV('shadowDIV');
}

function sendUploadXML(){
	var obj = null;

	obj = document.getElementById("uploadxml");
	obj.submit();
}

function appletAlert()
{ 
 var app_str = null;
 
 app_str = "This java applet will allow you to take a snapshot of any VM's resource allocations in your environment."
 app_str += "The applet may take a few minutes to load, so please be patient. Continue?";
 if (!confirm(app_str))
       return false;
 else
		return true;
}

function hideDIV(id){
var findDIVobj = document.getElementById(id);
    if (findDIVobj.style.display!="none"){findDIVobj.style.display="none"}
}


function getYScroll() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

function getXScroll() {
  var scrOfX = 0;
  if( typeof( window.pageXOffset ) == 'number' ) {
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfX;
}

function pageHeight() 
{	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;}

function pageWidth() 
{	return  window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?  document.documentElement.clientWidth : document.body != null? document.body.clientWidth : null;}



function showDIV(id){
var findDIVobj = document.getElementById(id);
    if (findDIVobj.style.display=="none")
	{
		
		offsetY = getYScroll();
		
		totalY = pageHeight();
		totalX = screen.availWidth;
		clientH = findDIVobj.style.height.replace(/px/, '')
		clientW = findDIVobj.style.width.replace(/px/, '')
		
		
		ypos = offsetY + totalY/2 - clientH/2 - 50;
		if (ypos<10) ypos = 10;
		
		xpos = totalX/2 - clientW/2
		
		findDIVobj.style.top = ypos + 'px';
		findDIVobj.style.left = xpos + 'px';
		
		findDIVobj.style.display="block"
	}
}



function showHDIV(id){

	var container = document.getElementById('container');
	var findDIVobj = document.getElementById(id);
	
	
	if (pageHeight() < container.clientHeight)
		findDIVobj.style.height= container.clientHeight + 'px';
	else
		findDIVobj.style.height= '100%';
	if (findDIVobj.style.display=="none"){findDIVobj.style.display="block"}
	
	//contentY =container.clientHeight
	//screenY = screen.availHeight;
	//var yy;
	//if (contentY > screenY)
//		yy = contentY + 'px';
	//else
		yy = '100%';
	//var h = yy;	
	//var h = getYScroll() + pageHeight() + 'px';
	//var w = getXScroll() + pageWidth() + 'px';
	//findDIVobj.style.height= h;
	//findDIVobj.style.width= w;
	//findDIVobj.style.top = '0px';
	//findDIVobj.style.left = '0px';

	
	
	//window.onResize="windowResize" 

}

function windowResize()
{
	//findDIVobj.style.height= '100%';
	//findDIVobj.style.width= '100%';
	//findDIVobj.style.top = '0px';
	//findDIVobj.style.left = '0px';
	
	
}

function HideCancelBt(){
	var el1 = null;
	var el2 = null;

	try{
		el1 = document.getElementById("loginCancelButton");
		el2 = document.getElementById("registerCancelButton");
		
		el1.style.display = "none";
		el2.style.display = "none";
	}catch(e){
	}
}

function ShowCancelBt(){
	var el1 = null;
	var el2 = null;
	
	try{
		el1 = document.getElementById("loginCancelButton");
		el2 = document.getElementById("registerCancelButton");
		
		el1.style.display = "inline";
		el2.style.display = "inline";
	}catch(e){
	}
}