var popUpWindow, sTitle;
	
function openPopUp(sItem, sURL) {
	
	var sPopupWindowOptions= "width=530,height=474,toolbar=yes,location=no,status=yes,resizable=yes,top=100,left=150";
	//For Spanish Site 
	var isSPA=0;
	
	switch (sItem) {
		case "ABOUTUS":
			//sURL= sURL+ "popup/default.asp?popup=ABOUTUS";
			sURL=sURL+"Default.aspx";
			break;
		case "CONTACTUS":
			
			sURL= sURL+ "popup/default.asp?popup=CONTACTUSB2B";
			//sURL= sURL+ "popup/default.aspx?popup=CONTACTUSB2B";
			//sURL= sURL+ "default.aspx";
			break;
		case "CONTACTUSEMITS":
			sURL= sURL+ "popup/default.asp?popup=CONTACTUSEMITS";
			break;
		case "CONTACTUSCSAG":
			sURL= sURL+ "popup/default.asp?popup=CONTACTUSCSAG";
			break;
		case "PRIVACY":
			
			//sURL= sURL+ "popup/default.asp?popup=PRIVACY";
			sURL= sURL+ "default.aspx?pid=oc\\PrivacyPolicy";
			sPopupWindowOptions= "width=766,height=500,scrollbars=yes,toolbar=yes,location=no,status=no,resizable=yes,top=50,left=100";

			break;
		case "IDNOTICE":
			//sURL= sURL+ "popup/default.asp?popup=IDNOTICE";
			sURL= sURL+ "default.aspx?pid=oc\\CustomerIDNotice";
			sPopupWindowOptions= "width=766,height=500,scrollbars=yes,toolbar=yes,location=no,status=no,resizable=yes,top=50,left=100";

			break;
		case "SECURITY":
			//sURL= sURL+ "popup/default.asp?popup=SECURITY";
			sURL= sURL+ "default.aspx?pid=oc\\SecurityPolicy";
			sPopupWindowOptions= "width=766,height=500,scrollbars=yes,toolbar=yes,location=no,status=no,resizable=yes,top=50,left=100";

			break;
		case "CAREERS":
			//sURL= sURL+ "popup/default.asp?popup=CAREERS";
			//sURL= sURL+ "/careers/default.asp";
			sURL= sURL+ "default.aspx?pid=ca\\Default";
			sPopupWindowOptions= "width=766,height=500,scrollbars=yes,toolbar=yes,location=no,status=no,resizable=yes,top=50,left=100";

			//sPopupWindowOptions= "toolbar=yes,location=no,status=no,resizable=yes,top=50,left=100";
			break;
		case "LICENSING":
			//sURL= sURL+ "popup/default.asp?popup=LICENSING";
			sURL=sURL+"default.aspx?pid=oc\\LicensingDisclosure";
			break;
		case "TERMSOFUSE":
			//sURL= sURL+ "popup/default.asp?popup=TERMSOFUSE";
			sURL=sURL+"default.aspx?pid=oc\\WebsiteTermsofUse";
			break;
		case "SITEFEEDBACK":
			sURL= sURL+ "popup/default.asp?popup=SITEFEEDBACKB2B";
			break;
		case "WHERENOW":
			sURL= sURL+ "popup/default.asp?popup=WHERENOW";
			break;			
		case "PRODUCTS":
			sURL= sURL+ "popup/default.asp?popup=PRODUCTS";
			break;
		case "JUMBO":
			sURL= sURL+ "popup/default.asp?popup=JUMBO";
			break;
		case "SUBPRIME":
			sURL= sURL+ "popup/default.asp?popup=SUBPRIME";
			break;
		case "RATES":
			sURL= sURL+ "popup/default.asp?popup=RATES";
			sPopupWindowOptions= "width=530,height=590,toolbar=yes,location=no,status=yes,resizable=yes,top=50,left=150";
			break;
		case "LIVEHELP":
			sURL= sURL+ "popup/default.asp?popup=LIVEHELP";
			break;
		case "QP":
			sURL= sURL+ "popup/default.asp?popup=QP";
			break;
		case "DU":
			sURL= sURL+ "popup/default.asp?popup=DU";
			break;
		case "PAYPOWER":
			sURL= sURL+ "popup/default.asp?popup=PAYPOWER";
			break;
		case "FULLDOCEXPRESS":
			sURL= sURL+ "popup/default.asp?popup=FULLDOCEXPRESS";
			break;
		case "FASTFORWARD":
			sURL= sURL+ "popup/default.asp?popup=FASTFORWARD";
			break;
		case "EMITS":
			sURL= sURL+ "popup/default.asp?popup=EMITS";
			break;
		case "DESKTOP":
			sURL= sURL+ "B2BAuto/emits/clickLoan.html";
			sPopupWindowOptions= "width=450,height=400,toolbar=no,location=no,status=no,menubar=no,resizable=yes,top=50,left=100";
			break;
		case "SPANISH":
			//8-17-04	RCS - Popup window to access Spanish Site
			//Purpose of Change: JDI - www.zonahipotecaria.com
			//Updated by: Kalpana Khedkar
			//Date: 11/16/2004
			//Logic: Added the popup parameter in the SPA querystring
			isSPA=1;
			sURL= sURL + "/spanish/default.asp?popup=1";
			sPopupWindowOptions= "width=810,height=600,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,top=50,left=100";
			break;		
		case "SPANISHBANNER":
			isSPA=1;
			sPopupWindowOptions= "width=810,height=600,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,top=50,left=100";
			break;
		case "LTFB":
			sPopupWindowOptions= "width=810,height=625,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,top=50,left=100";			
			break;
		case "LOTLOANS":
			sPopupWindowOptions= "width=810,height=625,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,top=50,left=100";			
			break;
		case "NONPRIME":
			sPopupWindowOptions= "width=810,height=625,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,top=50,left=100";			
			break;
		case "WAREHOUSE":
			sPopupWindowOptions= "width=810,height=625,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,top=50,left=100";			
			break;
		case "HELOC":
			sPopupWindowOptions= "width=810,height=625,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,top=50,left=100";			
			break;			
	}
	
	if(isSPA==1){
	  var spaPopUP= open(sURL,'spanish',sPopupWindowOptions);
	  spaPopUP.focus();
	if(spaPopUP.closed){
	  var spaPopUP= open(sURL,'spanish',sPopupWindowOptions);
	  spaPopUP.focus();
	}
	}
	else{
	 popUpWindow= window.open(sURL,'',sPopupWindowOptions);
	} 
}

function launchGlossary(here, sURL) {
	var where;
	where=sURL+"b2bauto/glossary/glossary_index.asp?goto="+here;
	newWind=window.open(where,"newWindow","status=no,toolbar=no,scrollbars=yes,directories=no,location=no,resize=on,width=530,height=320")
	newWind.focus();
}


function getCookie(sName) {
	// cookies are separated by & when set by vbscript in asp
	var aCookie = document.cookie.split("&");
	for (var i=0; i < aCookie.length; i++)
	{
		// a name/value pair (a crumb) is separated by an equal sign
		var aCrumb = aCookie[i].split("=");
		if (sName == aCrumb[0]) {
		  return unescape(aCrumb[1]);
		}
	}

	// a cookie with the requested name does not exist
	return null;
}

/* OLD Way
function loadOpener(sURL, target) {
     parent.window.opener.location = sURL;
    //parent.window.opener.top.location = sURL;
    parent.window.opener.top.focus();
    parent.window.close();
   
}
*/

function loadOpener(sURL, beMITS) {
	if (beMITS) {
		window.opener.location = sURL;
	}
	else {
		parent.window.opener.top.location = sURL;
	}
    parent.window.opener.top.focus();
    parent.window.close();
}

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function gotoPage(value)
{
	//parent.location.href = value;
	strURL=encodeURI(window.parent.location) + ""
	parent.location.href = "/include/SetCookie.asp?"+"ST="+value+"&url="+strURL
}


//RCS - Spanish Micro-site Helper functions

//Purpose of Change: JDI - www.zonahipotecaria.com
//Updated by: Kalpana Khedkar
//Date: 11/16/2004
//Logic: Added the logic for Zonahipotecaria main site
//Change:Start


function TransferSpaMainSite(sTransferUrl, sTarget,bpopup) {
	var returnVal = window.showModalDialog("/spanish/TransferPopup.asp", null, "dialogHeight:200px; dialogLeft:200px; dialogWidth:520px;help:no; resizable:yes; scroll:no; status:no;");
	if (bpopup != "False") 
	{
	switch (returnVal) {
		case "Direct" :	
			if (sTarget == "_new") {
					window.open(sTransferUrl,'');
				}
			else {
				if(!window.opener.closed)	
				{
				window.opener.location.href = sTransferUrl;
				window.opener.focus();
				}
				else
				{
				var w = window.screen.availWidth;
				var h = window.screen.availHeight;
				var win = window.open(sTransferUrl,'facts','screenX=0,screenY=0,left=0,top=0,width=' + w + ',height=' + h +
				',resizable=1,status=1,menubar=1,toolbar=1,location=1,scrollbars=1');
				win.focus();
				if (!win.closed){
					var win = open (sTransferUrl, 'facts',
					'screenX=0,screenY=0,left=0,top=0,width=' + w + ',height=' + h +
					',resizable=1,status=1,menubar=1,toolbar=1,location=1,scrollbars=1');
					win.focus();
					}
				}
			}
			break;
		default :
	 }
	}
	else
	{
	 switch (returnVal) {
		case "Direct" :	
			var w = window.screen.availWidth;
			var h = window.screen.availHeight;
			var win = open (sTransferUrl, 'facts',
				'screenX=0,screenY=0,left=0,top=0,width=' + w + ',height=' + h +
				',resizable=1,status=1,menubar=1,toolbar=1,location=1,scrollbars=1');
				win.focus();
				if (!win.closed){
					var win = open (sTransferUrl, 'facts',
					'screenX=0,screenY=0,left=0,top=0,width=' + w + ',height=' + h +
					',resizable=1,status=1,menubar=1,toolbar=1,location=1,scrollbars=1');
					win.focus();
					}
			break;
		default :
	 }
	}
}

//To open th English link in the spanish site
function MainWindow(sTransferUrl)
{
	var w = window.screen.availWidth;
	var h = window.screen.availHeight;
	var newwin = open (sTransferUrl, 'facts',
		'screenX=0,screenY=0,left=0,top=0,width=' + w + ',height=' + h +
		',resizable=1,status=1,menubar=1,toolbar=1,location=1,scrollbars=1');
	if (newwin && !newwin.closed){
		newwin.focus();
	}
}
//Change:End