
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
// Function to 'activate' images.
function imgOn(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "_on.src");
        }
}
// Function to 'deactivate' images.
function imgOff(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "_off.src");
        }
}
function changeImages() {
	
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function setActiveModuleButtons(strModuleName){
	eval(strModuleName +  "_off.src=\"../../images/" + strModuleName + "_on_e.gif\""); 
	imgOn(strModuleName + "");
}

function determineModule(){
	// Search the URL for module names. If found, return module name
	strURL = document.location + "";
        if (strURL.indexOf("/getstart/") != -1){
      		return "getstart";	 
        }
        else if (strURL.indexOf("/acctview/") != -1){
      		return "acctview";	 
        }
        else if (strURL.indexOf("/billstf/") != -1){
      		return "billstf";	 
        }
        else if (strURL.indexOf("/profile/") != -1){
      		return "profile";	 
        }
        else if (strURL.indexOf("/imaging/") != -1){
      		return "imaging";	 
        }
        else if (strURL.indexOf("/webdoxs/") != -1){
      		return "webdoxs";	 
        }
         else if (strURL.indexOf("/mtgloan/") != -1){
      		return "mtgloan";	 
        }
            
        else if (strURL.indexOf("/investing/") != -1){
      		return "investing";	 
        }
        else if (strURL.indexOf("/pda/") != -1){
      		return "pda";	 
        }
        else if (strURL.indexOf("/myview/") != -1){
      		return "myview";	 
        }
        else if (strURL.indexOf("/fpdownload/") != -1){
      		return "fpdownload";
      	}
      	else if (strURL.indexOf("/emt/") != -1){
      		return "emt";
      	}
        else return "none";
}

var preloadFlag = false;
function preloadImages() {
	
	if (document.images) {
		
		bnr_vwadv_on = new Image();
		bnr_vwadv_on.src = "../../images/bnr_vwadv_on_e.gif"
		bnr_vwadv_off = new Image();
		bnr_vwadv_off.src = "../../images/bnr_vwadv_off_e.gif"
		
		bnr_vwbas_on = new Image();
		bnr_vwbas_on.src = "../../images/bnr_vwbas_on_e.gif"
		bnr_vwbas_off = new Image();
		bnr_vwbas_off.src = "../../images/bnr_vwbas_off_e.gif"
		
		
		getstart_on = new Image();
		acctview_on = new Image();
		billstf_on = new Image();
		profile_on = new Image();
		imaging_on = new Image();
		
		getstart_off = new Image();
		acctview_off = new Image();
		billstf_off = new Image();
		profile_off = new Image();
		imaging_off = new Image();
		
		getstart_on.src = "../../images/getstart_on_e.gif";
		acctview_on.src = "../../images/acctview_on_e.gif";
		billstf_on.src = "../../images/billstf_on_e.gif";
		profile_on.src = "../../images/profile_on_e.gif";
		imaging_on.src = "../../images/imaging_on_e.gif";
		
		getstart_off.src = "../../images/getstart_off_e.gif";
		acctview_off.src = "../../images/acctview_off_e.gif";
		billstf_off.src = "../../images/billstf_off_e.gif";
		profile_off.src = "../../images/profile_off_e.gif";
		imaging_off.src = "../../images/imaging_off_e.gif";
			
		webdoxs_on = new Image();
		mtgloan_on = new Image();
		investing_on = new Image();
		pda_on = new Image();
		myview_on = new Image();
		fpdownload_on = new Image();
		emt_on = new Image();
				
		webdoxs_off = new Image();
		mtgloan_off = new Image();
		investing_off = new Image();
		pda_off = new Image();
		myview_off = new Image();
		fpdownload_off = new Image();
		emt_off = new Image();
			
		webdoxs_on.src = "../../images/webdoxs_on_e.gif";
		mtgloan_on.src = "../../images/mtgloan_on_e.gif";
		investing_on.src = "../../images/investing_on_e.gif";
		pda_on.src = "../../images/pda_on_e.gif";
		myview_on.src = "../../images/myview_on_e.gif";
		fpdownload_on.src = "../../images/fpdownload_on_e.gif";
		emt_on.src = "../../images/emt_on_e.gif";
		webdoxs_off.src = "../../images/webdoxs_off_e.gif";
		mtgloan_off.src = "../../images/mtgloan_off_e.gif";
		investing_off.src = "../../images/investing_off_e.gif";
		pda_off.src = "../../images/pda_off_e.gif";
		myview_off.src = "../../images/myview_off_e.gif";
		fpdownload_off.src = "../../images/fpdownload_off_e.gif";
		emt_off.src = "../../images/emt_off_e.gif";
				
		fpdownload_b_on = new Image();
		investing_b_on = new Image();
		
		fpdownload_b_on.src = "../../images/fpdownload_b_on_e.gif";
		investing_b_on.src = "../../images/investing_b_on_e.gif";
		
		fpdownload_b_off = new Image();
		investing_b_off = new Image();
		
		fpdownload_b_off.src = "../../images/fpdownload_b_off_e.gif";
		investing_b_off.src = "../../images/investing_b_off_e.gif";
				
		preloadFlag = true;
	}
	
	strModule=determineModule();
	if (strModule != "none"){
		setActiveModuleButtons(strModule);
	}
	
}