// The below are for countyInddetail.jsp file
function showHideItems(myItem, myButton){

    //this is the ID of the hidden item
    var myitem = document.getElementById(myItem);


    //this is the ID of the plus/minus button image
    var mybutton = document.getElementById(myButton);


    if (myitem.style.display != "none") {
    //items are currently displayed, so hide them

    myitem.style.display = "none";

    swapImage(mybutton,"plus");
    }
    else {

    //items are currently hidden, so display them
    myitem.style.display = "block";

    swapImage(mybutton,"minus");
    }
    }


//function to swap an image based on its current state
function swapImage(myImage, state) {

if (state == "minus") {

myImage.src = "images/minus.gif";
}

else {
myImage.src = "images/plus.gif";
}

}



// The below are for countyIndsubdetail.jsp file

function showorhide(idlong, idshort, idlink)
   {
   if (document.getElementById(idlong).style.display == "none")
   {
document.getElementById(idlink).value="Collapse Description";
document.getElementById(idlong).style.display = "block";
   document.getElementById(idshort).style.display="none";
   }
   else
   {
   document.getElementById(idlink).value="Expand Description";
   document.getElementById(idlong).style.display="none";
   document.getElementById(idshort).style.display = "block";
   }
   }


//eskills validation javascripts
function occtitle_validate()
 {
 var thegroup = document.getElementById("availtitles");
  var val = 0;
 for(n=0; n<thegroup.options.length; n++)
 {
   if(thegroup.options[n].selected)
  {
     val++;
   }
  }

  if(val == 0)
  {
   alert("You have to select an occupational title.");
   return false;
   }
  return true;
  }

 /* jQuery functions begin here - used in the Reemployment main page displaying occupation titles */

 $(function()  {
	$("div.subtitle").hide();

	 $("a.maingroup").click(function()  {

	 var answer = $("#a" + $(this).attr('id'));
		 answer.slideToggle("fast");
  });

$("#openAll").click(function() {
    $("div.subtitle").each(function() {
      $(this).slideDown("fast");
    });
  });

  $("#closeAll").click(function() {
    $("div.subtitle").slideUp("fast");
  });

 });
















