 /*
* Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
*
* Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com)
*
* Gets the full width/height because it's different for most browsers.
*/
function getViewportHeight() 
{
  if (window.innerHeight!=window.undefined) return window.innerHeight;
  if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
  if (document.body) return document.body.clientHeight; 
  return window.undefined; 
}
function getViewportWidth() 
{
  if (window.innerWidth!=window.undefined) return window.innerWidth; 
  if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
  if (document.body) return document.body.clientWidth; 
  return window.undefined; 
}

function moveSelectedLayers()
{
  var theBody = document.documentElement;
  var fullHeight = getViewportHeight();
  //    alert("moved em");

  var scTop = parseInt(theBody.scrollTop,10);
  window.defaultStatus = "offsetHeight = "+document.body.offsetHeight + " scTop = " + scTop+" Screen.availHeight = "+screen.availHeight;
  for (i = 0; i < movingLayers.length; i++)
  {
    theHeight = scTop+(fullHeight - movingLayers[i].offsetHeight-120)/2;
    if (theHeight < topheight)
    {
      theHeight = topheight;
    }
    movingLayers[i].style.top = theHeight+"px";
  } 
}


function createRequestObject(){
  var request_o; //declare the variable to hold the object.
  var browser = navigator.appName; //find the browser name
  if(browser == "Microsoft Internet Explorer")
  {
    /* Create the object using MSIE's method */
    request_o = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else 
  {
    /* Create the object using other browser's method */
    request_o = new XMLHttpRequest();
  }
  return request_o; //return the object
}


function buildQueryString(theFormName) {
  theForm = document.getElementById(theFormName);
  var qs = ''
  for (e=0;e<theForm.elements.length;e++) {
    if (theForm.elements[e].name!='' && theForm.elements[e].name!='page_id') {
      if (theForm.elements[e].type == "radio" || theForm.elements[e].type == "checkbox"){
        if (theForm.elements[e].checked){
          qs+=(qs=='')?'':'&'
          qs+=theForm.elements[e].name+'='
          +escape(theForm.elements[e].value)
        }
      }
      else {
        qs+=(qs=='')?'':'&'
        qs+=theForm.elements[e].name+'='
        +escape(theForm.elements[e].value)
      } 
    }
  }
  return qs
}