﻿/**************************
** XML Loading Functions **
**************************/
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.split(']] [[');
    document.getElementById('sub-column-middle').innerHTML=strContents[0];
    document.getElementById('sub-column-right-quote').innerHTML=strContents[1];
    if(strContents[2]!="") document.getElementById('sub-column-right-image').innerHTML=strContents[2];
    
    
  } 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);
}



