function createRequest() {
     try {
       request = new XMLHttpRequest();
     } catch (trymicrosoft) {
       try {
         request = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (othermicrosoft) {
         try {
           request = new ActiveXObject("Microsoft.XMLHTTP");
         } catch (failed) {
           request = null;
         }
       }
     }

     if (request == null)
       alert("Error creating request object!");
   }
   
var loading = "ajax-loader.gif";


function ajaxObject(url, callbackFunction) {
  var that=this;      
  this.updating = false;
  this.abort = function() {
    if (that.updating) {
      that.updating=false;
      that.AJAX.abort();
      that.AJAX=null;
    }
  }
  this.update = function(divid, passData, postMethod, funct, parameters, throbber) { 
    if (that.updating) { return false; }
    that.AJAX = null;                          
    if (window.XMLHttpRequest) {              
      that.AJAX=new XMLHttpRequest();              
    } else {                                  
      that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
    }                                             
    if (that.AJAX==null) {                             
      return false;                               
    } else {
      that.AJAX.onreadystatechange = function() { 
	  if(divid != null)
	  {
		 if(document.getElementById(divid))
		 {
			  if(throbber == null || throbber == 1)
				{
					 if (that.AJAX.readyState == 1 || that.AJAX.readyState == 2) 
					 {
				  document.getElementById(divid).innerHTML="<img src=\""+loading+"\"/ border=\"0\">";
					  }
					 if (that.AJAX.readyState == 3)
					  {
					 document.getElementById(divid).innerHTML="<img src=\""+loading+"\" border=\"0\"/>";	
					  }	
				}
		 }
	  }
        if (that.AJAX.readyState==4) {             
          that.updating=false;                
          that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML, divid, funct, parameters);        
          that.AJAX=null;                                         
        }                                                      
      }                                                        
      that.updating = new Date();                              
      if (/post/i.test(postMethod)) {
        var uri=urlCall+'?'+that.updating.getTime();
        that.AJAX.open("POST", uri, true);
        that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        that.AJAX.setRequestHeader("Content-Length", passData.length);
        that.AJAX.send(passData);
      } else {
		  if(passData != null)
          var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime()); 
		  else
		  var uri=urlCall+'?timestamp='+(that.updating.getTime());
        that.AJAX.open("GET", uri, true);                             
        that.AJAX.send(null);                                         
      }              
      return true;                                             
    }                                                                           
  }
  var urlCall = url;        
  this.callback = callbackFunction || function () { };
}

///////////////////////////////////////
function showGreeting(divid)
{
var greeting;
var today=new Date();
var hours = today.getHours();
if (hours < 12) greeting = 'Good morning';
if(hours >= 12 && hours < 17) greeting = 'Good afternoon';
if (hours >= 17 && hours <= 24) greeting = 'Good Evening';
document.getElementById(divid).innerHTML=greeting;
}
//////////////////////////

function showDate(divid)
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
document.getElementById(divid).innerHTML="<b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year;
}
///////////////////////
function showTime(divid)
{
if (!document.all&&!document.getElementById)
return
thelement=document.getElementById? document.getElementById(divid): document.all.tick2
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="PM"
if (hours<12)
dn="AM"
if (hours>12)
hours=hours-12
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var ctime=hours+":"+minutes+":"+seconds+" "+dn
thelement.innerHTML=ctime
setTimeout("showTime('timediv')",1000)
}
///////////////////////
function hide(divid)
{
document.getElementById(divid).innerHTML="";	
}
/////////////////////////
function open_url(url, mydiv, method, querystring, funct, functParams, throbber)
	{
		
		var myRequest = new ajaxObject(url, open_url_new_action);
		if(method == 'get' || method == 'GET')
        myRequest.update(mydiv, querystring, 'get', funct, functParams, throbber);
		if(method == 'post' || method == 'POST')
        myRequest.update(mydiv, querystring, 'post', funct, functParams, throbber);
		
	}
/////////////////////////////
function open_url_new_action(responseText, responseStatus, responseXML, divid, funct, parameters)
{
					if (responseStatus == 200) 
						{
						  document.getElementById(divid).innerHTML=responseText;
						  if(funct !=null)
						  funct();
						} 
					else 
			            {
			             alert(responseStatus);
			            }	
}
///////////////////////////////////
function open_url_forgot(url, mydiv, method, querystring, funct, functParams, throbber)
	{
		
		var myRequest = new ajaxObject(url, open_url_forgot_action);
		if(method == 'get' || method == 'GET')
        myRequest.update(mydiv, querystring, 'get', funct, functParams, throbber);
		if(method == 'post' || method == 'POST')
        myRequest.update(mydiv, querystring, 'post', funct, functParams, throbber);
		
	}
/////////////////////////////
function open_url_forgot_action(responseText, responseStatus, responseXML, divid, funct, parameters)
{
					if (responseStatus == 200) 
						{
						  document.getElementById('loginbox').innerHTML=responseText;
						  if(funct !=null)
						  funct();
						} 
					else 
			            {
			             alert(responseStatus);
			            }	
}
///////////////////////////////////