/////////////////////////////**********************************/////////////////////


// Example:
// onMouseOver="toolTip('tool tip text here')";
// onMouseOut="toolTip()";
// -or-
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')";
// onMouseOut="toolTip()"; 
/*
MOVE this to the <body>:
<div id="toolTipLayer" style="position:absolute; visibility: hidden"></div>
<script language="JavaScript"><!--
initToolTips(); //-->
*/
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}

///////////////////////////////////////////////////////
function toolTip(msg, fg, bg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
    if(!fg) fg = "#777777";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><td>' +
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + bg + 
    '"><td align="center"><font face="sans-serif" color="' + fg +
    '" size="-2">&nbsp\;' + msg +
    '&nbsp\;</font></td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
//////////////////////////////////////////////////////////////////////

function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}


function isCapsLockOn( e )
{//alert("g");
	if(checkCapsLock( e ))
	{	alert("g");
		toolTip('tool tip text AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA here');
	}
	
}

/////////////////////*********************************///////////////////////////

// detect Caps Lock //
function checkCapsLock( e ) {
//alert("g");
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Caps Lock is On.\n\nTo prevent entering your password incorrectly,\nyou should press Caps Lock to turn it off.';

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		
		alert( myMsg );
		document.forms[0].password.focus();
		//toolTip('Caps Lock is ON');
		//document.forms[0].username.focus();
		//alert("g");
		//return true;

	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		
		alert( myMsg );
		document.forms[0].password.focus();
		//toolTip('Caps Lock is ON');
		//document.forms[0].username.focus();
		//alert("g");
		//return true;

	}

	
}
// detect Caps Lock //




/*************************
//  Announcements Slider
**************************/
function start()
{
if (document.all) iemarquee(slider);
else if (document.getElementById)
ns6marquee(document.getElementById('slider'));
else if(document.layers)
ns4marquee(document.slider1.document.slider2);
}
function iemarquee(whichdiv)
{
iediv=eval(whichdiv)
iediv.innerHTML=wholemessage
iediv.style.pixelTop=sheight
sizeup=iediv.offsetHeight
ieslide()
}
/*************************
//  Announcements Slider
**************************/



// opening Window
function openmywindow()
{
	window.open("", "", 'toolbar,width=150,height=100');
}

// onKeyPress Event 
function allow_alphanumeric_underscore(fld)
{  
	//alert("ganeshd");
	if(window.event.keyCode==13)
	{
		viasubmit();
	}
	else
	{	/*
		if(fld=="P")
		{
			checkCapsLock( window.event );
		}
		else
		{
		*/
		if(((window.event.keyCode >= 48 & window.event.keyCode <= 57) | (event.keyCode >= 65 & event.keyCode <= 90) | (event.keyCode >= 97 & event.keyCode <= 122) | window.event.keyCode==95 )== false)
		{
			alert("Invalid character !");
			if(fld=="U")
			{
				document.forms[0].username.focus();
			}
			else
			{
				document.forms[0].password.focus();
			}
			window.event.keyCode=0;
		}
	//}
	}
}

// invoked on Submit
function viasubmit()
{
	//alert(document.forms[0].username.value!=0);
	//alert(document.forms[0].password.value!=0);
	if ((document.forms[0].username.value.length!=0) & (document.forms[0].password.value.length!=0))
	{
		//return true;
		/*
		if((document.forms[0].username.value.length<6)||(document.forms[0].password.value.length<6))
		{
			alert("Login Id and Password must be atleast 6 characters long. ");
			if(document.forms[0].username.value.length<6) 
			{
				document.forms[0].username.focus();
			}
			else
			{
				if(document.forms[0].password.value.length<6)
				{
					document.forms[0].password.focus();
				}
			}
		}
		else
		{
		*/ 
			//this is for lms link.
			//document.forms[0].submit();
			//location.href="http://web02.gurukulonline.com/learningspace5/default.asp?ui=student&regdatabasekey=amity&interface=amity&logonName="+document.forms[0].username.value+"&logonPassword="+document.forms[0].password.value+"";
		/*
		}
		*/
		document.forms[0].method="post";
		document.forms[0].action="sloginpro.jsp";
		document.forms[0].submit();
	}
	else
	{
		alert("Please enter Login Id and Password !");
		if(document.forms[0].username.value.length==0) 
		{
			document.forms[0].username.focus();
		}
		else
		{
			if(document.forms[0].password.value.length==0)
			{
				document.forms[0].password.focus();
			}
		}
		return false; 
	} 
	
}
