/*
	Copyright Binfinity Web, Inc. 2003-2004. All rights reserved.
*/

var CurStorePopupWin = null;
var helpStoreWin = null;

var storewin = null;

function buyvendorprod(vid, pid) {
	var sattrib, height, width;
	
	height = 590;
	width = 790;
	
	sattrib = "width= " + width + ",height=" + height;
	
	//try to right justify the window and put it at top of screen
	if (window.screen) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;

		//code to center
		//var xc = (aw - swidth) / 2;
		//var yc = (ah - sheight) / 2;
		
		var xc = aw - width;
		var yc = ah - height;

		sattrib += ",left=" + xc + ",screenX=" + xc;
		sattrib += ",top=0,screenY=0";
	}
	
	sattrib += ",toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1"
	
	closestorewin();	
	//storewin = window.open("http://www.drugstore.com","win",sattrib,false);
	//debugger;
	var surl = "shopbuyvendprod.jsp?vendid=" + vid + "&prodid=" + pid;
	var storewin = window.open(surl,"storewin",sattrib);
	
	setTimeout("storewin.focus();",1000);
	//storewin.focus();
}

var objWindow = parent.objPopWindow;
function gotovendorprod(vid, pid) {
	var sattrib, height, width;
	
	height = 580;
	width = 750;
	sattrib = "width= " + width + ",height=" + height;
	//try to right justify the window and put it at top of screen
	if (window.screen) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		var xc = aw - width;
		var yc = ah - height;
		sattrib += ",left=" + xc + ",screenX=" + xc;
		sattrib += ",top=0,screenY=0";
	}	
	sattrib += ",toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1"
	
	//var sUrl = "http://www.yahoo.com"; 
	var sUrl = "shopbuyvendprod.jsp?vendid=" + vid + "&prodid=" + pid;
	var sWindowName = "mmcmspopup";
		
	if (objWindow.win != null  && !objWindow.win.closed) {
		 objWindow.win.close();
	}
	//objWindow.win = window.open("about:blank" , sWindowName, sattrib);

	//objWindow.win.document.write("<b>Please wait.</b>");
	
	objWindow.win = window.open(sUrl , sWindowName, sattrib);
	
	setTimeout("if (objWindow.win != null  && !objWindow.win.closed) objWindow.win.focus();",1000);
		
}


function closestorewin() {
	if (storewin != null) {
		if (!storewin.closed) {
			storewin.close();
		}
		storewin = null;
	}


}

function popStoreWin(surl) {
	closePopup();
	CurStorePopupWin = window.open(url,"win","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=550,height=300",false);
}

function popStoreWinx(surl, swidth, sheight, bcenter, bscroll, bresize) {
	var sattrib = "location=no,toolbar=no,directories=no,menubar=no"
	if (bresize)
		sattrib += ",status=yes,resizable=yes";
	else
		sattrib += ",status=no,resizable=no";
	if (bscroll)
		sattrib += ",scrollbars=yes";
	sattrib+= ",width=" + swidth;
	sattrib+= ",height=" + sheight;
	
	if (bcenter==true) {
		if (window.screen) {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
	
			var xc = (aw - swidth) / 2;
			var yc = (ah - sheight) / 2;
	
			sattrib += ",left=" + xc + ",screenX=" + xc;
			sattrib += ",top=" + yc + ",screenY=" + yc;
		}
	}

	closeStorePopup();
	CurStorePopupWin = window.open(surl,"win",sattrib,false);
}


function closeStorePopup() {
	if (CurStorePopupWin != null) {
		if (!CurStorePopupWin.closed) {
			CurStorePopupWin.close();
		}
		CurStorePopupWin = null;
	}
}


function xxdisplayHelp(idx) {
	surl = "helpmain.jsp?idx=" + idx;
	
	popWinx(surl,480,460, true, true, true);
	//window.open(surl, "","",false);
}

function xxshowSurveyResults(surveyid) {
	var surl;
	
	surl = "surveyresults.jsp?surveyid=" + surveyid;
	
	popWinx(surl,460,400, true, true, false);
}

function xxprocess_survey() {
	
	document.frmsurvey.submit();
	return true;		
}

function xxshowOnLineTour(sPageNum) {
	surl = "tour/onlinetour_intro.html";
	popWinx(surl,600,500, true, true, false);
}
