$(document).ready(function() {   
	$("#header .nav a img").each(function(obj) {
		$(this).mouseover(function () {
			this.src = $(this).attr("hsrc");
		}).mouseout(function() {
			this.src = $(this).attr("original");
		}).attr("original",this.src);
	});
});
$(window).load(function() {
	$("#header .nav a img").each(function(obj) {
		$("<img>").attr("src",$(this).attr("hsrc"));
	});
});
var slideshow = {
	"data" : [],
	"currentIndex" : 0,
	"timer" : null,
	"panel" : "#mediapanel",
	"interval" : 5200,
	"fadeSpeed" : "slow",
	"init" : function(data) {
		slideshow.data = data;
		for(var m in slideshow.data) {
			$("<img>").attr("src",slideshow.data[m]);
		}
		slideshow.panel = $(slideshow.panel).empty().append("<img />");
		slideshow.panel.children("img").attr("src",slideshow.data[0]);
		$(window).load(slideshow.go);
	},
	"next" : function() {
		slideshow.timer = setTimeout(slideshow.next,slideshow.interval);
		slideshow.currentIndex = slideshow.currentIndex+1;
		if(slideshow.currentIndex >= slideshow.data.length) slideshow.currentIndex = 0;
		slideshow.panel.children("div").remove();
		var img = slideshow.panel.append("<div style=\"position: absolute; left: 0px; top: 0px;\" ><img /></div>").find("div img");
		img.hide().attr("src",slideshow.data[slideshow.currentIndex]).fadeIn(slideshow.fadeSpeed,function() {
			slideshow.panel.children("img").attr("src",slideshow.data[slideshow.currentIndex]);
			slideshow.panel.children("div").remove();
		});
	},
	"go" : function() {
		slideshow.timer = setTimeout(slideshow.next,slideshow.interval);
	}
};
$(document).ready(function(){
	$("input[type=text][placeholder]").focus(function(){
		if(this.value==this.placeholder) this.value = "";
		$(this).removeClass("placeholding");
	}).blur(function() {
		if(this.value=="") {this.value = this.placeholder; $(this).addClass("placeholding")};
	}).blur().parents("form:last").submit(function() {
		$(this).find("input[type=text][placeholder]").each(function() {
			if(this.value==this.placeholder) this.value = "";
		});
	});
})