//
// Copyright (C) 1998-2011 CyberStrong Internet Services, Inc. All Rights Reserved
// 
// This file has been seeded with unique information at point of sale and
// is traceable to its purchaser.
// 
// Your license agreement forbids the removal of this notice.

// Project Wide JavaScript Library


// PopUpHelp() - Specialized pop-up for eShop help windows...

function PopUpHelp(url)
{
	OpenWindow("DisplayHelp", url, 640, 480, false, true, false)
}


// OpenWindow() - Generic open window function...

function OpenWindow(winName, urlLoc, w, h, showStatus, isViewer, needsNav) {
	l = (screen.availWidth - w)/2;
	t = (screen.availHeight - h)/2;
	features  = "toolbar=" + (needsNav?"yes":"no");   // yes|no 
	features += ",location=no";    // yes|no 
	features += ",directories=no"; // yes|no 
	features += ",status=" + (showStatus?"yes":"no");  // yes|no 
	features += ",menubar=no";     // yes|no 
	features += ",scrollbars=" + (isViewer?"yes":"no");   // auto|yes|no 
	features += ",resizable=" + (isViewer?"yes":"no");   // yes|no 
	features += ",dependent";      // close the parent, close the popup, omit if you want otherwise 
	features += ",height=" + h;
	features += ",width=" + w;
	features += ",left=" + l;
	features += ",top=" + t;
	winName = winName.replace(/[^a-z]/gi,"_");
	window.open(urlLoc,winName,features);
	return;
} 


// OpenParm() - Open a popup window for parm edit...

function OpenParm(parmname) {
	OpenWindow('EditParm', '_Parms.asp?ReturnTo=_Close.asp&var=' + parmname + '&pos=0&popup=1', 750, 500, false, true, false)
}


// Go() - Allows a link to be used as a form button...

function Go(action) {
	document.forms.frmMain.Action.value = action
	document.forms.frmMain.submit();	
}

// GoForm() - Like Go() but allows specification of the form name...

function GoForm(form, action) {
	eval("document.forms." + form + ".Action.value = action")
	eval("document.forms." + form + ".submit()")
}


// PopImg() - Open the given image-url in a popup window. Force focus...

function PopImg(name, url, title) {
	var image1 = new Image(); image1.src = url
	var iwidth = image1.width + 40
	var iheight = image1.height + 40

	with (window.open('', name, 'width=' + iwidth + ',height=' + iheight + ',status=no,resizable=yes,' + 'left=' + (screen.availWidth - iwidth) / 2 + ',top=' + (screen.availHeight - iheight) / 2)) {
		resizeBy(image1.width - document.body.clientWidth + 10, image1.height - document.body.clientHeight + 20)
		document.clear();
		document.writeln('<html><head> <title>' + title + '<\/title> <\/head> <body style= \"background: url(' + url + ') no-repeat 50% 50%; height: 100%"><\/body><\/html>');
		document.close();
		focus();
	}
}

