function setClass( hEl, sClass )
  {
    hEl.className = sClass
 }
 
 function JobView(Element){

     var Source = document.getElementById('jbs')       
   
   if(Element.value == "")
      Source.innerHTML = "";
    else{
     var Target = document.getElementById('j'+Element.value)
     
     Source.innerHTML = Target.innerHTML;    
    }  
 
 }
 
 
function ShowElem(Elem,hide1,hide2){

  var FormElem = document.getElementById( Elem )
  var hideElem1 = document.getElementById( hide1 )
  var hideElem2 = document.getElementById( hide2 )
  if(FormElem)
   if((FormElem.style.display == "none") || (FormElem.style.display == "")) {
    FormElem.style.display = "block";
	if (hideElem1)
	hideElem1.style.display = "none";
	if (hideElem2)
	hideElem2.style.display = "none";
   }
  else    
    FormElem.style.display = "none";
}

function ShowHide(Elem){
	var FormElem = document.getElementById( Elem )
	if((FormElem.style.display == "none") || (FormElem.style.display == "")) {
    FormElem.style.display = "block";
	}
  else    
    FormElem.style.display = "none";
}


function StepByStep( Position, MaxCount, Container, Prefix, FirstElement){

    var SelectArray =  new Array();
    var PropertyContainer = document.getElementById( Container );


    for(cL = 0; cL < MaxCount; cL++)
     SelectArray[cL] = document.getElementById( Prefix+cL );

     if(SelectArray[Position].value == "" || !PropertyContainer ){

         for(cL = Position+1; cL < MaxCount; cL++)
           while(SelectArray[cL].options.length > 1)
             SelectArray[cL].options[SelectArray[cL].options.length - 1] = null;

     }else{

        for(cL = Position+1; cL < MaxCount; cL++){
         SelectArray[cL].options.length = null;
         SelectArray[cL].options[SelectArray[cL].options.length] = new Option(FirstElement,"")
         }


         var FoundNewItemKeys = new Array();

         var AvailArray = PropertyContainer.getElementsByTagName( 'a' );
          for(cA = 0; cA < AvailArray.length; cA++)

           if(AvailArray[cA].getAttribute('linkedid') == SelectArray[Position].value){

             SelectArray[Position+1].options[SelectArray[Position+1].options.length] = new Option(AvailArray[cA].getAttribute('name'), AvailArray[cA].getAttribute('itemid'))
          }


     }

}
function StepByStep2( Position, MaxCount, Container, Prefix, FirstElement){

    var SelectArray =  new Array();
    var PropertyContainer = document.getElementById( Container );


    for(cL = 0; cL < MaxCount; cL++)
     SelectArray[cL] = document.getElementById( Prefix+cL );

     if(SelectArray[Position].value == "" || !PropertyContainer ){



         for(cL = Position+1; cL < MaxCount; cL++)
           while(SelectArray[cL].options.length > 1){
             SelectArray[cL].options[SelectArray[cL].options.length - 1] = null;
	     SelectArray[cL].style.display = "none";
	}     

     }else{

        for(cL = Position+1; cL < MaxCount; cL++){
         SelectArray[cL].options.length = null;
         SelectArray[cL].options[SelectArray[cL].options.length] = new Option(FirstElement,"")
         }


         var FoundNewItemKeys = new Array();

         var AvailArray = PropertyContainer.getElementsByTagName( 'a' );
          for(cA = 0; cA < AvailArray.length; cA++)

           if(AvailArray[cA].getAttribute('linkedid') == SelectArray[Position].value){
             SelectArray[Position+1].style.display = "inline";
             SelectArray[Position+1].options[SelectArray[Position+1].options.length] = new Option(AvailArray[cA].getAttribute('name'), AvailArray[cA].getAttribute('itemid'))
          }


     }




}


