var popURI,popWinName,popAttribs,popWidth,popHeight;
// var EDAid, EDAsource & EdAdKey = {set dynamically on page - server side}
var defaultAttribs = "toolbar=1,location=0,directories=0,resizable=1,status=0,menubar=1,scrollbars=1";

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

//Enhanced Display Ad Coupon Popup
function popEDAcoupon(id, source) {
	// window configuration
	popURI = "showcoupons.aspx?edid=" + id + "&source=" + source;
	popWinName = "EDAwinCoupons";
	popWidth = 505;
	popHeight = 505;
	popAttribs = defaultAttribs + ",width=" + popWidth + ",height=" + popHeight;

	_popWindow(popURI,popWinName,popAttribs);
}

//Enhanced Display Ad Video Popup
function popEDAvideo(id, source, type) {
	// window configuration
	popURI = "showvideos.aspx?edid=" + id + "&source=" + source + "&type=" + type;
	popWinName = "EDAwinVideos";
	popWidth = 505;
	popHeight = 505;
	popAttribs = defaultAttribs + ",width=" + popWidth + ",height=" + popHeight;

	_popWindow(popURI,popWinName,popAttribs);
}

//Enhanced Display Ad Menu Popup
function popEdAMenu(id, source, type) {
	// window configuration
	popURI = "showmenus.aspx?edid=" + id + "&source=" + source + "&type=" + type;
	popWinName = "EDAwinMenus";
	popWidth = 700;
	popHeight = 600;
	popAttribs = defaultAttribs + ",width=" + popWidth + ",scrollbars=No,height=" + popHeight;

	_popWindow(popURI,popWinName,popAttribs);
}

//Enhanced Display Ad Email Customer
function popEmailSeller(id, source){
	// window configuration
	popURI = "showemail.aspx?edid=" + id + "&source=" + source;
	popWinName = "EDAwinEmail";
	popWidth = 505;
	popHeight = 505;
	popAttribs = defaultAttribs + ",width=" + popWidth + ",height=" + popHeight;

	_popWindow(popURI,popWinName,popAttribs);
}

//Enhanced Display Ad Maps Popup
function popEDAmaps(id, source) {
	// window configuration
	popURI = (source == "") ? "/info/showmultimaps.aspx?id=" + id : "/info/showmultimaps.aspx?edid=" + id + "&source=" + source;
	popWinName = "EDAwinMaps";
	popWidth = 700;
	popHeight = 555;
	popAttribs = defaultAttribs + ",width=" + popWidth + ",height=" + popHeight;

	_popWindow(popURI,popWinName,popAttribs);
	return false;
}


//Enhanced Display Coupon Popup
function popCoupons(LinkID) {
	// window configuration
	popURI = "/info/showcoupons.aspx?" + LinkID;
	popWinName = "EDAwinCoupons";
	popWidth = 505;
	popHeight = 505;
	popAttribs = defaultAttribs + ",width=" + popWidth + ",height=" + popHeight;

	_popWindow(popURI,popWinName,popAttribs);
	return false;
}

//Enhanced Display Ad Save This Ad
function popClipboard(adKey, doWhat, whichTable){
	// S means "save"? (who added doWhat parameter?)
	if(whichTable != "display" && whichTable != "edcoupons")
		whichTable = "ads"; 
	popURI = (doWhat == "S") ? "/clipbrd.aspx?id=" + adKey + "&adTable=" + whichTable + "&action=add" : "/clipbrd.aspx?adTable=" + whichTable;
	popWinName = "popClipBrd";
	popWidth = 790;
	popHeight = 590;
	popAttribs = defaultAttribs + ",width=" + popWidth + ",height=" + popHeight;

	_popWindow(popURI,popWinName,popAttribs);
	return false;
}

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */


/* Pop New Window */
	//GD[2008 04 14] - blanked out windowName below in open(), due to 'IE newWin bug (No such interface supported)'
function _popWindow(url,windowName,windowAttributes) {
	winObj = window.open(url,'',windowAttributes); //Launch
	winObj.moveTo((screen.width-popWidth)/2,(screen.height-popHeight)/2); //Center on screen
	winObj.focus(); //Bring to front
	return winObj; //Return window object to caller
}

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

/* old school */
function OpenPopup(Url) {
	return OpenSizedPopup(Url, 790, 590);
}
function OpenSizedPopup(Url, width, height) {
	window.open(Url, "pfpopup", "width=" + width + ",height=" + height + ",toolbar=1,location=0,directories=0,resizable=1,status=0,menubar=1,scrollbars=1");
	return false;
}