// JavaScript Document
var tipsShown = 20;
var timeOut;
function showTip(text, posElement, color, tipID, animate) 
{
	//alert(posElement);
	if (!tipID) { tipID = tipsShown; tipsShown++; }

	var element; element = document.getElementById(posElement);
	var width; if (animate ==1) { width = 100; } else { width = 185; }

	if (color == 'y')
	{
          new Insertion.Top('tip', "<div id='tip"+tipID+"' onClick=\"hideTip('tip"+tipID+"');\" style='position: absolute; display: none; z-index: 15; height=10px; width: "+width+"px;'><div style=\"background: url('picture/tooltip.gif') no-repeat top left; height: 10px;\"> &nbsp; </div><div style='text-align: left; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; background: #FFFFCC; padding: 5px;'>"+text+"</div></div>");


	} 
	else
	{

          new Insertion.Top('tip', "<div id='tip"+tipID+"' onClick=\"hideTip('tip"+tipID+"');\" style='position: absolute; display: none; z-index: 15; height=10px; width: "+width+"px;'><div style=\"background: url('picture/tooltip-w.gif') no-repeat top left; height: 15px;\"> &nbsp; </div><div style='text-align: left; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; background: #FFFFFF; padding: 5px;'>"+text+"</div></div>");

	}
		
        var pos = Position.cumulativeOffset(element);
		var dimensions = Element.getDimensions(element);

        Element.setStyle($('tip'+tipID), { position: 'absolute', top: (pos[1]+dimensions.height-15)+'px', left: (pos[0]+dimensions.width-(dimensions.width/2))+'px' });
       //alert('tip'+tipID);
	   
		Element.show('tip'+tipID); 
		pe = new PeriodicalExecuter(function(){
											 	Element.hide($('tip'+tipID));
												if (tipID < 100) { tipsShown--; }
											 }
									,10);
   }
   
   function hideTip(tipID, animate) {
		animate=1;
        if (animate == 1) { Element.hide($(tipID)); } else { Effect.Fade($(tipID)); }
        //$('tips').removeChild($(tipID));
        if (tipID < 100) { tipsShown--; }
   }

function newPassword(){
	if($('luser').value.trim()==''){
		showTip('Please enter your user name for our primary identification!!!', 'luser');
		$('luser').focus();
	}
	else{
		Element.setStyle('div-login-err',{display:''});
		$('div-login-err').innerHTML = 'Please wait while we work on your request';
		new Ajax.Updater('div-login-err','changePass.php',{
						 									parameters:{user:$F('luser')},
															onSuccess:function(t){
																$('div-login-err').innerHTML = t.responseText;
																pe = new PeriodicalExecuter(function(){
																$('div-login-err').innerHTML = '';		 
																Element.setStyle('div-login-err',{display:'none'});
																									 },20);
															},
															onFailure:function(t){
																alert('');
															}
						 });
	}
}