Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}

$(function(){
	// search box
	$("#searchinput").focus(function(){
		if ($(this).val() == defaultSearchValue) $(this).val('');
	});
	// external links
	$("a[rel=external]").each(function(){
		$(this).attr("target","_blank");
	});
	// product subnav -- assume second class is pX otherwise needs indexOf to find
	$("#nav ul ul").each(function(){
		var myclass = $(this).attr("class").split(" ");
		if (!currentlyOpen.in_array(myclass[1])){
			$(this).hide();
		}
	});
	
	if (navIsSliding){
		$("#nav ul ul").prev("a").each(function(){
			$(this).click(function(){
				var nstr = $(this).next("ul").attr("class");
				$(this).parent().parent().children("li").children("ul").each(function(){
					if ($(this).attr("class") != nstr){
						$(this).slideUp();
					}
				});
				$(this).next("ul").slideToggle();
				$(this).blur();
				return false;
			});
		});
	}

	// swf, div id, w, h, min version
	$("#flash").css("backgroundImage","none");
	var params = { wmode: "transparent" };
	swfobject.embedSWF(r+"lcs_header.swf", "flashswf", "570", "110", "6",false,false,params,false);
});