// Window Openers
// Javascript Library
// * Common to All Sites
// All functions in this library are prefixed with WO_ to avoid
//   name conflicts with existing local site functions

// calling from HTML, eg:
// javascript:WO_openScreenWin('smallscreen', '/gallery/gallery_window.html?galleryID=1&screensize=2&screenimage=1','smallstore');

//function openCustomWin(winName, loc, size)
//	- Opens a Screenshot gallery window
// 	winName: window name
//  loc: URL location
//  size: "small" or "large" depending on gallery image size
function WO_openCustomWin(winName, loc, width, height, top, left, isScroll, isResize, isStatus, isTool, isMenu, isDir){
	var newWindow;
	var strProps = "location=no"; //set up properties of new window

	// example property string
	//"location=no,status=no,scrollbars=no,toolbar=no,menubar=no,directories=no,resizable=no,width=x,height=y"
	if (isScroll) { strProps += ",scrollbars=yes"; }
	if (isStatus) { strProps += ",status=yes"; }
	if (isResize) { strProps += ",resizable=yes"; }
	if (isTool) { strProps += ",toolbar=yes"; }
	if (isMenu) { strProps += ",menubar=yes"; }
	if (isDir) { strProps += ",directories=yes"; }

	strProps += ",width="+width;
	strProps += ",height="+height;
	strProps += ",screenX="+left;
	strProps += ",screenY="+top;
	//alert (strProps);
	newWindow = window.open(loc,winName,strProps);
	newWindow.focus();
}


function WO_openEmailPageWin(loc) {
	WO_openCustomWin('emailpage',loc,400,380,100,100,0,1,0,0,0,0);
}

function WO_openNslSignupWin(loc) {
	WO_openCustomWin('nslSignup',loc,400,380,100,100,0,1,0,0,0,0);
}

function WO_openStoreHelpWin(loc) {
	WO_openCustomWin('nslSignup',loc,350,400,100,100,1,1,0,0,0,0);
}
//function WO_openScreenWin(winName, loc, size)
//	- Opens a Screenshot gallery window
// 	winName: window name
//  loc: URL location
//  size: "small" or "large" depending on gallery image size and site
function WO_openScreenWin(winName, loc, size) {
	var newWindow;

	//alert("IN WO_openScreenWin with \n"+ winName +"\n"+loc+"\n"+size);
	if (size == "da-large") {
		width = "790";
		height = "645";
	}
	else if (size == "da-small") {
		width = "439";
		height = "409";
	}
	else if (size == "largestore") {
		width = "800";
		height = "650";
	}
	else if (size == "smallstore") {
		width = "390";
		height = "400";
	}
	else if (size == "large") {
		width = "800";
		height = "600";
	}
	else { //small (default)
		width = "390";
		height = "345";
	}
	WO_openCustomWin(winName,loc,width,height,0,0,0,0,0,0,0,0);
}

//function WO_openSizedWin(winName, loc, width, height)
//	- Opens a window sized to width and height
// 	winName: window name
//  loc: URL location
//  width: X dimension in pixels
//  height: Y dimension in pixels
function WO_openSizedWin(winName, loc, width, height){
	WO_openCustomWin(winName,loc,width,height,100,100,1,1,0,0,0,0);
}

function WO_loadURL(path) {
	if (path != "") {
    	//top.location.href = path;
		window.open(path,"_blank");
	}
}