function getRandomNumber()
{return (Math.round((Math.random()*51+1)))}

function OpenPopup(aUrl, aWidth, aHeight)
{
	var left = (window.screen.width)/2 - aWidth;
	var top = (window.screen.height)/2 - aHeight;
	var winProps = "width=" + aWidth + ",height=" + aHeight + ",noresize,toolbar=no,menubar=no,scrollbars=no,left=" + left + ",top=" + top;
	var randomNum = getRandomNumber();
	
	var winInst = open(aUrl, "popUpWindow" + randomNum, winProps);
	
	if(!winInst) {
		getSwf("BombayUniverse").openWindowFromSwf(aUrl);
	}
	else {
		winInst.focus();
	}
	
	return winInst;
}

function OpenPopupSilent(aUrl, aWidth, aHeight)
{
	var popup = OpenPopup(aUrl, aWidth, aHeight);
}

function OpenScrollablePopup(aUrl, aWidth, aHeight)
{
	var left = (window.screen.width)/2 - aWidth;
	var top = (window.screen.height)/2 - aHeight;
	var winProps = "width=" + aWidth + ",height=" + aHeight + ",noresize,toolbar=no,menubar=no,scrollbars=yes,left=" + left + ",top=" + top;
	var randomNum = getRandomNumber();
	
	var winInst = open(aUrl, "popUpWindow" + randomNum, winProps);
	
	if(!winInst) {
		getSwf("BombayUniverse").openWindowFromSwf(aUrl);
	}
	else {
		winInst.focus();
	}
	
	return winInst;
}

function OpenScrollableCenteredPopup(aUrl, aWidth, aHeight, aWinMane)
{
	var left = (window.screen.width)/2 - aWidth/2;
	var top = (window.screen.height)/2 - aHeight/2;
	var winProps = "width=" + aWidth + ",height=" + aHeight + ",noresize,toolbar=no,menubar=no,scrollbars=yes,left=" + left + ",top=" + top;
	//var randomNum = getRandomNumber();
	
	var winInst = open(aUrl, "DGCSubmitForm", winProps);
	
	if(!winInst) {
		getSwf("BombayUniverse").openWindowFromSwf(aUrl);
	}
	else {
		winInst.focus();
	}
}

/*var dgcWin;

function OpenScrollableCenteredPopup(aUrl, aWidth, aHeight, aWinMane)
{
	var left = (window.screen.width)/2 - aWidth/2;
	var top = (window.screen.height)/2 - aHeight/2;
	var winProps = "width=" + aWidth + ",height=" + aHeight + ",noresize,toolbar=no,menubar=no,scrollbars=yes,left=" + left + ",top=" + top;
	//var randomNum = getRandomNumber();
	
	if(dgcWin != null)
	{
		dgcWin.focus();
	}
	else
	{
		var winInst = open(aUrl, "DGCSubmitForm", winProps);
		winInst.focus();
		
		dgcWin = winInst;
	}
}*/

function OpenScrollablePopupSilent(aUrl, aWidth, aHeight)
{
	var popup = OpenScrollablePopup(aUrl, aWidth, aHeight);
}

function openExternalSite(aUrl)
{
	var winInst = open(aUrl, "externalSite");
	
	if(!winInst) {
		getSwf("BombayUniverse").openWindowFromSwf(aUrl);
	}
	else {
		winInst.focus();
	}
}

function getSwf(id) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[id];
	} 
	else {
		return document[id];
	}
}    