// if the autopopup from flash worked, then assume we can bypass popup blocking
var autoPopupWorked = true;

function popUpWindow(URLStr, left, top, width, height, scroll, resize, winID)
{
	var winVar = this[winID];
	if(winVar) {
		if(!winVar.closed) winVar.close();
	}
	winVar = open(URLStr, winID, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + (scroll ? "yes" : "no") + ',resizable=' + (resize ? "yes" : "no") + ',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	
	return winVar;
}


function launchONSite(autoPopupFlag)
{
	var width =  screen.availWidth - 10;
	var height =  screen.availHeight - 29;
	var left = 0;
	var top = 0;

	var queryString = "?popupsBlocked=" + !autoPopupWorked;
	if (queryObject["gotoSection"] != null) {
		queryString += "&gotoSection=" + queryObject["gotoSection"];
		
	} else if (queryObject["ecard"] != null) {
		queryString += "&ecard=" + queryObject["ecard"];
	}
	if (queryObject["CMP"] != null) {
		queryString += "&CMP=" + queryObject["CMP"];
	}
	var sitePage = "launch.html" + queryString;
	var winVar = popUpWindow(sitePage, left, top, width, height, false, true, "siteWin");
	
	if (autoPopupFlag && winVar == null) autoPopupWorked = false;
}

function launchNSSite(autoPopupFlag)
{
	var width =  screen.availWidth - 10;
	var height =  screen.availHeight - 29;
	var left = 0;
	var top = 0;

	var queryString = "?popupsBlocked=" + !autoPopupWorked;
	if (queryObject["gotoSection"] != null) {
		queryString += "&gotoSection=" + queryObject["gotoSection"];
		
	} else if (queryObject["ecard"] != null) {
		queryString += "&ecard=" + queryObject["ecard"];
	}
	if (queryObject["CMP"] != null) {
		queryString += "&CMP=" + queryObject["CMP"];
	}
	var sitePage = "http://www.friends4friends.ns.ca/launch.html" + queryString;
	var winVar = popUpWindow(sitePage, left, top, width, height, false, true, "siteWin");
	
	if (autoPopupFlag && winVar == null) autoPopupWorked = false;
}
