// Patch for Popups begin

// Determine the OS, Browser Name, Version, and Renderer

env_OS = get_OS();
env_BrowserName = getBrowserName();
env_BrowserVersion = getBrowserVersion();
env_BrowserRenderer = getBrowserRenderer();

function get_OS(){
	if ( navigator.userAgent.indexOf( "Windows NT 5.1" ) > -1 ){
		return "Win XP";
	}
	if ( navigator.userAgent.indexOf( "Windows NT 5.0" ) > -1 ){
		return "Win 2000";
	}
	if ( navigator.userAgent.indexOf( "Mac OS X" ) > -1 ){
		return "Mac OS X";
	}	
	return "";
}

function getBrowserName(){
	if ( navigator.userAgent.indexOf( "Safari" ) > -1 ){
		return "Safari";
	}
	if ( navigator.userAgent.indexOf( "BonEcho" ) > -1 ){
		return "BonEcho";
	}
	if ( navigator.userAgent.indexOf( "Opera" ) > -1 ){
		return "Opera";
	}
	if ( navigator.userAgent.indexOf( "Netscape" ) > -1 ){
		return "Netscape";
	}
	// do Firefox & IE last because other browsers can use these as a render engine
	if ( navigator.userAgent.indexOf( "Firefox" ) > -1 ){
		return "Firefox";
	}
	if ( navigator.userAgent.indexOf( "MSIE" ) > -1 ){
		return "MSIE";
	}
	return "";
	
}


function getBrowserVersion(){
	// need browser name environment variable before can process this function
	
	// determine MSIE major version
	if ( env_BrowserName == "MSIE" ){
		if ( navigator.userAgent.indexOf( "MSIE 5" ) > -1 ){
			return "5";
		}
		if ( navigator.userAgent.indexOf( "MSIE 6" ) > -1 ){
			return "6";
		}
		if ( navigator.userAgent.indexOf( "MSIE 7" ) > -1 ){
			return "7";
		}
	}
	// determine Netscape major version
	if ( env_BrowserName == "Netscape" ){
		if ( navigator.userAgent.indexOf( "Netscape/7" ) > -1 ){
			return "7";
		}
		if ( navigator.userAgent.indexOf( "Netscape/8" ) > -1 ){
			return "8";
		}
	}
	// determine Firefox major version
	if ( env_BrowserName == "Firefox" ){
		if ( navigator.userAgent.indexOf( "Firefox/1" ) > -1 ){
			return "1";
		}
	}
	// determine BonEcho major version
	if ( env_BrowserName == "BonEcho" ){
		if ( navigator.userAgent.indexOf( "BonEcho/2" ) > -1 ){
			return "2";
		}
	}
	// determine Opera major version
	if ( env_BrowserName == "Opera" ){
		if ( navigator.userAgent.indexOf( "Opera 8" ) > -1 ){
			return "8";
		}
		if ( navigator.userAgent.indexOf( "Opera/9" ) > -1 ){
			return "9";
		}
	}
	// determine Safari major version
	if ( env_BrowserName == "Safari" ){
		if ( navigator.userAgent.indexOf( "Safari/31" ) > -1 ){
			return "1";
		}
		if ( navigator.userAgent.indexOf( "Safari/21" ) > -1 ){
			return "1";
		}
	}
	return "";
	
}


function getBrowserRenderer(){
	// need browser name and version environment variable before can process this function
	if ( env_BrowserName == "Netscape" ){
		if ( env_BrowserVersion == "8" ){
			if ( navigator.userAgent.indexOf( "MSIE" ) > -1 ){
				return "MSIE";
			} else {
				return "Firefox";
			}
		}
	}
	return "";
}

// Patch for Popups end

function openPopUp(whichDoc,w,h) {
if (navigator.platform.indexOf("Mac") > -1){
//w = w - 15
h = h-35
}

thisTarget ="ScarePairPop";

paramList = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0," + ",width=" + w + ",height=" + h;

window.open(whichDoc,thisTarget,paramList);	
	
}

function swopenPopUp(whichDoc,w,h,scroll) {
thisTarget ="SWPopWin";
if (navigator.platform.indexOf("Mac") > -1){

	w = w + 15
	h = h + 15
}
if (scroll == 1)
{
paramList = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0," + ",width=" + w + ",height=" + h;
}
else
{
paramList = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0," + ",width=" + w + ",height=" + h;
}

window.open(whichDoc,thisTarget,paramList);	
}
