﻿
//------ These colors are for validation routines -----//
var badcolor = '#BCC880'
var goodcolor = 'white'

function selecttxt(ctrl)
{
	var val = ctrl.value.toLowerCase()
	var x = val.indexOf('search')
	if ( x == -1 )
	{
		ctrl.select()
	}
	else
	{
		ctrl.value = ''
	}
}

function closeme(what)
{
	var adiv = document.getElementById(what)
	adiv.style.display = 'none'
	adiv.style.visibility = 'hidden'
	
}

function showdiv(what)
{
	var adiv = document.getElementById(what)
	adiv.style.display = 'block'
	adiv.style.visibility = 'visible'
}

function toggleshow(what)
{
	var adiv = document.getElementById(what)
	var astyle = adiv.style
	var show = adiv.style.display
	if ( show != 'block')
	{
		astyle.display = 'block'
		astyle.visibility = 'visible'
		astyle.position='absolute'
		astyle.zIndex = 999
	}
	else
	{
		astyle.display = 'none'
		astyle.visibility = 'hidden'
	}
}

function valToTxt(ctrl, txtboxname)
{
	what = ctrl.value
	var args = valToTxt.arguments
	var nargs = args.length
	var ret = true
	if ( nargs > 2 )
	{
			/*
			var execroutine = trim(args[2])
			var execarg = trim(args[3])
			execstr = execroutine + "(ctrl,'" + execarg + "')"
			ret = eval(execstr)
			*/
			doSpecial(ctrl,"Student")
	}
	else
	{
		closeme("studentInfoDiv")
	}
	if ( ret )
	{
		var txtbox = document.getElementById('LnameTxt_chk')
		var txtbox = document.getElementById('FNameTxt_chk')
		var txtbox = document.getElementById(txtboxname)
		{
			txtbox.value = what
		}
	}
}

var eventDate = new Date("April 1, 2008 9:00:00  ")
function countdownDate()
{
	var rightNow = new Date()
	
}

function fixuplgnmsg()
{
	var aform = document.forms[0]
	
}

function logoff()
{
	var url = 'AjaxCalls.aspx?choice=logoff'
	var isok = makeRequest(url,logoff_callback,'') 
}

	function logoff_callback()
	{
        if (http_request.readyState == 4) 
        {
            if (http_request.status == 200) 
            {
                var txt = http_request.responseText;
                //mdiv = document.getElementById('MsgDiv')
                //astr = 'You are now logged off<br />'
                //astr +='<a href="Javascript:logon(\'\')">Log On</a>'
                //mdiv.innerHTML = astr
                //mdiv.backgroundColor = '#AAFFB5'
                //showdiv('MsgDiv')
            } 
            else 
            {
                //var error = http_request.Error
                //alert(error)
            }
			document.location="default.aspx";
        }
}


var inactivateGoBtn = false
var logonreturn = ""

function masterlogoff(inactivate,returnpage)
{
	var url = 'AjaxCalls.aspx?choice=logoff'
	logonreturn = returnpage
	if ( inactivate ) 
	{ 
		inactivateGoBtn = true 
	}
	else
	{
		inactivateGoBtn = false 
	}

	var isok = makeRequest(url, masterlogoff_callback)
}

	function masterlogoff_callback()
	{
        if (http_request.readyState == 4) 
        {
            if (http_request.status == 200) 
            {
				document.location="default.aspx";
                var txt = http_request.responseText;
                var lgndiv = document.getElementById(masterlgndiv)
                var astr ='WELCOME | <a style="color:#e37911;" href="Logon.aspx?returnpage=' + escape(logonreturn) + '"> Login</a>'
                lgndiv.innerHTML = astr
								var gobtncell = document.getElementById('goBtnCell')
								
                if ( inactivateGoBtn )
								{// Fix this up so that the names do not need to be hard coded
									gobtncell.style.visibility = 'hidden'
									alert('You must login again in order to submit this form.')
                }
                
            } 
            else 
            {
                var error = http_request.Error
                alert(error)
            }
        }
}


