	
function doKeyPress(form) {
    
    var isNav = (navigator.appName.indexOf("Netscape") != -1);
    var isIE = (navigator.appName.indexOf("Microsoft") != -1);		
	
    function handler(e) {			
		if ((isNav && (e.which == 13)) ||
			(isIE && (window.event.keyCode == 13))) {					
			if(form["save2File"] != null)
				form["save2File"].value = false;
			form.submit();						
		}

		return true;			
    }
	
    if (isNav)
		document.captureEvents(Event.KEYPRESS);	
	
    for (var d=0; d<form.elements.length; d++) {
		if (form.elements[d].type == "text" || 
		    form.elements[d].type == "password") {
			form.elements[d].onkeyup = handler;
		}    
    }
}

// can not submit form when pressing enter key with IME in Netscape
function handleIMEAndKeyPress(form) {

    //var isNav = (navigator.appName.indexOf("Netscape") != -1);
    var isIE = (navigator.appName.indexOf("Microsoft") != -1);		
	
	function handler(e) {				
		if (isIE && (window.event.keyCode == 13)) {						    
			form.submit();						
		}

	return true;			
	}
	
	//Capturing events for Netscape interferes IME with Netscape in Chinese/Korean OS
	//if (isNav)
		//document.captureEvents(Event.KEYPRESS);	
		
	if (isIE) {
		for (var d=0; d<form.elements.length; d++) {
			if (form.elements[d].type == "text" || 
			    form.elements[d].type == "password") {
				form.elements[d].onkeyup = handler;
			}    
		}
    	}
}

function changeServerName(server) {
	
	var s = server.toLowerCase();
	if (server == "enroll.verifiedbyvisa.com" ||
            server == "verifiedbyvisa.com" ||
            server == "www.verifiedbyvisa.com") {
		s = "acs.verifiedbyvisa.com";    
    	}  
    
	return s;
}

function generateHttpsLink(relativePath) {  	            

    var href = location.href; // http://localhost/vpas/bank1/index.html    						 
    var index = href.indexOf("//");
    
    var s1 = href.substring(index + 2); // localhost/vpas/bank1/index.html
    index = s1.indexOf("/");
    var server = s1.substring(0, index); // localhost  
    server = changeServerName(server);       
        
    s1 = s1.substring(server.length+1, s1.length); // vpas/bank1/index.html    
    index = s1.indexOf("/");    
    var localPath = s1.substring(0, index); // vpas
    s1 = s1.substring(localPath.length+1, s1.length); // bank1/index.html
    index = s1.indexOf("/");
    var bankDir = s1.substring(0, index); // bank1
    	
	index = relativePath.indexOf("profile");
	if (index == 0) {
		localPath = localPath + "/" + bankDir;
	}
	
	var symbol = '&';
	if (relativePath.indexOf("?") == -1)
		symbol = '?';

    return "http://" + server + "/" + localPath + "/" + relativePath + symbol + 
    		"bank=" + bankDir;     
}

function SetImage(offsrc, onsrc, txt){
	if (document.images){
		this['mouse_out'] = new Image();			
		this['mouse_out'].src = offsrc;
		this['mouse_over'] = new Image();			
		this['mouse_over'].src = onsrc;
	}this['text'] = txt;
}
	
function RollOver(imgname){
	if (document.images){
		document.images[imgname].src = JS_Image[imgname]['mouse_over'].src;
		window.status = JS_Image[imgname]['text'];
	}
}

function RollOut(imgname){
	if (document.images){
			document.images[imgname].src = JS_Image[imgname]['mouse_out'].src;
			window.status = '';
	}
}
	
function LaunchNew(locaton,w,h){
       newwindow=window.open(locaton, "newwindow", "width=" + w + ",height=" + h + ",status=no,toolbar=no,location=no,menubar=no,scrollbars=auto,resizable=no");
}

function clickRegstartURL(docObj, href) {
	
	docObj.forms[0].action = href;
	docObj.forms[0].submit();
} //end of clickRegstartURL function

function show_visa_merchants()
{
	var win = window.open("http://usa.visa.com/microsites/verified/shop_with_vbv.html", "Merchants", "height=600,width=700,dependent=yes,scrollbars=yes,resizable=yes,screenX=150,screenY=50,left=150,top=50");
	win.focus();
}
