/* bc_navbuttons.js
* displays on states based on page title and section page is in
* biersma creative 2006
* relies on prototype because I'm checking it out (jen)
*/
//put the following in the file that includes this javascript to define the sections and then page names
//in the body tag, use <body onload="load_navigation">
//define arrays of page names using section names af the variables


var about = [];
var client_services = ['client_services_overview','contract_staffing','temp_hire'];
var industry_focus = ['industry_focus_overview','admin_clerical','professional_services','light_industrial','marcellus_shale'];
var candidates = ['candidate_area_overview','candidate_resources','interviewing_tips','resume_writing','benefits'];
var contact = ['locations'];
//define the section names
var section_names = ['about', 'client_services', 'industry_focus', 'candidates', 'contact'];
var sections = [about, client_services, industry_focus, candidates, contact];
var extension = ".php";
var contact = [];
var extention_off = "_nav.gif";
var extention_on = "_nav_on.gif";
var images_folder = "images/interior/";
var current_page = window.location.pathname.toLowerCase().replace("/","");
var page_name = current_page.replace(extension, "");

function load_navigation(){

 sections.each( function(currentSection, ind){
  //if name of page is the name of a section , turn it on and exit
    if(page_name == section_names[ind]){

	  //turn page title on, can just put this before load navigation if every page has a navigation item - and remove from second loop as well
      $(page_name).src = images_folder + page_name + extention_on;
	  return;
    }
	//look in the array with the name matching the current value

	currentSection.each( function(section_page){
	  if(section_page == page_name){
        //if the name of the page is in that array, make the section nav on and the page nav on and exit
		$(section_names[ind]).src = images_folder + section_names[ind] + extention_on;
        $(page_name).src = images_folder + page_name + extention_on;
		return;
		}
	});
  });
}

/*putting this in here because i don't want to put it in every single page head */
function Verify(form) {
		var user = form.username.value;
		var pass = form.password.value;

		if ((user == "") && (pass == ""))
		{
			window.alert("Please enter your user name and password to sign in.");
			form.username.focus();
			return false;
		}
		else if (user == "")
		{
			window.alert("Please enter your user name.");
			form.username.focus();
			return false;
		}
		else if (pass == "")
		{
			window.alert("Please enter your password.");
			form.password.focus();
			return false;
		}
		else
		{
			return true;
		}
	}

	function init()
	{
		document.forms[0].elements["username"].focus()
	}