
function loadImages(){
        if (document.images)
        {
            preload_image = new Image(100,50); 
            preload_image.src="image-security.jpg"; 
        }
    }
    
function replaceText(id,text){
    if( !document.getElementById || !document.getElementById(id).childNodes ) {
          window.alert('Your browser is not DOM compliant');
    } else {
          var theParagraph = document.getElementById(id);
          if( !theParagraph.lastChild) {
		window.alert('Your browser has an incorrect implementation of lastChild');
          } else{
                while(theParagraph.lastChild){
                    theParagraph.removeChild(theParagraph.lastChild);
                }
                //theParagraph.replaceChild(document.createTextNode(text),theParagraph.firstChild);
                theParagraph.appendChild(document.createTextNode(text));
          }
     } 
}

function copyValue(){
                document.form_input.event_endDate.value=document.form_input.event_startDate.value;
}
            
function selectToggle(field)
{
    for (i = 0; i < field.length; i++)
	if (field[i].checked== true ) field[i].checked = false ;
        else field[i].checked = true;
}   

function deselectAll(field)
{
    for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function copyValue(){
                document.form_input.event_endDate.value=document.form_input.event_startDate.value;
            }

function showhide(id){
    if (document.getElementById){
        var obj = document.getElementById(id);
        if (obj.className=="slide-hide"){
            obj.className="slide-show";
            obj.onmouseover=null;
        }
        else obj.className="slide-hide";
    }
}
function showhide(elem,anchor){
    if (document.getElementById){
        var obj = document.getElementById(elem);
        var anc=document.getElementById(anchor);
        if (obj.className=="slide-hide"){
            obj.className="slide-show";
            obj.onmouseover=null;
            anc.innerHTML="less";
        }
        else {
            obj.className="slide-hide";
            anc.innerHTML="more";
        }
    }
}
function adjustRow(id, action){
    var row=document.getElementById(id);
    if (action=='restore'){
        //row.width=''; 
        row.style.font=' 100% arial';
    }
    else { //row.width='150px';  
        row.style.font=' 150% arial'; }
}
function sendAjax(id,url,method){
    //alert('id='+id+'action='+action+'eventId'+eventID);
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        div1=document.getElementById(id);
        div1.innerHTML=xmlHttp.responseText;
        div1.onmouseover=null;
//        div1.onmouseout=function(){
//            div1.innerHTML="attendance"
//        }
        }
       else {
        div1=document.getElementById(id);
        div1.innerHTML="wait...";
       }
      }
    xmlHttp.open(method,url,true);
    xmlHttp.send(null);
    return true;
  }
  
  function detectChange(select,url){
      //var select=document.form_input.albums;
      //var select=form;
      var index=select.selectedIndex;
     //alert(select[index].text);
    if (select[index].text=='Add New'){
        openChild(url,'win2');
    }
    //else alert ("form elements not recognized");
  }
  
  function postForm(form1,id, url){   //universal ajax form posting
    //alert('id='+id+'form='+fr[1].selectedIndex+' id='+fr.numOfPeople.selectedIndex);
    //var fr=document.ajax24;
    var fr=form1;
    //alert(fr);
    //var url='EditAttendance?action=Add&eventID='+fr.eventID.value+'&willAttend='+fr.willAttend.value+'&numOfPeople='+fr.numOfPeople.value;
   //alert(url);
   //var div1=document.getElementById(id);
   //div1.innerHTML=url; 
   var params=fr[0].name+'='+encodeURI(fr[0].value);
   for (var i=1; i<fr.length; i++){
       if( fr[i].name !='' && fr[i].type!='button'){
            if (fr[i].type=='radio'){
                if (fr[i].checked){
                    params+='&'+fr[i].name+'='+encodeURI(fr[i].value);
                }
            }
            else if (fr[i].type=='select-one'){
                //if (fr[i].selected){
                    params+='&'+fr[i].name+'='+encodeURI(fr[i].value);
                //}
            }
            else params+='&'+fr[i].name+'='+encodeURI(fr[i].value);
            
        }
    }
    
    url=url+'?'+params;
    //alert(url);
   sendAjax(id,url,'POST');
   }
   
 function openChild(file,window) {
    //childWindow=open(file,window,'resizable=no,width=200,height=400');
    
    childWindow=open(file,window,'width=600,height=300');
    
    if (childWindow.opener == null) childWindow.opener = self;
 }
 
 function InitMenu(){
     //var x;
    head=document.getElementById("nav");
    //alert(document.location);
    var docnodes=head.getElementsByTagName("li");
    for (i=0; i<docnodes.length; i++){
//      alert("doc"+ docnodes[i].firstChild.href +" \\n "+document.location.href);
//      if (docnodes[i].id==elementID){
//          docnodes[i].className='activelink';            
//      }
      if (document.location.href==docnodes[i].firstChild.href){
          docnodes[i].className='activelink';            
          //alert("match");
      }
      else docnodes[i].className='';            
    }
 }
 function clickMenu() {
     //alert(this.Nodestyle);
     //head=document.getElementById("nav");
    // var x=head.getElementsByTagName("li");
   //  for (var i=0; i < x.length; i++) {
  //             //x[i].onmouseover = over;
                //x[i].onmouseout = out;
   //      x[i].style.className="activelink";
    }

 function dialog(text){
     if(confirm(text)){
         return true;
     }
     else return false;
 }

  