//Function to generate a popup with specific height and width
function popUpLogon(url, winWidth, winHeight)
{
	var winWidth;
	var winHeight;
	
	winHeight = parseInt(winHeight);
	winWidth = parseInt(winWidth);
	winWidth = winWidth + 17;
	popUpWindow = window.open(url, null,' scrollbars=1,resizable=1,width=' + winWidth + ',height=' + winHeight);
} 

//Function used to validate presence of userName and Password
//for elements UserName_loginWidget and pswd_loginWidget
function ValidateLogin()
{
	var txtUserName = document.getElementById("UserName_loginWidget");
	var txtPassword = document.getElementById("pswd_loginWidget");

    document.getElementById("err_login").style.display = "none";
    
	if (txtUserName.value == "") {
		document.getElementById("err_userID").style.display = "block";
		document.getElementById("err_password").style.display = "none";
		return false;
	}

	if (txtPassword.value == "") {
		document.getElementById("err_userID").style.display = "none";
		document.getElementById("err_password").style.display = "block";
		return false;
	}

	return true;
}


var newwindow = '';

function PopItUp(url, from, Form) 
{
	newurl = url + "?txtUsername=" + Form.txtUsername.value + "&txtPassword=" + Form.txtPassword.value + "&origin=" + Form.origin.value + "&chkRememberMe=" + Form.chkRememberMe.value;
	if (!newwindow.closed && newwindow.location) 
	{
		newwindow.location.href = newurl;
	}
	else 
	{
		newwindow=window.open(newurl,'name');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	
	window.location.href = from;
}

function ReturnToParentWindow(url, statusflag)
{
	opener.location.href = url + "?statusflag=" + statusflag;
}

