$("<link>").attr("type", "text/css").attr("rel", "stylesheet").attr("href", "http://www.willoughbydesign.com/styles/scripts/").appendTo("head");

// Browser detection

var ua = navigator.userAgent;
var browser = "";

// Firefox 2
if (ua.indexOf("Firefox/2") != -1) {
	$("<link>").attr("type", "text/css").attr("rel", "stylesheet").attr("href", "http://www.willoughbydesign.com/styles/browser-firefox-2/").appendTo("head");
	browser = "ff2";
}

// IE 6
if (ua.indexOf("MSIE 6") != -1) {
	$("<link>").attr("type", "text/css").attr("rel", "stylesheet").attr("href", "http://www.willoughbydesign.com/styles/browser-ie-6/").appendTo("head");
	browser = "ie6";
}

// IE 7
if (ua.indexOf("MSIE 7") != -1) {
	$("<link>").attr("type", "text/css").attr("rel", "stylesheet").attr("href", "http://www.willoughbydesign.com/styles/browser-ie-7/").appendTo("head");
	browser = "ie7";
}

// Safari
if (ua.indexOf("Safari") != -1) {
	$("<link>").attr("type", "text/css").attr("rel", "stylesheet").attr("href", "http://www.willoughbydesign.com/styles/browser-safari/").appendTo("head");
	browser = "safari";
}

$(function(){
	$(".nav-title").click(function(event){$(this).parent().children(":not(span)").toggle();});
	
	$("#main-nav > li").children(":not(span)").hide();
	
	$("#nav-" + parent_page).parent().show();
	
	if (sub_page == "") {
		$("#nav-" + parent_page + " a").addClass("selected");
	} else {
		$("#nav-" + parent_page).children("a").addClass("selected");
		$("#nav-" + sub_page + " a").addClass("selected");
	}
	
	//$("h1").sifr({"path" : "/", "font" : "sifr.swf", "version" : "3"});


	// Forms
	$(".label-input label, .media-input label").click(function(event){$(this).hide();});

	$(".label-input input, .media-input input").blur(function(event){
		if ($(this).val() == "") {$(this).parent().children("label").show();}
	}).click(function(event){$(this).parent().children("label").hide();}).focus(function(event){$(this).parent().children("label").hide();}).val("").oneTime("1s", function(i){
		if ($(this).val() != "") {$(this).parent().children("label").hide();}
	});

	$(".label-input textarea").blur(function(event){
		if ($(this).val() == "") {$(this).parent().children("label").show();}
	}).click(function(event){$(this).parent().children("label").hide();}).focus(function(event){$(this).parent().children("label").hide();});

});