var xmlHttp


function getBase()
{
	  var baseTag = document.getElementsByTagName("base");
	  for(var i=0; i<baseTag.length; i++)
	  {
			var baseId = baseTag[i].id;
			var baseHref = baseTag[i].href;
			//alert("ID = "+ baseId +"\nhref = "+ baseHref);
	  }
	  return baseHref;
}


function changeSubCat(str,str2)
{
  xmlHttp=GetXmlHttpObject();
    
    if (xmlHttp==null)
     {
        alert ("Browser does not support HTTP Request");
        return;
     } 

    var url="php/updateSubCategories.php";

   
        var str2 = str.value;
        url=url+"?parentid="+str2;
  
    
    url=url+"&sid="+Math.random();
    xmlHttp.onreadystatechange=stateChanged ;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

    
    changeSkills(str,"emp")
}  




function changeSkills(str,str2)
{ 
    xmlHttp2=GetXmlHttpObject();
    
    if (xmlHttp2==null)
     {
        alert ("Browser does not support HTTP Request");
        return;
     } 

    var url2="php/updateSkills.php";

    
   var str = str.value;
    
    if (str2=="emp")
    {
         url2=url2+"?parid="+str;  
    }
    else
    {   
        url2=url2+"?subid="+str;
    }    
    
    
    
    
    url2=url2+"&sid="+Math.random();
    xmlHttp2.onreadystatechange=stateChangedAgain ;
    xmlHttp2.open("GET",url2,true);
    xmlHttp2.send(null);
}

function changeSubCat2(str,str2)
{
  xmlHttp3=GetXmlHttpObject();
    
    if (xmlHttp3==null)
     {
        alert ("Browser does not support HTTP Request");
        return;
     } 

    var url3="php/updateSubCategories.php";

   
        var str3 = str.value;
        url3=url3+"?parentid="+str3;
  
    
    url3=url3+"&sid="+Math.random();
    xmlHttp3.onreadystatechange=stateChangedOnceAgain ;
    xmlHttp3.open("GET",url3,true);
    xmlHttp3.send(null);


}  


function stateChanged() 
    { 
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
        { 
         document.getElementById("subCat").innerHTML=xmlHttp.responseText ;
        } 
    }

function stateChangedAgain() 
    { 
        if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
        { 
         document.getElementById("skills").innerHTML=xmlHttp2.responseText ;
        } 
    }
    
function stateChangedOnceAgain() 
    { 
        if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete")
        { 
          document.getElementById("subCat").innerHTML=xmlHttp3.responseText ;   
        } 
    }
    
function GetXmlHttpObject()
    {
    var xmlHttp=null;
    try
     {
     // Firefox, Opera 8.0+, Safari
     xmlHttp=new XMLHttpRequest();
     }
    catch (e)
     {
     //Internet Explorer
     try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
     catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
    return xmlHttp;
    }
    
    
    

function reSelect(theSel){
    theIndex=theSel.selectedIndex;
    if(selCtrl[theIndex])
         selCtrl[theIndex]=false;
    else
         selCtrl[theIndex]=true;
    
    for(i=0;i<theSel.options.length;i++)
       if(selCtrl[i])
         theSel.options[i].selected=true;
       else
         theSel.options[i].selected=false;
}
