
	

var allContinueButtons;
var timeoutID=0;
var amountchange=true;
function goToPage(action, method){
		var methodParam = action.indexOf("method=");
		var param = action.indexOf("?");
		if (methodParam == -1)
		{
			if (param != -1)
			{
				action = action + "&method=" + method;
			} else {
				action = action + "?method=" + method;
			}
		}
		couponExitSite = false;
		document.forms[document.forms.length-1].action = action;
		document.forms[document.forms.length-1].method.value = method;
		document.forms[document.forms.length-1].target="_parent";
		document.forms[document.forms.length-1].submit();
	}


	function goToPageSetIframeTarget(action, method,countryCode){
		var methodParam = action.indexOf("method=");
		var param = action.indexOf("?");
		var language = document.forms[document.forms.length-1].languageCode.value;
		if (methodParam == -1)
		{
			if (param != -1)
			{
				action = action + "&method=" + method;
			} else {
				action = action + "?method=" + method;
			}
		}
		
		if ((typeof(countryCode) == "undefined") || (isNum(countryCode)))
		{
		} else {
			if('US' != countryCode) {
				document.forms[0].countryCode.value = countryCode;
				document.forms[0].action = action;
			} else {
				document.forms[0].action = action + "&countryCode=US&languageCode="+ language;
			}
		}
		
		document.forms[0].method.value = method;
		if (document.forms[0].MTshortFlow != null)
		{
			document.forms[0].MTshortFlow.value = null;
		}
		document.forms[0].target='_parent';
		document.forms[0].submit();
	}



	function popUpWindow(theURL) { 
		window.open(theURL);
	}
	
	function isEnterKeyPressed(event){
		var key=event.keyCode || event.which;
		if (key==13){
			return true;
			}
		return false;	
	}

	function staticLink(pagename, target, promoPageFlag)
	{
		var httpPos = pagename.indexOf("http://");
		var httpWWW = pagename.indexOf("www.");
		var httpsPos = pagename.indexOf("https://");		
		var defaultTarget = "_top";
		if(httpPos!=-1 || httpWWW!=-1 || httpsPos!=-1)
		{
			if(null != target && target==defaultTarget){
				top.window.location=pagename;
			}else {
				newWindow = window.open(pagename, "WesternUnion" , "scrollbars=yes,toolbar=1,menubar=1,resizable=1,dependent=0,status=0,width=600,height=600,left=50,top=50");		
			}
		}
		else
		{
			var countryCodePosition = pagename.indexOf("countryCode");
			if(countryCodePosition!=-1){
				var countryCode = pagename.substring(countryCodePosition+12,countryCodePosition+14);
				document.forms[0].countryCode.value=countryCode;
			}
			
			var languageCodePosition = pagename.indexOf("languageCode");
			if(languageCodePosition!=-1){
				var languageCode = pagename.substring(languageCodePosition+13,languageCodePosition+15);
				document.forms[0].languageCode.value=languageCode;
			}
			
	
			var separatorPosition = pagename.indexOf("&");
			
			var flowName = pagename.indexOf("d2bFlow");
			
			var pagenamePosition = pagename.indexOf("pagename");		
				var pagename = pagename.substring(pagenamePosition + 9, pagename.length);
			document.forms[0].method.value="load";			
			
			try {
			document.forms[0].PAGE_NAME.value=pagename;
			} catch(err) {}
			document.forms[0].action="/WUCOMWEB/staticMid.do"+"?method=load&pagename="+pagename;
			document.forms[0].target=defaultTarget;
			document.forms[0].submit();
		}
	}
	
	
	
	function popUpLink(pagename)
	{		
		couponExitSite = false;
	    var infoNowAgentLocatorActive = true;
	
	    if (pagename.toLowerCase().indexOf("agentlocatorlookup") != -1) {
	        if (infoNowAgentLocatorActive) {
	            agentLocatorLink();
	            return;
	        }
		    pagename = pagename.replace('?','&')
		}

		if (pagename.toLowerCase().indexOf("convpay") != -1) {
			var language = document.forms[0]["languageCode"].value;
			if (language == null) {
			   language = getValueByName("languageCode")
			}
			if (language == null) language = "en"
			var link = '/info/convPay.asp?POPUP=true&PAGE_NAME=info/osCP&language=' + language 
			newWindow = window.open(link, 'terms','scrollbars=yes,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=600,height=700,left=50,top=50');
			return;
		}
	
		var httpPos = pagename.indexOf("http://");
		var httpWWW = pagename.indexOf("www.");
		var httpsPos = pagename.indexOf("https://");
		var webinfPos= pagename.indexOf("web-inf");
		
		if (webinfPos!=-1)
		{
			var targetURL = window.document.URL.substring(0,window.document.URL.lastIndexOf('/')); 
			targetURL = window.document.URL.substring(0,targetURL.lastIndexOf('/'));
			URL = targetURL+ pagename;
			newWindow = window.open(URL, 'WesternUnion','scrollbars=yes,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=600,height=700,left=50,top=50');			
		}
		else
		{		
		if(httpPos!=-1 || httpWWW !=-1 || httpsPos!=-1 )
		{
			if(httpPos!=-1 || httpsPos!=-1 )	
				window.open(pagename, "WesternUnion" , "scrollbars=yes,toolbar=1,menubar=1,resizable=1,dependent=0,status=0,width=600,height=600,left=50,top=50");		
			else {
				window.open("http://"+pagename, "WesternUnion" , "scrollbars=yes,toolbar=1,menubar=1,resizable=1,dependent=0,status=0,width=600,height=600,left=50,top=50");		
			}
		}
		else
		{
			var prefix = pagename.indexOf("pagename=");
			if (-1 != prefix)
			{
				pagename = pagename.substring(prefix + 9);
			}
			var countryCode = pagename.indexOf("countryCode");
			
			if(document.forms[0].countryCode[0]!=null)
			{
				if(countryCode==-1 && document.forms[0].countryCode[0].value!=null )			
					countryCode = "&countryCode=" + document.forms[0].countryCode[0].value;
				else
					countryCode = "";			
			}
			else
			{
				if(countryCode==-1 && document.forms[0].countryCode.value!=null )			
					countryCode = "&countryCode=" + document.forms[0].countryCode.value;
				else
					countryCode = "";						
			}
			
			var languageCode = pagename.indexOf("languageCode");
			
			if(document.forms[0].languageCode[0]!=null)
			{
				if(languageCode==-1 && document.forms[0].languageCode[0].value!=null)
					languageCode = "&languageCode="+ document.forms[0].languageCode[0].value;
				else
					languageCode = "";
			}
			else
			{
				if(languageCode==-1 && document.forms[0].languageCode.value!=null)
					languageCode = "&languageCode="+ document.forms[0].languageCode.value;
				else
					languageCode = "";
			}			

			var actionPosition = pagename.indexOf(".do");	
			
			if(actionPosition==-1)
				var methodName = "/staticMid.do?method=load&windowType=popup&pagename="+pagename;
								
																
			var targetURL 
			
			if (frames.name == "_center"){
				if(window.top.document.URL.indexOf("&WU_LinkShare") == -1) {
					targetURL = (window.top.document.URL).substring(0,window.top.document.URL.lastIndexOf('/'));
				}else {
					targetURL = (window.top.document.URL).substring(0,window.top.document.URL.indexOf('&WU_LinkShare'));
					targetURL = targetURL.substring(0,targetURL.lastIndexOf('/'));
				}
			}else{
				if(window.document.URL.indexOf("&WU_LinkShare") == -1) {
					targetURL = (window.document.URL).substring(0,window.document.URL.lastIndexOf('/'));
				}else {
					targetURL = (window.document.URL).substring(0,window.document.URL.indexOf('&WU_LinkShare'));
					targetURL = targetURL.substring(0,targetURL.lastIndexOf('/'));
				}
			}
			var URL;
						
			if(actionPosition==-1)
				URL = targetURL + methodName + countryCode +  languageCode ;				
			else
				URL = targetURL + '/' + pagename + '?'+ "method=load" + countryCode +  languageCode ;
			newWindow = window.open(URL, 'WesternUnion','scrollbars=yes,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=600,height=700,left=50,top=50');
			
						
		}	
		}	
	}

	function popUpLink2(pagename)
	{	
		var httpPos = pagename.indexOf("http://");
		var httpWWW = pagename.indexOf("www.");
		var httpsPos = pagename.indexOf("https://");
		var webinfPos= pagename.indexOf("web-inf");
		
		if (webinfPos!=-1)
		{
			var targetURL = window.document.URL.substring(0,window.document.URL.lastIndexOf('/')); 
			targetURL = window.document.URL.substring(0,targetURL.lastIndexOf('/'));
			URL = targetURL+ pagename;
			newWindow = window.open(URL, 'WesternUnion','scrollbars=yes,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=800,height=400,left=50,top=50');			
		}
		else
		{		
		if(httpPos!=-1 || httpWWW !=-1 || httpsPos!=-1 )
		{
			if(httpPos!=-1 || httpsPos!=-1 )	
				window.open(pagename, "WesternUnion" , "scrollbars=yes,toolbar=1,menubar=1,resizable=1,dependent=0,status=0,width=800,height=400,left=50,top=50");		
			else {
				window.open("http://"+pagename, "WesternUnion" , "scrollbars=yes,toolbar=1,menubar=1,resizable=1,dependent=0,status=0,width=800,height=400,left=50,top=50");		
			}
		}
		else
		{
			var prefix = pagename.indexOf("pagename=");
			if (-1 != prefix)
			{
				pagename = pagename.substring(prefix + 9);
			}

			var countryCode = pagename.indexOf("countryCode");
			
			if(document.forms[0].countryCode[0]!=null)
			{
				if(countryCode==-1 && document.forms[0].countryCode[0].value!=null )			
					countryCode = "&countryCode=" + document.forms[0].countryCode[0].value;
				else
					countryCode = "";			
			}
			else
			{
				if(countryCode==-1 && document.forms[0].countryCode.value!=null )			
					countryCode = "&countryCode=" + document.forms[0].countryCode.value;
				else
					countryCode = "";						
			}
			
			var languageCode = pagename.indexOf("languageCode");
			
			if(document.forms[0].languageCode[0]!=null)
			{
			if(languageCode==-1 && document.forms[0].languageCode[0].value!=null)
				languageCode = "&languageCode="+ document.forms[0].languageCode[0].value;
			else
				languageCode = "";
			}
			else
			{
			if(languageCode==-1 && document.forms[0].languageCode.value!=null)
				languageCode = "&languageCode="+ document.forms[0].languageCode.value;
			else
				languageCode = "";
			}			

			var actionPosition = pagename.indexOf(".do");	
			
			if(actionPosition==-1)
				var methodName = "/staticMid.do?method=load&windowType=popup&pagename="+pagename;
								
																
			var targetURL;
			
			if (frames.name == "_center"){
				if(window.top.document.URL.indexOf("&WU_LinkShare") == -1) {
					targetURL = (window.top.document.URL).substring(0,window.top.document.URL.lastIndexOf('/'));
				}else {
					targetURL = (window.top.document.URL).substring(0,window.top.document.URL.indexOf('&WU_LinkShare'));
					targetURL = targetURL.substring(0,targetURL.lastIndexOf('/'));
				}
			}else{
				if(window.document.URL.indexOf("&WU_LinkShare") == -1) {
					targetURL = (window.document.URL).substring(0,window.document.URL.lastIndexOf('/'));
				}else {
					targetURL = (window.document.URL).substring(0,window.document.URL.indexOf('&WU_LinkShare'));
					targetURL = targetURL.substring(0,targetURL.lastIndexOf('/'));
				}
			}

			var URL;
						
			if(actionPosition==-1)
				URL = targetURL + methodName + countryCode +  languageCode ;				
			else
				URL = targetURL + '/' + pagename + '?'+ "method=load" + countryCode +  languageCode ;
														
			newWindow = window.open(URL, 'WesternUnion','scrollbars=no,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=800,height=400,left=50,top=50');
			
						
		}	
		}	
	}

	function popUp (pagename,country,language) {
        var	countryCode = "&countryCode=" + country;
		var	languageCode = "&languageCode=" + language;
		var actionPosition = pagename.indexOf(".do");							
		var URL;
		var targetURL = window.document.URL.substring(0,window.document.URL.lastIndexOf('?'));
		targetURL = targetURL.substring(0,targetURL.lastIndexOf('?'));
		targetURL = targetURL.substring(0,targetURL.lastIndexOf('/'));
		URL = targetURL + '/html/Country/'+ country +'/'+pagename + '?'+ "method=load" + countryCode +  languageCode;
											
		
		newWindow = window.open(URL, 'WesternUnion','scrollbars=yes,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=600,height=700,left=50,top=50');
		
	}	
	
	function tncPopUp (pagename,country,language,width,height) {
	    var	countryCode = "&countryCode=" + country;
		var	languageCode = "&languageCode=" + language;
		var actionPosition = pagename.indexOf(".do");							
		var URL;		
		var valueURL = window.document.URL;
		var targetURL = 0;		
		var index=window.document.URL.lastIndexOf('?');
		if(index!=-1){
			targetURL = window.document.URL.substring(0,window.document.URL.lastIndexOf('?'));
			if(targetURL.lastIndexOf('?') != -1)
				{
					targetURL = targetURL.substring(0,targetURL.lastIndexOf('?'));
				}
			if(targetURL.lastIndexOf('/') != -1)
				{
				targetURL = targetURL.substring(0,targetURL.lastIndexOf('/'));
				}
		}else
		{	
			targetURL = valueURL;
			targetURL = targetURL.substring(0,targetURL.lastIndexOf('/'));	
		}
		URL = targetURL + '/html/Country/'+ country +'/'+language +'/'+pagename; 
	    if (height == null)
	       height = 700
	       
	    if (width == null)
	       width = 600
 
  	    newWindow = window.open(URL, 'WesternUnion','scrollbars=yes,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=' + width + ',height=' + height + ',left=50,top=50');
	
	}
	
	function resourceLink(pagename){
		var targetURL = window.document.URL.substring(0,window.document.URL.lastIndexOf('/'));		
	    targetURL = window.document.URL.substring(0,targetURL.lastIndexOf('/'));
		URL = targetURL+ pagename;
		newWindow = window.open(URL, 'WesternUnion','scrollbars=yes,toolbar=0,menubar=0,resizable=1,dependent=0,status=0,width=600,height=700,left=50,top=50');
	}
	
	function countryChange(){
		var url = document.countryLanguageHeaderForm.selectedCountryURL.value;
	   	document.countryLanguageHeaderForm.action = url; 
		var languageCodePosition = url.indexOf("languageCode");
		if(languageCodePosition!=-1){
			var language = url.substring(languageCodePosition+13,languageCodePosition+15);
		}
		document.countryLanguageHeaderForm.languageCode.value = language;
    	document.countryLanguageHeaderForm.submit();
    }
    
    function MTSenderCountryChange(){
    	var url = document.MTSelectOnlineActionForm.sendOnlineCountryURL.value;
  	   	document.MTSelectOnlineActionForm.action=url;
	    var languageCodePosition = url.indexOf("languageCode");
		if(languageCodePosition!=-1){
			var language = url.substring(languageCodePosition+13,languageCodePosition+15);
		}
		document.MTSelectOnlineActionForm.languageCode.value = language;
    	document.MTSelectOnlineActionForm.submit();
    }
	
	function showConfirmEmail() {
		document.getElementById('confirmEmailDiv').style.display = "block";
		if (document.forms[1]["nameTemplateVO.emailConfirm"] != null)
		{	
			document.forms[1]["nameTemplateVO.emailConfirm"].value='';
		}
		
	}

function isNum(argvalue) {
argvalue = argvalue.toString();

if (argvalue.length == 0)
return false;

for (var n = 0; n < argvalue.length; n++)
if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
return false;

return true;
}

function getCountryName(country) {
	var countryNames = new Array()
	countryNames["NZ"] = "NEW ZEALAND";
	countryNames["GB"] = "UNITED KINGDOM";
	countryNames["CA"] = "CANADA";
	countryNames["US"] = "UNITED STATES";
	return countryNames[country];
}

	function loadPriceShopper(){
		document.forms[0].action = "/WUCOMWEB/priceShopperRedirectAction.do?method=load";
		document.forms[0].submit();
	}

function agentLocatorLink(zip) {

    var params = 'pagename=agentLocator'
    if (zip !=null) 
       params += "&zipCode="+ zip
       
    staticLink(params);
}

function htmlSecureTrim(text) {
	var encodedText = unescape(text);
	
	encodedText = encodedText.replace(new RegExp(";", "g"), "&#59;");
	encodedText = encodedText.replace(/\(/g, "&#40;");
	encodedText = encodedText.replace(/\)/g, "&#41;");
	encodedText = encodedText.replace(new RegExp(">", "g"), "&gt;");
	encodedText = encodedText.replace(new RegExp("<", "g"), "&lt;");
	encodedText = encodedText.replace(new RegExp("\"", "g"), "&quot;");
	
	return encodedText;
}
function clearValueByName(name) {
  done = false;
  for (fnum=0;fnum<document.forms.length;fnum++) {
    for(i=0;i<document.forms[fnum].length;i++) {
	   if (document.forms[fnum][i].name == name) {
	      document.forms[fnum][i].value = ""
	      done = true
		  break;
       }
    }  
     
    if (done)   break;
  }  
}						

function resizeIframe() {
	i = parent.document.getElementById(window.name);
	if (i != null) {
	iHeight = document.documentElement.scrollHeight;
		if (iHeight == 0) {
		iHeight = i.contentDocument.body.scrollHeight; 
	}
	i.style.height = iHeight + 0 + "px";
	}
}
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	for (i = 0, j = 0; i < elsLen; i++) {		
		if(els[i].className == searchClass){
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
function disableDiv(obj){
	if(obj.parentNode.className=="btnContinueFXDisabled")
	return false;
    var funcToBeInvoked=obj.href;	
	obj.parentNode.className="btnContinueFXDisabled";
	var isJavaScriptThere=funcToBeInvoked.indexOf("javascript:");
	if(isJavaScriptThere != -1){
		funcToBeInvoked=funcToBeInvoked.substring(11,funcToBeInvoked.length);
	}else{
		isJavaScriptThere=funcToBeInvoked.indexOf("JavaScript:");
		if(isJavaScriptThere != -1){
			funcToBeInvoked=funcToBeInvoked.substring(11,funcToBeInvoked.length);
		}
	}
	var defaultMethodName="";
	var nameOfTheForm;
	var iframe;
	if(null != document.getElementById("iframecheck"))
	{
	 iframe = document.getElementById("iframecheck").value;
	}
	
	if (iframe == "true")
		{		
		  nameOfTheForm = "MTActionForm";
		}else{		
		nameOfTheForm=getFormName(obj);
		}
	var defaultMethodNameObj=document.forms[nameOfTheForm].method;
	if(defaultMethodNameObj !=null){
		defaultMethodName=defaultMethodNameObj.value;
	}
	var javaScriptFuncs=funcToBeInvoked.split(";");
	var result="";
	for(var i=0;i<javaScriptFuncs.length;i++){		
		if(javaScriptFuncs[i] != ""){
			result=eval(javaScriptFuncs[i]);   
			if(result == null || result=="undefined" || result==""){
				var changedMethodName="";
				var changedMethodNameObj=document.forms[nameOfTheForm].method;
				if(changedMethodNameObj !=null) 
				{
					changedMethodName=changedMethodNameObj.value;
				}
				if(defaultMethodName == changedMethodName){
					continue;
				}
				else{
					return false;
				}
			}else{
				enableDiv(obj);
				return false;
			}
		}
	}
	enableDiv(obj);
	return false;
}

function getAllContinueButtons(){
      var allContinueButtons=getElementsByClass('btnContinueFX',null,'span');
      return allContinueButtons;
}

function enableDiv(obj){
	obj.parentNode.className="btnContinueFX";
}

function enableDivForAJAX(obj){
	obj.parentNode.className="btnContinueFX";
	return true;
}


function disableDivforAjax(obj){
	obj.parentNode.className="btnContinueFXDisabled";
	return true;
}


function disableContinueButtonsBeforeAJAXCall(){
 var allContinueButtons=getElementsByClass('btnContinueFX',null,'span');
	if(allContinueButtons!= null && allContinueButtons.length > 0){
		for (i = 0 ; i < allContinueButtons.length; i++) {
    		var firstLink=allContinueButtons[i].getElementsByTagName("a")[0]; 
    		disableDivforAjax(firstLink);
   		}
    }
}
function enableContinueButtonsAfterAJAXCall(){
 var allContinueButtons=getElementsByClass('btnContinueFXDisabled',null,'span');
  if(allContinueButtons!= null && allContinueButtons.length > 0){
		for (i = 0 ; i < allContinueButtons.length; i++) {
    		var firstLink=allContinueButtons[i].getElementsByTagName("a")[0]; 
    		enableDivForAJAX(firstLink);
   		}
    }
	hideDiv("loaderText");
}
function addEnableDisableLogicToContinueButtons(){   
	allContinueButtons=getElementsByClass('btnContinueFX',null,'span');
	allContinueDisabledButtons=getElementsByClass('btnContinueFXDisabled',null,'span');
	if(allContinueButtons != null){
			for (i = 0 ; i < allContinueButtons.length; i++) {
			var firstLink=allContinueButtons[i].getElementsByTagName("a")[0];
			firstLink.onclick = function() {disableDiv(this);return false;};
		}
	}
	if(allContinueDisabledButtons != null){
			for (i = 0 ; i < allContinueDisabledButtons.length; i++) {
			var firstLink=allContinueDisabledButtons[i].getElementsByTagName("a")[0];
			firstLink.onclick = function() {disableDiv(this);return false;};
		}
	}
	
	
}

function getFormName(element){
	try{
		var pa=element.parentNode;
		if(pa != null && pa.tagName != null){
			while(pa.tagName.toLowerCase() != "form"){
				pa=pa.parentNode;
			}
		}
		return pa.name;
	}catch(e){
		return "signInActionForm";
	}
}
function isArray(obj) {
  try{
		return (obj.constructor.toString().indexOf("Array") != -1);
	}catch(e){
		return false;
	}
}
function showDiv(obj){
	var foundObj=document.getElementById(obj);
	if(foundObj!=null)
	foundObj.style.display='block';
}

function hideDiv(obj){
	var foundObj=document.getElementById(obj);
	if(foundObj!=null)
	foundObj.style.display='none';
}

function trimAll(sString)
{
	if (null != sString) {
		var a = sString.replace(/^\s+/, '');
		return a.replace(/\s+$/, '');
	}
	return sString;
}

function counterUpdate(opt_countedTextBox, opt_countBody, opt_maxSize) {
        var countedTextBox = opt_countedTextBox ? opt_countedTextBox : "messageText";
        var countBody = opt_countBody ? opt_countBody : "countBody";
        var maxSize = opt_maxSize ? opt_maxSize : 200;
        var field = document.getElementById(countedTextBox);

        if (field && field.value.length >= maxSize) {
                field.value = field.value.substring(0, maxSize);
        }
        var txtField = document.getElementById('countBody');
                if (txtField) { 
				var r=200-field.value.length;
                txtField.innerHTML =r;
        }
}

function delayAmountChange() {
	action="amountchange=false;calculateFees('feecalc','none','"+document.getElementById('sendCurrencyCode').value+"')";
	clearTimeout(timeoutID);
	timeoutID = setTimeout(action, 2000);
} 
function onblurAmountChange() {
if (amountchange == true) {
	action="amountchange=true;calculateFees('feecalc','none','"+document.getElementById('sendCurrencyCode').value+"')";
	clearTimeout(timeoutID);
	timeoutID = setTimeout(action, 0);
	}
} 
var browserName = navigator.appName;

function cancelKey(event) {

keyNum = getKeyCode(event);
	if (browserName == "Netscape") {	
		if (document.getElementById 
		||  document.layers
		&&  keyNum >= 8)
		{
			return false;
		}
    } else {
    	if (document.all 
    	&&  keyNum >= 8)
    	{
			try { event.keyCode = 0; } catch (e) { }
			event.returnValue = false;
		}
    }
    
    function getKeyCode(evt)
{
	if (browserName == "Netscape")
	{
		return evt.which;
	} else {
		return window.event.keyCode;
	}
}
}


function getValueByName(name) {

  for (fnum=0;fnum<document.forms.length;fnum++) {
    for(i=0;i<document.forms[fnum].length;i++) {
	   if (document.forms[fnum][i].name == name) {
	      return document.forms[fnum][i].value 
       }
    } 
  }    
}


var cookieUtils = new function() {

    this.getCookie = function(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;
    }

    this.setCookie = function(name, value, path, days, domain) {
        var cookie = name + "=" + value;
        if (days) {
	        var expDate = new Date();
	        expDate.setDate(expDate.getDate()+parseInt(days));
	        cookie += ";Expires=" + expDate.toGMTString();
        }
        if (domain)
			cookie += ";Domain=" + domain;
        document.cookie = cookie;
        return cookie;
    }

    getCookieVal = function(offset) {
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
            endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
    }

}

var currentURL="novalue";
function enableURL(obj){
                if(currentURL != 'novalue')
                obj.parentNode.parentNode.href=currentURL;
}
function disableURL(obj){
                currentURL=obj.parentNode.parentNode.href;
                obj.parentNode.parentNode.href="#"
}
function openWindow(obj,url){
                var firstParent = obj.parentNode.parentNode.tagName;
                if(firstParent =='A') disableURL(obj);
                   window.open(url,'new','top=100,left=100, height=600, width=800, status=no, menubar=no, resizable=no, scrollbars=yes, toolbar=no, location=no, directories=no');
}

function openRef(obj,hoverOn){

	 var divID=obj.id;
     var divName=obj.getAttribute("name");
     var getDiv="";
     if(hoverOn == 'imagehover'){
     document.getElementById(divID).className="popflashC";
     getDiv=document.getElementById(divID).getElementsByTagName("span");
	 }else{
	 document.getElementById(divID).className="popC";
     getDiv=document.getElementById(divID).getElementsByTagName("span");
	 }
     return getDiv[0].innerHTML;
}

function hideRef(obj,hoverOn){

var divID=obj.id;
var divName=obj.name;
if(hoverOn == 'imagehover'){
document.getElementById(divID).className="popflashB";
}else{
document.getElementById(divID).className="popB";
}
}


