$(function(){
	$('li.hasChildren ul').hide();
	$('li.hasChildren a').click(function () {
		if($(this).attr('href') == '#'){
			$(this).addClass("selected");
			var myChildren=$(this).nextAll();
			if (myChildren.is(":hidden")) {
				myChildren.slideDown();
			} else {
				$(this).removeClass("selected");
				myChildren.slideUp();
			}
										  }
    });
	/* the following function highlights the subnav item of the current page */
	$("*").find("a[href='"+window.location.href.substring(window.location.href.lastIndexOf("/")+1, window.location.href.length)+"']").each(function(){
		if($(this)!='#'){
			$(this).addClass("selected");
			$(this).siblings().show();
			$(".selected").parent().parent().siblings().addClass("selected");
			$(".selected").parent().parent().show();
		}
	})
	// dealerApp form
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
	   var arrayTextInputs = $("input[@type=text]").get(); 
	   $(arrayTextInputs).each(function(){ 
		   $(this).addClass("textInput"); 
	   });
	}
	// dealer login
	//$('#dealerLogin #dealerEmail').val("enter e-mail address");
	$('#dealerLogin #dealerEmail').addClass("inactive");
	$('#dealerLogin #dealerEmail').click(function(){
		if($(this).val()=="enter e-mail address"){
			//$(this).removeClass("inactive");
			$(this).val("");
		}
	});
	$('#dealerLogin #dealerEmail').blur(function(){
		if($(this).val()==""){
			//$(this).addClass("inactive");
			$(this).val("enter e-mail address");
		}
	});
	$('#dealerLogin #forgotPassword').val("enter e-mail address");
	$('#dealerLogin #forgotPassword').addClass("inactive");
	$('#dealerLogin #forgotPassword').click(function(){
		if($(this).val()=="enter e-mail address"){
			//$(this).removeClass("inactive");
			$(this).val("");
		}
	});
	$('#dealerLogin #forgotPassword').blur(function(){
		if($(this).val()==""){
			//$(this).addClass("inactive");
			$(this).val("enter e-mail address");
		}
	});
});
