var openWin = null;

// method checks for whether the popup window exists or not
function CheckForNewWindow(win, pass, fail)
{
	openWin = win;
	
	if (openWin)
		setTimeout("CheckForNewWindowHelper('" + pass + "','" + fail + "')", 2000);
	else
		RedirectWindow(fail);
}

// method checks for whether the popup window is closed or not
function CheckForNewWindowHelper(pass, fail)
{
	if (openWin.closed)
		RedirectWindow(fail);
	else
	{
		if ((pass != '') && (pass != null) && (pass != 'undefined') && (pass != new String(this.window.location)))
			RedirectWindow(pass);	
	}
}

// method redirects the current window to manual launcher page showing the text message for popup blocker
function RedirectWindow(url)
{
	//alert("redirect>" + url);
	window.top.location.replace(url);
}
//link to the same window
function ln(url) {
	if (url != '') {
		if (url.indexOf(url) == -1) {
			window.open(url);
		} else {
			document.location = url;
		}
	}
}
//Link to new window
function lnN(url) {
	if (url != '') {
		window.open(url, '_blank');		
	} else {
		document.location = url;
	}
}