function loginModule(){
    var strLoginBox='';
    var dir = location.href.substring(0,location.href.lastIndexOf('/')+1);
    var url = location.href.substring(dir.length,location.href.length+1).toUpperCase();

    /* Login Box Start */
    strLoginBox+='<div id="loginbox" class="logincontentbg">';
    strLoginBox+='<table border="0" cellpadding="0" cellspacing="0">';
    strLoginBox+='<tr><td><img src="images/tab_login_top.gif" width="243" height="10" alt="" border="0"></td></tr>';
    strLoginBox+='<tr><td class="loginTxt">Customer Login</td></tr>';
    strLoginBox+='<tr><td><img src="images/login_inner_top.gif" width="243" height="6" alt="" border="0"></td></tr>';
    strLoginBox+='</table>';

    /* Mutual Login Div Start */
    strLoginBox+='<div id="auto_login_tab">';
    strLoginBox+='<form name="PrimaryloginForm" action="/Amica/AWFServlet" method="post" id="PrimaryloginForm"><input type="hidden" name="pagename" value="loginRequest"><input type="hidden" name="application" value="PHSMemberServicesApplication"><input type="hidden" name="event" id="event" value="">';
    strLoginBox+='<table border="0" cellpadding="0" cellspacing="0" width="222" class="logininnerbg">';
    strLoginBox+='<tr><td><table border="0" cellpadding="1" cellspacing="0" height="81">';
    strLoginBox+='<tr><td colspan="2"><img src="images/spacer.gif" width="15" height="1" alt="" border="0"></td></tr>';
    if (get_cookie("iPlanetDirectoryPro")==""){
    strLoginBox+='<tr><td class="loginSpaceMd"><input type="text" name="username" id="username" value="Username" size="16" maxlength="25" onfocus="javascript:if(this.value ==\'Username\')this.value=\'\';this.style.color=\'#000000\';" onkeypress="if (submitOnEnter(this.form,event)) { validatePage(\'CustomerLogin\');}" onblur="javascript:if(this.value == \'\'){this.value=\'Username\';this.style.color=\'#596774\';}" style="color:#596774;font-style:verdana;font-size:11px;width:121px;"></td></tr>';    
    strLoginBox+='<tr><td class="loginSpaceMd"><input type="password" name="password" id="password" maxlength="14" onfocus="this.style.background=\'#FFFFFF\'" onkeypress="if (submitOnEnter(this.form,event)) { validatePage(\'CustomerLogin\');}" onChange="this.style.background=\'#FFFFFF\'" style="border: solid; border-width: 1px 1px 1px 1px; border-color: #7f9db9 #7f9db9 #7f9db9 #7f9db9; width:123px; height:15px; font-family: verdana; font-size: 11px; color: #5B5B5B; text-align: left; background-image: url(\'images/login_password_bg.gif\'); background-repeat: no-repeat; background-color:#FFFFFF"></td></tr>'; 	
    strLoginBox+='<tr><td class="loginbtngrnSS"><a href="#" title="Login" onclick="validatePage(\'CustomerLogin\');"><span>Login</span></a></td></tr>';
    strLoginBox+='<tr><td><table border="0" cellpadding="2" cellspacing="0" width="100%">';
    strLoginBox+='<tr><td class="loginSpaceMd"><a href="javascript:forgotUserName()">Forgot User Name</a></td><td class="loginSpaceSm"><!--<input type="checkbox" name="mutualRememberMe" id="mutualRememberMe" value="TRUE"><span class="orangeTxt">Remember me</span>--></td>';
    strLoginBox+='<tr><td class="loginSpaceMd"><a href="javascript:forgotPwCheckUser()">Forgot Password</a></td><td class="loginSpaceSm"><a href="javascript:registerNewUser()">Are you a new user?</a></td>';
	} else {
	strLoginBox+='<tr><td><table border="0" cellpadding="2" cellspacing="0" width="100%">';
	strLoginBox+='<script>document.globalLogin.event.value="processLogin";</script>';
	strLoginBox+='<tr><td class="loginSpaceMd"><a href="#" onclick="submitForms(document.globalLogin);">Back to Your Account</a></td></tr>';
	strLoginBox+='<tr><td class="loginSpaceMd"><a href="javascript:submitForms(document.globalLogout);">Logout</a></td></tr>';
	}
    strLoginBox+='</table></td></tr>';
    strLoginBox+='<tr><td div align="center" id="errorMsg" class="errorPHS"></div></td></tr>';
    strLoginBox+='</table></td></tr>';
    strLoginBox+='<tr><td><img src="images/tab_inner_bot.gif" width="243" height="5" alt="" border="0"></td></tr>';
    strLoginBox+='<tr><td><img src="images/tab_login_bot.gif" width="243" height="10" alt="" border="0"></td></tr>';
    strLoginBox+='</table>';
    strLoginBox+='</form>';
    strLoginBox+='</div>';    

    strLoginBox+='</div>';
    document.write(strLoginBox);    
}
loginModule();


function showHideLoginBox()
{
    var andivDiv = document.getElementById('loginbox');
    if(!andivDiv.style.display || andivDiv.style.display=='none')
    {
        andivDiv.style.display='block';
        andivDiv.style.visibility = 'visible';
    } else
    {
        andivDiv.style.display='none';
        andivDiv.style.visibility = 'hidden';

    }
}



function hideDiv(div)
{
    if (div != null)
    {
        div.style.display='none';
        div.style.visibility = 'hidden';
    }
}

function showDiv(div)
{
    if (div != null)
    {
        div.style.display='block';
        div.style.visibility = 'visible';
    }
}

function forgotPwCheckUser() {                
        document.getElementById("event").value = "forgotPassword"
        Director.directRequest('NeedSSOPW');     
}
function forgotUserName() {                
    document.getElementById("event").value = "forgotUserName"
    Director.directRequest('ForgotUserName');              
}
function registerNewUser() {                 
    document.getElementById("event").value = "newUserRegistration"
    Director.directRequest('NewUser');            
}