/* Script for User Interactivity using JQuery */

/*
Disable right click script II (on images)- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/

var clickmessage=unescape("%A9")+" Phoenix Heliparts, Inc 2010-2011"

function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById)
if (e.which==3&&e.target.tagName=="IMG")
setTimeout("alert(clickmessage)",0)
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all){
document.onmousedown=disableclick
for (var i_tem = 0; i_tem < document.images.length; i_tem++)
document.images[i_tem].galleryimg='no'
}
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()

$(document).ready(function(){
	
	pagePath = window.location.pathname;
	pagePathParts = pagePath.split("/");
	
	if (pagePathParts[2] != 'engineering') {
		$("ul.sidebar1SubNav").hide();
	}
	
	$("a#engineeringButton").click(function(){
		$("ul.sidebar1SubNav").toggle('slow');
	});
	
	var $search = $('input#search');//Cache the element for faster DOM searching since we are using it more than once
	original_val = $search.val(); //Get the original value to test against. We use .val() to grab value="Search"
	$search.focus(function(){ //When the user tabs/clicks the search box.
		if($(this).val()===original_val){ //If the value is still the default, in this case, "Search"
			$(this).val('');//If it is, set it to blank
		}
	})
	$('input#search').blur(function(){//When the user tabs/clicks out of the input
		if($(this).val()===''){//If the value is blank (such as the user clicking in it and clicking out)...
			$(this).val(original_val); //... set back to the original value
		}
	});
	
	$('.folder').collapser({
		target: 'next',
		effect: 'slide',
		changeText: 0,
		expandClass: 'folder',
		collapseClass: 'folder'
	});

});
