var d=document;

function setUserId(){
	d.getElementById('libHeading').style.display ='none';
	
	d.getElementById('cardEntry').style.display = 'none';
	
	d.getElementById('linkEntry').style.display = 'none';
	
	d.getElementById('libChkbox').style.display = 'none';
	
	d.getElementById('library').style.display = 'none';
	
	d.getElementById('userId').style.display = 'block';
	
	d.getElementById('password').style.display = 'block';
	
	d.getElementById('userChkbox').style.display = 'block';
	
	d.getElementById('libLink').style.display = 'block';
	
	d.getElementById('user').style.display = 'block';
	
	d.loginForm.auth.value="UidPassword";
		
}

function setLibraryCard(value){
	d.getElementById('libHeading').style.display ='block';
	d.getElementById('cardEntry').style.display = 'block';
	d.getElementById('linkEntry').style.display = 'block';
	d.getElementById('libChkbox').style.display = 'block';
	d.getElementById('library').style.display = 'block';
		
	d.getElementById('userId').style.display = 'none';
	
	d.getElementById('password').style.display = 'none';
	
	d.getElementById('userChkbox').style.display = 'none';
	
	d.getElementById('libLink').style.display = 'none';
	d.getElementById('user').style.display = 'none';
		
	d.loginForm.auth.value="LibraryCard";
	
	t = document.getElementById("addContent");
			
	t.innerHTML='<input type="hidden" name="acct" id="acct" value="'+ value+'"/>';
		
}

function preSubmit(){
	if(d.loginForm.auth.value == "UidPassword"){
		var el = document.getElementById('acct');
		if(el != null)
		el.parentNode.removeChild(el);
	}
	d.loginForm.submit();
}

/* Added for WBDP-639 */

function submitZip(){
	d.loginForm.pwd.value = d.loginForm.uid.value;
	d.loginForm.auth.value="Zip";
	d.loginForm.submit();
}


//moved from wbLogin.js
//This method is called on click on subscription key link on login page
function openPage(theURL, bSecure,hostName)
{
        var hostName = hostName;

        /* Changed for WBDP-471 */
        bSecure = false;

        /** if(hostName.indexOf("worldbookonline.com")!= -1) {
                hostName=hostName.replace(/worldbookonline/,"worldbook");
        } **/
        if(hostName.indexOf("worldbook.com")!= -1) {
                hostName=hostName.replace(/worldbook/,"worldbookonline");
        }

        if(hostName.indexOf("www")!= -1) {
                location.href="http" +(bSecure ? "s":"") +"://" +hostName +theURL;
        }
    else {
                hostName = "www."+hostName;
                location.href="http" +(bSecure ? "s":"") +"://"+hostName +theURL;
        }

        return false;
}


