		winLeft = 100 ;
		winTop = 100;
		masterProps =   "location=no,menubar=yes,scrollbars=yes,toolbar=no,resizable=yes,status=yes,left="
		scrollNoSatus = "location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes,status=yes,left="
		noTrim =        "location=no,menubar=no,scrollbars=no,toolbar=no,resizable=yes,status=yes,left="
		
		var here = window.location.href
		var popWinLoc = (here.toLowerCase().indexOf("pccu") == -1) && (here.toLowerCase().indexOf("providentcu") == -1) ? "http://providentcu.org" : "";
		
		if(screen) {
			var screenHeight=screen.availHeight; 
			var screenWidth=screen.availWidth;
		} else {
			screenWidth = 800;
			screenHeight = 600;
		}
		

		function centerWin(thisWinWidth,thisWinHeight) {
			// for centering new window, if browser supports it.
			winLeft = ((screenWidth - thisWinWidth)/2 - 5); 
			winTop = ((screenHeight - thisWinHeight)/2  - 80);
			if (screenHeight-104 < thisWinHeight) {
				thisWinHeight = screenHeight - 140;
				winTop = winTop + 40 
			}
		}

		function popupWin(URL,winWidth,winHeight) {
		   	winURL = popWinLoc + "/ExternalWindowFS.html?" + URL;
		   	if(arguments.length != 3) {
				winWidth = 780;
				winHeight = 500;
		   	}
			centerWin(winWidth,winHeight);
			
			var windowprops = masterProps;
			windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			popup = window.open(winURL,"External",windowprops);
			if(popup){
				popup.focus();
			} else {
				if(winWidth && winHeight) 
				top.popUpFailed(URL,"popupWin('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
				else
				top.popUpFailed(URL,"popupWin('" + URL + "'); return false;")
			}
		}

		//function popupCoBrandedWin(URL,winWidth,winHeight) {
		//   	if(arguments.length != 3) {
		//		winWidth = 780;
		//		winHeight = 500;
		//   	}
		//	centerWin(winWidth,winHeight);
		//	
		//	var windowprops = scrollNoSatus;
		//	windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
		//	popup = window.open(URL,"External",windowprops);
		//	if(popup){
		//		popup.focus();
		//	} else {
		//		if(winWidth && winHeight) 
		//		top.popUpFailed(URL,"popupCoBrandedWin('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
		//		else
		//		top.popUpFailed(URL,"popupCoBrandedWin('" + URL + "'); return false;")
		//	}
		//}

		function popupEscapableWin(URL,winWidth,winHeight) {
			winURL = popWinLoc + "/ExternalWindowEscFrameFS.html?" + escape(URL);
		   	if(arguments.length != 3) {
				winWidth = 800;
				winHeight = 500;
		   	}
			centerWin(winWidth,winHeight);
			
			var windowprops = masterProps;
			windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			popup = window.open(winURL,"External",windowprops);
			if(popup){
				popup.focus();
			} else {
				if(winWidth && winHeight) 
				top.popUpFailed(URL,"popupEscapableWin('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
				else
				top.popUpFailed(URL,"popupEscapableWin('" + URL + "'); return false;")
			}
		}
		
		function popupIRA_Center(URL,winWidth,winHeight) {
			winURL = popWinLoc + "/IRA_Center.html?" + URL;
		   	if(arguments.length != 3) {
				winWidth = 800;
				winHeight = 500;
		   	}
			centerWin(winWidth,winHeight);
			
			var windowprops = masterProps;
			windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			popup = window.open(winURL,"External",windowprops);
			if(popup){
				popup.focus();
			} else {
				if(winWidth && winHeight) 
				top.popUpFailed(URL,"popupIRA_Center('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
				else
				top.popUpFailed(URL,"popupIRA_Center('" + URL + "'); return false;")
			}
		}
		
		function popupProvPlus(URL,winWidth,winHeight) {
			winURL = popWinLoc + "/Leaving_to_Provident_Plus.html?" + URL;
		   	if(arguments.length != 3) {
				winWidth = 800;
				winHeight = 500;
		   	}
			centerWin(winWidth,winHeight);
			
			var windowprops = masterProps;
			windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			popup = window.open(winURL,"ProvPlus",windowprops);
			if(popup){
				popup.focus();
			} else {
				if(winWidth && winHeight) 
				top.popUpFailed(URL,"popupProvPlus('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
				else
				top.popUpFailed(URL,"popupProvPlus('" + URL + "'); return false;")
			}
		}
		
		function popupBrandedWin(URL,winWidth,winHeight) {
		   	winURL = popWinLoc + "/ExternalBrandedWindowFS.html?" + URL;
		   	if(arguments.length != 3) {
				winWidth = 780;
				winHeight = 500;
		   	}
			centerWin(winWidth,winHeight);
			
			var windowprops = masterProps;
			windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			popup = window.open(winURL,"External",windowprops);
			if(popup){
				popup.focus();
			} else {
				if(winWidth && winHeight) 
				top.popUpFailed(URL,"popupBrandedWin('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
				else
				top.popUpFailed(URL,"popupBrandedWin('" + URL + "'); return false;")
			}
		}
		
		function popupCoBrandedWin(URL,winWidth,winHeight) {
		   	winURL = popWinLoc + "/ExternalBrandedEscFrameFS.html?" + URL;
		   	if(arguments.length != 3) {
				winWidth = 780;
				winHeight = 500;
		   	}
			centerWin(winWidth,winHeight);
			
			var windowprops = masterProps;
			windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			popup4 = window.open(winURL,"External",windowprops);
			if(popup4){
				popup4.focus();
			} else {
				if(winWidth && winHeight) 
				top.popUpFailed(URL,"popupCoBrandedWin('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
				else
				top.popUpFailed(URL,"popupCoBrandedWin('" + URL + "'); return false;")
			}
		}

		//var popup4
		function popupProvWin(URL,winWidth,winHeight) {
			if(arguments.length != 3) {
				winWidth = 780;
				winHeight = 500;
			}
			centerWin(winWidth,winHeight);
			
			var windowprops = scrollNoSatus;
			windowprops += winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			popup4 = window.open(URL,"SizedExternal",windowprops);
			if(popup4){
				popup4.focus();
			} else {
				atPoPu = URL.split("?")[0]
				atPoPu = atPoPu.substr(atPoPu.length - 15)
				if(top.attemptedPopUp == atPoPu){
					buttons = "<a href=\"" + URL + "\" class=\"button default\" title=\"Click here to try again\" onclick=\"hideDetails(); top.attemptedPopUp = ''; popupProvWin('" + URL + "'," + winWidth + "," + winHeight + "); return false;\"><span>Try Again<"+"/span><"+"/a> <a href=\"#\" onclick=\"hideDetails(); top.attemptedPopUp = ''; return false;\" class=\"button\" title=\"Cancel this action\"><span>Cancel<"+"/span><"+"/a>"
					top.popDetails("/AFrames/AccessAccounts/AccountManager/popUpInstructions.asp","iframe",420,470,buttons,false)
				} else {
					top.attemptedPopUp = atPoPu; // not ready for prime time yet?
					if(winWidth && winHeight) 
					top.popUpFailed(URL,"popupProvWin('" + URL + "'," + winWidth + "," + winHeight + "); return false;")
					else
					top.popUpFailed(URL,"popupProvWin('" + URL + "'); return false;")
				}
			}
		}

		function changePage(ref) {
		  if (ref.options[ref.selectedIndex].value != ' ') {
		  	selectedValue = ref.options[ref.selectedIndex].value;
			ref.options.selectedIndex = 0;
		  	window.location.href = selectedValue;
		  }
		}
		function popFromMenu(ref,winWidth,winHeight,embed) {
		  if (ref.options[ref.selectedIndex].value != ' ' && ref.options[ref.selectedIndex].value != 'select') {
		  	selectedValue = ref.options[ref.selectedIndex].value;
			ref.options.selectedIndex = 0;
			if(embed) popDetails(selectedValue,"iframe",winWidth,winHeight);
		  	else popupProvWin(selectedValue,winWidth,winHeight) ;
		  }
		}

		function efaq(faqID,winWidth,winHeight){
			centerWin(winWidth,winHeight);
			
			var windowprops = scrollNoSatus + winLeft + ",top=" + winTop + ",width=" + winWidth + ",height=" + winHeight;
			//efaqPopup = window.open("/AFrames/Directory/EMail/newResultpageSmall.html","Answer",windowprops);
			efaqPopup = window.open("https://efaq.providentcu.org/eFAQ/ASPtemplates/newResultpageSmall.asp?FAQList=2;&GRADE=3.5&Question=" + faqID,"Answer",windowprops);
			efaqPopup.focus();
		}		
		
		function toDOM(HTMLstring) {
			var d = document.createElement('div');
			d.innerHTML = HTMLstring;
			var docFrag = document.createDocumentFragment();
			
			while (d.firstChild) {
				docFrag.appendChild(d.firstChild)
			}
			return docFrag;
		}
		


//mark the root element with browser info:

var user_agent = "" + navigator.userAgent;
var specialCSS = ""

IsMac = user_agent.match(/Mac OS X/i)
IsIE = user_agent.match(/msie \d/i)
IsIE6 = user_agent.match(/msie 5/i) || user_agent.match(/msie 6/i);
IsIE7 = user_agent.match(/msie 7/i)
IsIE8 = user_agent.match(/msie 8/i)
IsIE9 = user_agent.match(/msie 9/i)
IsSafari = user_agent.match(/webkit/i)
IsChrome = user_agent.match(/chrome\//i)
IsFireFox = user_agent.match(/gecko/i) && !IsSafari && !IsIE
IsMobile = user_agent.match(/mobile/i)
if (IsMac) { 
	specialCSS = specialCSS + "mac "
} else {
	specialCSS = specialCSS + "NOT_mac "
}
if (IsSafari) {
	specialCSS = specialCSS + "safari "
	
	WKversion = parseInt(user_agent.replace(/.*AppleWebKit\/([^.]+)\..*/i,"$1"))
	// WKversion > 500 = Safari 3+
	// WKversion > 525 = Safari 3.1+
	// WKversion > 526 = Safari 4+
	if (WKversion > 500) specialCSS = specialCSS + "safari3Plus "
	if (WKversion > 526) specialCSS = specialCSS + "safari4Plus "
	specialCSS = specialCSS + "NOT_ie "
	specialCSS = specialCSS + "NOT_ie6 "
} else {
	specialCSS = specialCSS + "NOT_safari "
	if (IsIE) {
		specialCSS = specialCSS + "ie "
		if (IsIE6) { 
			specialCSS = specialCSS + "ie6 "
		} else {
			specialCSS = specialCSS + "NOT_ie6 "
		}
		if (IsIE7) specialCSS = specialCSS + "ie7 "
		if (IsIE8) specialCSS = specialCSS + "ie8 "
		if (IsIE9) specialCSS = specialCSS + "ie9 "
		if (IsIE7 || IsIE8 || IsIE9) specialCSS = specialCSS + "ie7Plus "
		if (IsIE8 || IsIE9) specialCSS = specialCSS + "ie8Plus "
		if (IsIE7 || IsIE8) specialCSS = specialCSS + "ie7-8 "
		if (IsIE6 || IsIE7 || IsIE8) specialCSS = specialCSS + "ie6-8 "
	} else {
		specialCSS = specialCSS + "NOT_ie "
		specialCSS = specialCSS + "NOT_ie6 "
		if (IsFireFox) specialCSS = specialCSS + "FF "
	}
}

//var viewportMeta = top.document.getElementById("viewportMeta");
//if(!viewportMeta) viewportMeta = top.document.getElementsByTagName("meta")[0];
if (IsMobile) {
	specialCSS = specialCSS + "mobile ";
	//document.addEventListener('gesturechange', function(event) {
	// 	event.preventDefault();
	//	viewportMeta.setAttribute("content", "minimum-scale=" + (event.scale - .001) + ", maximum-scale=" + (event.scale + .001) + ";", false); 
	//}, false);
	//document.addEventListener('gestureend', function(event) {
	//  	event.preventDefault();
	//	viewportMeta.setAttribute("content", "minimum-scale=1.0, maximum-scale=1.0;", false); 
	//}, false);
}

var rootEl = (document.documentElement) ? document.documentElement : document.getElementsByTagName("HTML")[0]
if (rootEl.className == "") {
	rootEl.className = specialCSS + "hasJS"
}
