/* home page routines - note the images/ */


/* See which browser we have and if we support document.all, which is
   the standard DOM method now. */

var NN4 = document.layers? true : false; //Netscape Navigator 4.x.
var IE4 = document.all? true : false;    // IE version 4 and above.
var W3C = document.getElementById? true : false; // W3C compatibale

function showPaymentLayer(divid,itemid) {
        // would get the details for that itemid
        showLayer(divid);
}

function showLayer(divid) {
        if (W3C) {
                document.getElementById(divid).style.visibility = "visible";
        }
        else if (NN4) {
                document.layers[divid].visibility = "show";
        }
        else if (IE4) {
                document.all[divid].style.visibility = "visible";
        }
}

function hideLayer(divid) {
        if (W3C) {
                document.getElementById(divid).style.visibility = "hidden";
        }
        else if (NN4) {
                document.layers[divid].visibility = "hide";
        }
        else if (IE4) {
                document.all[divid].style.visibility =        "hidden";
        }
}

/* simple function which provides a void function. void() should work but
   it has problems with Mac IE5 */

function voidFn() {
        //return true;
}

function removeLayer(title) {
   var obj = document.getElementById(title);
   var removedNode = document.body.removeChild(obj);
   removedNode = null;
}

function checkExists(recipients, id) {
    exists = 0;
    var m;
    for (m = 0; m < recipients.options.length; m++) {
       if (recipients.options[m].value == id ) {
          exists = 1;
       }
    }
    return exists;
 }

function onAlertSubmit() {
    if (document.MOB_ALERT.MESSAGE.value == '') {
       alert('You must enter an SMS message.');
       return false;
    }
    if (document.MOB_ALERT.GS_RECIPIENTS.options.length == 0) {
       alert('You must select at least one person to send this message to.');
       return false;
    }
    members = document.MOB_ALERT.GS_RECIPIENTS;
    for (i = 0; i < members.options.length; i++) {
       members.options[i].selected=true;
    }
    return true;
 }



function addToGroup() {
   buddies = document.GRP_MANAGER.GRP_BUDDIES;
   members = document.GRP_MANAGER.GRP_MEMBERS;
   for (n=0; n < buddies.options.length; n++) {
      if (buddies.options[n].selected) {
            selectedValue = buddies.options[n].value;
            selectedText = buddies.options[n].text;
            buddies.options[n] = null;
            members.options[members.options.length] = new Option(selectedText, selectedValue);
            n--;
      }
   }
}

function deleteFromGroup() {
   buddies = document.GRP_MANAGER.GRP_BUDDIES;
   members = document.GRP_MANAGER.GRP_MEMBERS;
   for (n=0; n < members.options.length; n++) {
      if (members.options[n].selected) {
         selectedValue = members.options[n].value;
         selectedText = members.options[n].text;
         members.options[n] = null;
         buddies.options[buddies.options.length] = new Option(selectedText, selectedValue);
         n--;
      }
   }
 }

 function onGroupAdd() {

    if (document.GRP_MANAGER.GRP_NAME.value == '') {
       alert('You must enter a name for this group.');
       return false;
    }

    members = document.GRP_MANAGER.GRP_MEMBERS;
    for (i = 0; i < members.options.length; i++) {
       members.options[i].selected=true;
    }
 }


function loadContent(newSrc) {  // what is the new URL?
    var o_obj = document.elements['LNav'];
    if (navigator.userAgent.indexOf('MSIE')>=1) {  // is it IE?
        o_obj.src= newSrc;
    } else {
        str = ("<layer src='"+newSrc+"' width='100'></layer>");
        with (o_obj.document) { open(); write(str); close(); }
    }
}


function init1() {
  var f1 = document.mob_alert
	var Today = new Date();
	document.mob_alert.day.selectedIndex = Today.getDate()-1;
	document.mob_alert.month.selectedIndex = Today.getMonth();
	document.mob_alert.year.value = Today.getYear()

}

function SetVals(Carr,MO, Day, Mon, Year, Flt, Name, Myemail, Recip, Phone) {

	document.mob_alert.Carrier.selectedIndex = Carr;
	document.mob_alert.MO.selectedIndex = MO;
    	document.mob_alert.day.selectedIndex = Day;
      	document.mob_alert.month.selectedIndex = Mon;
      	document.mob_alert.year.selectedIndex = Year;
	document.mob_alert.flightCode.value = Flt;
	document.mob_alert.MyName.value = Name;	
	document.mob_alert.email.value = Myemail;	
	document.mob_alert.mobile_no.value = '+' + Phone;
}


    function openInPopup(url)
    {
        var scrWidth = window.screen.availWidth;
        var scrHeight = window.screen.availHeight;
        var winWidth = (scrWidth >= 800 ? 800 : scrWidth) - 105;
        var winHeight = (scrHeight >= 600 ? 600 : scrHeight) - 105;
        var win = window.open(url, '_blank', 'resizable=1,scrollbars=1,width='+winWidth+',height='+winHeight+',screenX='+(scrWidth - winWidth) / 2+',screenY='+(scrHeight - winHeight) / 2+',left='+(scrWidth - winWidth) / 2+',top='+(scrHeight - winHeight) / 2);
        //win.moveTo((scrWidth - winWidth) / 2, (scrHeight - winHeight) / 2);
    }
