//XMLhttp variable will hold the XMLHttpRequest object
var xmlhttp = false;

// If the user is using Mozilla/Firefox/Safari/etc
if (window.XMLHttpRequest) {
   //Intiate the object
   xmlhttp = new XMLHttpRequest();
   //Set the mime type
   xmlhttp.overrideMimeType('text/xml');
}
// If the user is using IE
else if (window.ActiveXObject) {
   //Intiate the object
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}

function submitForm() {
    //make sure hidden and iframe values are in sync for all rtes before submitting form
    updateRTEs();

    //change the following line to true to submit form
    alert("rte1 = " + (document.RTEDemo.rte1.value));
    return false;
}

function imagepopup() {
   window.open ('upload2.php', 'Upload', config='height=200, width=500, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

function updateImages() {
   var url = "updateimages.php";
   xmlhttp.open('GET', url, true);
   xmlhttp.onreadystatechange = function() {
       if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            window.opener.document.getElementById("recentimages").innerHTML = xmlhttp.responseText;
       }
    };
    xmlhttp.send(null);
}

function SpecialPlay2(number) {

   var idname = "";
   var i = document.getElementById("currentSpecial").innerHTML;

   idname = "Special" + i;
   Effect.toggle(idname, 'appear', {duration:2.0});
   i++;
   if (i > number) {
      i = 1;
   }
   idname = "Special" + i;
   Effect.toggle(idname, 'appear', {duration:2.0});

   document.getElementById("currentSpecial").innerHTML = i;
   setTimeout("SpecialPlay2("+number+")", 5000);
}

function in_array( what, where ){
   var a=false;
   for(var i=0;i<where.length;i++){
      if(what == where[i]){
         a=true;
         break;
      }
   }
   return a;
}

function toggleOptions() {
   var temp = "";
   var elements = document.getElementsByName("Products");
   var element2 = document.getElementById("QuantityDonation");
   var element3 = document.getElementById("CustomCheck");
   temp = elements[0].disabled;
   for(var i = 0; i < elements.length; i++) {
      if (temp == false) {
         elements[i].disabled = true;
      } else {
         elements[i].disabled = false;
      }
   }
   if (temp == false) {
      element2.disabled = false;
   } else {
      element2.disabled = true;
   }
}


