﻿$(document).ready(function(){

	// show the login link
    $("#loginLink").show();
	// hide the login form
    $("#loginControl").hide();
        				
	// open the login form on link click, or if in eweb goto eweb login		
	$("#ctl00_OSUAALoginBox_ctl01_explitLogout_ExplicitLogin").click(function(event) {

		if($("#eWebTopPaneRightLinksCell").size() > 0) {		
			// in eweb	
			$("#ctl00_OSUAALoginBox_ctl01_explitLogout_ExplicitLogin").attr('href','/eweb/DynamicPage.aspx?Site=aime&amp;WebCode=LoginRequired'); 
		}		
		else {
			// do nothing let the login link call windows auth
	    }
	});
	// open the login form on link click, or if in eweb goto eweb login		
	$("#ctl00_OSUAALoginBox_ctl01_ExplicitLogin").click(function(event) {

		if($("#eWebTopPaneRightLinksCell").size() > 0) {		
			// in eweb	
			$("#ctl00_OSUAALoginBox_ctl01_ExplicitLogin").attr('href','/eweb/DynamicPage.aspx?Site=aime&amp;WebCode=LoginRequired'); 
		}		
		else {

			// in moss
			// hide the login link
		    $("#loginLink").hide();
			// show the login form
		    $("#loginControl").show();
		    event.preventDefault();
	    }
	});		

	// open the login form on arrow click
	$(".imgLoginOpen").click(function(event) {
		// hide the login link
	    $("#loginLink").hide();
		// show the login form
	    $("#loginControl").show();
	    event.preventDefault();
	});
	//close the login form
	$(".imgLoginClose").click(function(event) {
		// show the login form
	    $("#loginControl").hide('fast');
		// hide the login link
	    $("#loginLink").show('fast');
	    event.preventDefault();
	});									
	// clear the text in the login box on focus
	$(".tbxLoginUsername").focus(function () {    
         if($(".tbxLoginUsername").val() == "email address")
         {         	
         	$(".tbxLoginUsername").val("");
         }
    });
	
});
