<!--

/*****************************
* Tab control script loosely based from Dynamic Drive DHTML library (www.dynamicdrive.com)
*****************************/

// Show the selected tab's content and highlight that tab
function expandcontent(linkobj){
    linkobj.className="active";
    document.getElementById(linkobj.getAttribute("rel")).style.display="block"; //expand corresponding tab content
}

// Hide all tab contents and deselect all tabs
function clearcontents(tabcontents){
    for (var x=0; x<tabcontents.length; x++){ //loop through each LI element
        var link=tabcontents[x].getElementsByTagName("a")[0];
        link.className="";
        if (link.getAttribute("rel")) {
            document.getElementById(link.getAttribute("rel")).style.display="none";
        }
    }
}

function expandtab(tabcontentid, tabnumber, interestselect){ //interface for selecting a tab (plus expand corresponding content)
    tabnumber--;

    var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber];
    if (thetab.getAttribute("rel")) {
        clearcontents(document.getElementById(tabcontentid).getElementsByTagName("li"));
        expandcontent(thetab);

        document.getElementById("interestSelect").value = interestselect; //save the tab so we know which type to 'process'
    }
}

/*****************************
* End tab control functions
*****************************/


function makeInqLiteRequest(url, parameters, replaceElement) {
   createRequest();
   replace_element = replaceElement;
      
   http_request.onreadystatechange = alertContents;
   http_request.open('POST', url, true);
   http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   http_request.setRequestHeader("Content-length", parameters.length);
   http_request.setRequestHeader("Connection", "close");
   http_request.send(parameters);
}

function inqLite(obj, replaceElement) {
   document.getElementById('workinggif').src='/includes/inquiry/images/working.gif';

   var goalSelect = "formGoal" + document.getElementById("interestSelect").value;

   var poststr = "name=" + encodeURI( document.getElementById("formName").value ) +
                 "&email=" + encodeURI( document.getElementById("formEmail").value ) +
                 "&grad=" + encodeURI( document.getElementById("formGrad").value ) +
                 "&goal=" + encodeURI( document.getElementById(goalSelect).value ) +
                 "&template=simple";

   makeInqLiteRequest('/cgi-bin/admissions/admis_lite.pl', poststr, replaceElement);

   try
   {
      setTimeout("document.getElementById('workinggif').src='/images/spacer.gif'",1000);
   }  catch(e) {}

}

//-->