var QueryString = "";
/** XHConn - Simple XMLHTTP Interface - bfults@gmail.com - 2005-04-08        **
 ** Code licensed under Creative Commons Attribution-ShareAlike License      **
 ** http://creativecommons.org/licenses/by-sa/2.0/      
                     **/

function XHConn( $Plugin )
{
  var xmlhttp, bComplete = false;

  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone, async)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();
    try {
      if (sMethod == "GET")
      {

       xmlhttp.open(sMethod, sURL+"?aj=ax&"+sVars, async );
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type",
          "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp, $Plugin );
        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}

function ajax (DivId, url, vars, fun, async )
{
//initialize XHConn (if XHConn isn't created successfully, 
//the client doesnt' support Ajax)

var ajaxConn = new XHConn(DivId);

//post to mypage.php with args foo and baz
ajaxConn.connect( url, "GET", vars ,fnWhenDone, async);

}

 //when the server responds, javascript 
//will trigger this callback function
function fnWhenDone(XML, DivId)
{
  document.getElementById( DivId ).innerHTML = XML.responseText;
}


function DoRefresh(  DivId , File, Vars )
{
    var DoTis=true;
    DoPostBack( DivId , File, Vars );
   
}

function DoPostBack(DivId , File, Vars   )
{

document.getElementById( DivId ).innerHTML = "<p>Refreshing, please wait ...</p>";


       ajax( DivId , File, Vars, fnWhenDone, true );  

}
function ShowDiv( Div )
{
document.getElementById( Div ).style.display = "block";
}
function HideDiv( Div )
{
document.getElementById( Div ).style.display = "none";
}


function PostForm( DivId, FormId )
{
// Check the types of the input fields and sthemtore
	Pform=document.getElementById( FormId );
	Qs="";

	for(i=0; i<Pform.elements.length; i++)
	{
 
      	if(Pform.elements[i].type == "text" || Pform.elements[i].type == "textarea" || Pform.elements[i].type == "button" || Pform.elements[i].type == "hidden" || Pform.elements[i].type == "password")	{
			Qs=Qs+"&"+Pform.elements[i].name + "=" + Pform.elements[i].value;
      	}
      	else if(Pform.elements[i].type == "checkbox"){
			Qs=Qs+"&"+Pform.elements[i].name + "=" + Pform.elements[i].checked;
     		 }
     		 else if(Pform.elements[i].type == "select-one"){
			Qs=Qs+"&"+Pform.elements[i].name + "=" + Pform.elements[i].options[Pform.elements[i].selectedIndex].value;

      	}
     		 else if(Pform.elements[i].type == "radio" && Pform.elements[i].checked ){
			Qs=Qs+"&"+Pform.elements[i].name + "=" + Pform.elements[i].value;
		}
	}

	DoRefresh( DivId, "", Qs );
}

sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);




