function PopUp(sURl, sName, sFeatures) {
	// To open a new window
		var newBrowser;
		newBrowser = window.open(sURl, sName, sFeatures);
		newBrowser.focus();		
}

function openBareCenteredWin(newUrl, winName, winWidth, winHeight) {
	__openWin(newUrl, winName, winWidth, winHeight, ",status=no,scrollbars=yes,resizable=yes,menubar=no,toolbar=no");
}

function __openWin(newUrl, winName, winWidth, winHeight, strOptions) {
    var str;
    str="width=" + winWidth + ",height=" + winHeight + ",innerHeight=" + winHeight;
    str+=",innerWidth=" + winWidth;

    if (window.screen)
    {
      var yPos = ( screen.availHeight / 2 ) - ( winHeight / 2);
      yPos = yPos < 0 ? 0 : yPos;
      var xPos = ( screen.availWidth / 2 ) - ( winWidth / 2);
      xPos = xPos < 0 ? 0 : xPos;
      str += ",left=" + xPos;
      str += ",screenX=" + xPos;
      str += ",top=" + yPos;
      str += ",screenY=" + yPos;
    }
    str += strOptions;
    PopUp(newUrl, winName, str);
}

function isEven(x) { return (x%2)?false:true; }
function isOdd(x) { return !isEven(x); }

function popUp_onload ( URl ) 
{
	// we need to randomnly open opens 
	// for doing this, we generate a random number, if its a odd number, then 
	// we do not open the surve, else on an even number open the survey
	//var sChoice = "1234567890";
	//var size_of_Number = 4;
	//var nNumber = '';
	//for ( var iKey = 0; iKey < size_of_Number; iKey++ ) 
	//{
	//	var randomNumber = Math.floor(Math.random() * sChoice.length);
	//	nNumber += sChoice.substring(randomNumber, randomNumber + 1)
	//}
	
	//if ( isEven(nNumber) ) 
	//{
	if ( Math.random() < 0.5 ) {
		openBareCenteredWin( "/india/Common/Survey.aspx?URl=" + escape(URl), "SurveryPage",300, 150);
	}
	//}
}