<!-- solimar frame popup (robk)

<!-- figure out when to run the popup -->

// Check and see which method to use, document.referrer or window.location.href

var refString = document.referrer;
var locString = window.location.href;
var pattern = /sid\=/i;
var refResult = refString.match(pattern);
var locResult = locString.match(pattern);

// theoretically, there should only be two questions... is there a sid in the referrer, or the location

if (refResult != null) {
	var method = "ref"; // if there's sid in the referrer, then we can use document.referrer
}

else if (locResult != null) {
	var method = "loc"; // if not, we test for sid in window.location.href 
}

else if ((refResult == null) && (locResult == null)) {
	var method = "loc";
}

// now, process with the chosen method

if (method == "ref") {
	var string = document.referrer;
}

else if (method == "loc") {
	var string = window.location.href;
}

var cookieName = "fmSesInfo";
var rawInfo = string;

function fmPopUp() {
	if (rawInfo != null) {
		procInfo = rawInfo.split("?");
		info = procInfo[1];
		popIt();
	}
}

function setCookie() {
	if (document.cookie != document.cookie) {
		var index = document.cookie.indexOf(cookieName);
	}

	else {
		var index = -1;
	}
	
	if (index == -1) {
		document.cookie = "fmSesInfo=" + info + "; path=/";
	}
}

function popIt() {
	setCookie();
	var ieLeft = eval(screen.availWidth - 500); // these 2 set the position for IE
	var ieTop = eval(screen.top + 10);
	var nsX = eval(screen.availWidth - 520); // these 2 set the position for NS
	var nsY = eval(screen.screenY + 10);
	
	if (navigator.appName == "Microsoft Internet Explorer") { // if IE, this one is used
		openWin = window.open("/templates/fmframeset.html", "fmPopUp", config="height=590,width=500,left=" + ieLeft + ",top=" + ieTop + ",resizable=yes,toolbar=yes");
		openWin.document.close()
	}
	
	if (navigator.appName == "Netscape") { // if NS, this one is used
		openWin = window.open("/templates/fmframeset.html", "fmPopUp", config="height=590,width=500,screenX=" + nsX + ",screenY=" + nsY + ",resizable=yes,toolbar=yes");
		openWin.document.close()
	}

	self.name = "main";
}

//-->