function MM_reloadPage(init) {  
	//reloads the window if Nav4 resized
	if (init==true) with (navigator) {
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
		}
 	} else 
		if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location='MAIN_Main.php?Username=<?=$Username?>&Password=<?=$Password?>';
}
MM_reloadPage(true);

function WindowClose(reload,action)
{
	if (reload==1) {
		if (window.parent) {
			window.parent.opener.Submit_Form(action);
		} else {
			opener.Submit_Form(action);
		}
	}
	if (window.parent) {
		window.parent.close();
	} else {
		window.close();
	}
}

function ov(obj) {
	obj.style.backgroundColor='#E7DCDC';
}


function ou(obj) {
	obj.style.backgroundColor='';
}

function openPopUp(title, location, height, width, dependent, resizable, scrollbars, status, screenX, screenY) {
	if (height==undefined || height==null)
		height=500;

	if (width==undefined || width == null)
		width=400;

	if (dependent==undefined || dependent == null)
		dependent=0;
			
	if (resizable==undefined || resizable == null)
		resizable=1;
			
	if (scrollbars==undefined || scrollbars == null)
		scrollbars=1;
			
	if (status==undefined || status == null)
		status=1;
			
	windowFeatures='height='+height+', width='+width+', resizable='+(resizable==1?"yes":"no")+', scrollbars='+(scrollbars==1?"yes":"no")+', status='+(status==1?"yes":"no")+', dependent='+(dependent==1?"yes":"no");
	if (screenX != undefined || screenX == null)
		windowFeatures+=', screenX='+screenX;
	if (screenY != undefined || screenY == null)
		windowFeatures+=', screenY='+screenY;
	window.open(location, title, windowFeatures);
}

function redirect(url)
{
	window.location=url;
}

// This function opens an OK/Cancel Dialog Box. If the user presses ok, the form is submitted

function Cond_Submit_Form (Message,  Action) 
{
	//alert ("Debug:\n"+"Message: "+Message+"\nForm name: "+FormName);
	if (confirm(Message)) {
		Submit_Form (Action);
	}
}	
