﻿/**************************
** XML Loading Functions **
**************************/

function LoadEvents() {
  //document.getElementById('divEventsContent').innerHTML="<br/><br/>L O A D I N G . . .";
  //loadXMLDocUpdate('http://www.westburyschools.org/webevent/ge_main.htm', 'events');
  //  loadXMLDocUpdate('/shared/get.aspx?type=events', 'events');
  //loadXMLDocUpdate('/webeventtemp.html', 'events');
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  //alert('Query Variable ' + variable + ' not found');
}

function loadXMLDocUpdate(url,type) {
xmlupdatehttp=null;
if (window.XMLHttpRequest) xmlupdatehttp=new XMLHttpRequest();// code for Mozilla, etc.
else if (window.ActiveXObject) xmlupdatehttp=new ActiveXObject("Microsoft.XMLHTTP");// code for IE
if (xmlupdatehttp!=null) {
  xmlupdatehttp.onreadystatechange=update_state_Change;
  xmlupdatehttp.open("GET",url,true);
  xmlupdatehttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlupdatehttp.send(null);
  } else {alert("Your browser does not support XMLHTTP.");}
  //siteadmin/products/get.asp?type=update&table=productline&id=229
}
function update_state_Change() {
  if (xmlupdatehttp.readyState==4) { if (xmlupdatehttp.status==200) {
    //var xmlDoc=xmlupdatehttp.responseXML;
      var strContents = xmlupdatehttp.responseText;
      if (strContents == "true") {
          //location.reload(true);
          alert("The email you entered has already subscribed!");
          highlightDiv("Step1Email", 1)
      } else {
          //call step 2a
          highlightDiv("Step1Email", 0)
          showStep("2a");
      }
    //document.getElementById('divEventsContent').innerHTML=strContents[0];
    
  } else{alert("Problem retrieving XML data: " + xmlupdatehttp.responseText);} }
}


function getcontent(type,id) {
  var mainContent=document.getElementById('sub-column-middle');
  mainContent.innerHTML="L O A D I N G . . .";

  var mainContent=document.getElementById('sub-column-right-quote');
  mainContent.innerHTML="L O A D I N G . . .";

  loadXMLDocUpdate('/shared/getcontent.aspx?type=' + type + '&id=' + id, type);
}

var start = new Date();
start = Date.parse(start) / 1000;
var counts = 10;

function CountDown() {
    var now = new Date();
    now = Date.parse(now) / 1000;
    var x = parseInt(counts - (now - start), 10);
    if (document.form1) { document.form1.clock.value = x; }
    if (x > 0) {
        timerID = setTimeout("CountDown()", 100)
    } else {
        location.href = "http://www.ddiinfo.org"
    }
}

