﻿$(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
			//with new scheme, just go to login page
		    //$("#loginControl").show();
		    $find('MPE1').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("");
         }
    });
	
});

	var lastTab = 0;
	var isPostBack = false;

	$(function() {
		SetTabs();
	});

	function SetTabs() {
		jQuery("#tabs").tabs({
			show: function(event, ui) {
				if (!isPostBack)
					lastTab = jQuery("#tabs").tabs('option', 'selected');
			}
		}).addClass('ui-tabs-vertical ui-helper-clearfix');
		jQuery("#tabs li").removeClass('ui-corner-top').addClass('ui-corner-left');
		if (lastTab)
			jQuery("#tabs").tabs('select', lastTab);
	}
	
	
		function pageLoad(sender, args) {
		if (args.get_isPartialLoad()) {
			isPostBack = true;
			SetTabs();
			isPostBack = false;
		}
	}