$(document).ready(function() {
	$("#nav_local input[type='submit']").hide();
	$("#nav_local select").change(function() {
		$("#nav_local form").submit();
	});
	
	var initialJob = null;
	
	if (window.location.hash) {
		initialJob = window.location.hash.substr(1);
	}
	$(".job_header").each(function() {
		if ($(this).attr("id")==initialJob) {
			// append closer link
			$(this).next().show();	
			$(this).next().next().append('<a href="#" class="open">hide description</a>');
			$.scrollTo($('#'+initialJob));
		}	
		else {
			// hide the job body
			$(this).next().hide();		
			// append opener link
			$(this).next().next().append('<a href="#" class="closed">read more / apply</a>');
		}
	});
	
	$(".job_footer a").click(function() {
		var triggerLink = $(this);
		var jobBody = triggerLink.parent().prev();
		
		if (triggerLink.attr("class")=='closed') {
			jobBody.slideDown('slow',function(){
				triggerLink.html('hide description');
				triggerLink.attr('class','open');	
			});
		}
		else {
			jobBody.slideUp('slow',function(){
				triggerLink.html('read more / apply');
				triggerLink.attr('class','closed');				
			});
		}
		return false;
	});
	$(".share_linkedin").each(function(){
	        $(this).attr('href','http://www.linkedin.com/hiring?editAttributes=%26trk=hb_tab_postjob');
	        $(this).attr('target','_blank');
	});
	
	
    if(typeof sIFR == "function"){
        sIFR.replaceElement("#nav_local h4", named({sFlashSrc: "/images/frutiger_roman.swf", sColor: "#9A9898", sWmode: "transparent"}));
        sIFR.replaceElement("#nav_local h5", named({sFlashSrc: "/images/frutiger_roman.swf", sColor: "#0A5CE0", sWmode: "transparent"}));
        sIFR.replaceElement("#nav_local label", named({sFlashSrc: "/images/frutiger_roman.swf", sColor: "#0A5CE0", sWmode: "transparent"}));    
        sIFR.replaceElement("#intro h1", named({sFlashSrc: "/images/frutiger_roman.swf", sColor: "#7D7B7B", sWmode: "transparent"}));
        sIFR.replaceElement("#intro h2", named({sFlashSrc: "/images/frutiger_roman.swf", sColor: "#7D7B7B", sWmode: "transparent"}));
    }
});