function GetScreenX()
	{
		var screenX;
		if(navigator.appName == "Microsoft Internet Explorer") 
			screenX = window.screen.availWidth;
		else screenX = window.outerWidth;
		return screenX;
	}

	function GetScreenY()
	{
		var screenY;
		if(navigator.appName == "Microsoft Internet Explorer")
			screenY = window.screen.availHeight;			
		else	screenY = window.outerHeight;
		return screenY;
	}


		function GetParameter(sParam){
			var sPage=document.location+"";
			if(sPage.indexOf('?')!=-1){
				var sParams=sPage.split('?')[1];
				var vParams=sParams.split('&');
				for (i=0;i<vParams.length;i++){
					var vParam= vParams[i].split('=');
					if(vParam[0]==sParam) return vParam[1];
				}
			}
			return null;
		}
		
		function GetParameter2(objDocument,sParam){
			var sPage=objDocument.location+"";
			var sParams=sPage.split('?')[1];
			var vParams=sParams.split('&');
			for (i=0;i<vParams.length;i++){
				var vParam= vParams[i].split('=');
				if(vParam[0]==sParam) return vParam[1];
			}
			return null;
		}
		




//***********************************************************//
// OPENCENTEREDPOPUP
// -----------------
// Opens a centered popup with size based on screen resolution
//
// page:        is the page called
// title:       is the popup name
// width:       is the popup width in a 800x600 screen.
// height:      is the popup height in a 800x600 screen
// options:     is the window options
// fixed:       yes - Don't modify the sizes based on resolution
//
// if width=0 the popup width will be screen.width-100
// if height=0 the popup width will be screen.width-100
// if screen resolution is other than 800x600, width & height
// will change to fit correctly
//
// The options are: 
//     alwaysRaised - If yes, the created window is raised. 
//     directories - The value of yes or no determines if the window shows directory buttons or not. 
//     location - The value of yes or no determines if the window has a location displayed on the address line (or has an address line) or not. 
//     menubar - The value of yes or no determines if the window has a menubar or not. 
//     outerWidth - Specifies the outer window width in pixels. This is set to an integer value, rather than yes or no. 
//     outerHeight - Specifies the outer window height in pixels. This is set to an integer value, rather than yes or no. 
//     resizable - The value of yes or no determines if the window can be resized by the user or not 
//     status - The value of yes or no determines if the window has a status bar or not. 
//     scrollbars - The value of yes or no determines if the window has scroll bars or not. 
//     toolbar - The value of yes or no determines if the window has a toolbar or not. 
//     z-lock - If yes, the created window is in the background.
//***********************************************************//
function OpenCenteredPopup(page,title,width,height,options,fixed)
{
	//correct size for the popup
	var popupWidth;
	var popupHeight;
	var popupTop;
	var popupLeft;
	
	if (fixed=='yes') {

		if (width==0)
			popupWidth = screen.width - 100;
		else
			popupWidth = width;
		if (height==0)
			popupHeight = screen.height - 100;
		else
			popupHeight = height;

	} else {

		if (width==0)
			popupWidth = screen.width - 100;
		else
			popupWidth = screen.width * width / 800
		if (height==0)
			popupHeight = screen.height - 100;
		else
			popupHeight = screen.height * height / 600

	}

	//center the popup
	var screenX;
	var screenY;
	
	screenY = screen.availHeight;
	screenX = screen.availWidth;
	
	popupLeft = (screenX - popupWidth) / 2;
	popupTop = (screenY - popupHeight) / 2;
	if (navigator.appName.indexOf("Microsoft")<0) {
		popupLeft = (popupLeft - pageXOffset);
		popupTop = (popupTop - pageYOffset);
	}
	if (popupTop<0) popupTop=0;
	if (popupLeft<0) popupLeft=0;
		
	//opens the popup
	if (navigator.appName.indexOf("Microsoft")>=0) 
	{
		if (options != '') options+=',';
		options+='width='+popupWidth+',height='+popupHeight+',left='+ popupLeft +',top='+popupTop;
	}
	else
	{
		if (options != '') options+=',';
		options+='width='+popupWidth+',height='+popupHeight+',screenX='+ popupLeft +',screenY='+popupTop;
	}
	var floater=window.open(page,title,options);
	floater.focus();
	return floater;
}



function centerDiv(divId){
	widthMsg=parseInt(document.getElementById(divId).style.width)+50;
	leftMsg=screen.width/2-widthMsg;
	document.getElementById(divId).style.left=leftMsg;
}



function GoEdit(itemId){
	obj=document.getElementById(itemId);
	if((obj.tagName.toUpperCase()=="INPUT")
		&&(obj.type.toUpperCase()!="CHECKBOX")
		&&(obj.type.toUpperCase()!="BUTTON")
		&&(obj.type.toUpperCase()!="SUBMIT")){
			obj.className ="txtbox";	
			obj.readOnly =false;
		}
	obj.disabled =false;
}


function GoReadOnly(itemId){
	obj=document.getElementById(itemId);
	if((obj.tagName.toUpperCase()=="INPUT")
		&&(obj.type.toUpperCase()!="CHECKBOX")
		&&(obj.type.toUpperCase()!="BUTTON")
		&&(obj.type.toUpperCase()!="SUBMIT")){
			obj.className ="txtboxdisabled";	
			obj.readOnly =true;
		}
	obj.disabled =true;
}

