//global variables
  var req = null;
  var which;
  var spanId;
  var div1;
  var div2;
  var yWithScroll;
  var xWithScroll;

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function processChromeRequest(url,id,div_1,div_2) {
	if (window.innerHeight && window.scrollMaxY) {// Firefox 
	yWithScroll = window.innerHeight + window.scrollMaxY;
	xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	yWithScroll = document.body.scrollHeight;
	xWithScroll = document.body.scrollWidth;
	}else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
	yWithScroll = document.body.offsetHeight;
	xWithScroll = document.body.offsetWidth;
	} 
	document.getElementById('div1').style.width = xWithScroll + 'px';
	document.getElementById('div1').style.height = yWithScroll + 'px';
	document.getElementById('iframe1').style.width = document.body.offsetWidth + 'px';
	document.getElementById('iframe1').style.height = document.body.scrollHeight + 'px';
	var subtraction = document.body.scrollHeight-document.body.offsetHeight;
	if (subtraction > 0) {
    document.getElementById("div2").style.marginTop = (subtraction + 30) +"px";
	document.getElementById("iframe2").style.marginTop = (subtraction + 30) +"px";
	document.getElementById("div3").style.marginTop = (subtraction + 30) +"px";
	document.getElementById("iframe3").style.marginTop = (subtraction + 30) +"px";
 } else {
        document.getElementById("div2").style.marginTop = 30+"px";
		document.getElementById("iframe2").style.marginTop = 30+"px";
		document.getElementById("div3").style.marginTop = 30+"px";
		document.getElementById("iframe3").style.marginTop = 30+"px";
 }
	
             div1 = div_1;
			 div2 = div_2;
             spanId=id;
    //get the (form based) params to push up as part of the get request

    
    //Do the Ajax call

    if (window.XMLHttpRequest) { // Non-IE browsers

      req = new XMLHttpRequest();

      req.onreadystatechange = processStateChangeChrome;

      try {
          req.open("POST", url, true); 

      } catch (e) {
        alert("Problem Communicating with Server\n"+e);

      }

      req.send(null);

    } else if (window.ActiveXObject) { // IE
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) {
		  req.open("POST", url, true);
        req.onreadystatechange = processStateChangeChrome;
        req.send();

      }

    }

}
function processStateChangeChrome() {
  
  	  if (req.readyState == 4) { // Complete
      if (req.status == 200) { // OK response     
      document.getElementById(spanId).innerHTML = req.responseText;
		opendiv(div1,div2);
      } else {
        alert("Problem with server response:\n " + req.statusText);
      }
    }
  }


  function opendiv(id,id1){
	  			var divStyle = document.getElementById(id).style;  
				divStyle.display='block'; 
				var div_Style = document.getElementById(id1).style;  
				div_Style.display='block';	
						 
 }

  function ShowDiv(divid,iframe, state)
{
	var DivRef = document.getElementById(divid);
	var DivRef1 = document.getElementById('div1');
	var IfrRef = document.getElementById(iframe);
	var IfrRef1 = document.getElementById('iframe1');
	if(state)
	{
		DivRef.style.display = "block";
		IfrRef.style.width = DivRef.offsetWidth;
		IfrRef.style.height = DivRef.offsetHeight;
		IfrRef.style.top = DivRef.style.top;
		IfrRef.style.left = DivRef.style.left;
		IfrRef.style.zIndex = DivRef.style.zIndex - 1; 
		IfrRef.style.display = "block";
		DivRef1.style.display = "block";
		IfrRef1.style.width = DivRef1.offsetWidth;
		IfrRef1.style.height = DivRef1.offsetHeight;
		IfrRef1.style.top = DivRef1.style.top;
		IfrRef1.style.left = DivRef1.style.left;
		IfrRef1.style.zIndex = DivRef1.style.zIndex - 1; 
		IfrRef1.style.display = "block";
	}
	else
	{
		
		DivRef.style.display = "none";
		IfrRef.style.display = "none";
		DivRef1.style.display = "none";
		IfrRef1.style.display = "none";
	}
}

function ShowLayer(val) {
    // hide all dropdowns on the page
    // looping through all forms on the page
	if(val== "true"){
    for (f = 0; f < document.forms.length; f++)
    {
        var elements = document.forms[f].elements;
        // looping through all elements on certain form

        for (e = 0; e < elements.length; e++)
        {
            if (elements[e].type == "select-one")
            {
                elements[e].style.display = 'none';
            }
        }
    }
	}
	else {
		for (f = 0; f < document.forms.length; f++)
    {
        var elements = document.forms[f].elements;
        // looping through all elements on certain form

        for (e = 0; e < elements.length; e++)
        {
            if (elements[e].type == "select-one")
            {
                elements[e].style.display = 'block';
            }
        }
    }
	}
    // show layer
}

