/*

	SOFIE VIOLETT PEHRSSON
	2009
	
	www.sofieviolett.se
	
	Author: www.lost-found.se

*/

$(function(){
	// Make the header change depending on time of year and/or time of day
	seasonalHeader();
	
	// Make the menu stop at a certain width
	$(window).resize(function(){
		if ($(window).width() < 1082) {
			$("#menu").css({'right':'', 'left':'750px'});
		} else {
			$("#menu").css({'right':'100px', 'left':''});
		}
	});
	
	$(".storycontent a.fancybox").corner();
	
	$("#searchsubmit").hide();
    
    
    // seasonChooser   function
	$(".sc-1").click(function(){
		$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/winter.jpg')"});
	});
	$(".sc-2").click(function(){
		$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/spring.jpg')"});
	});
	$(".sc-3").click(function(){
		$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/summer.jpg')"});
	});
	$(".sc-4").click(function(){
		$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/autumn.jpg')"});
	});
	
	
	$(document).pngFix();
});


function seasonalHeader() {
	var date = new Date()
	var month = date.getMonth()+1;
	var hour = date.getHours();
	if (hour < 5 | hour > 22) {
		$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/night.jpg')"});
	} else {
		switch(month) {
		 case 12:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/winter.jpg')"});
			break;
		 case 1:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/winter.jpg')"});
			break;
		 case 2:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/winter.jpg')"});
			break;
		 case 3:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/spring.jpg')"});
			break;
		 case 4:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/spring.jpg')"});
			break;
		 case 5:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/spring.jpg')"});
			break;
		 case 6:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/summer.jpg')"});
			break;
		 case 7:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/summer.jpg')"});
			break;
		 case 8:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/summer.jpg')"});
			break;
		 case 9:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/autumn.jpg')"});
			break;
		 case 10:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/autumn.jpg')"});
			break;
		 case 11:
			$("#tear").css({"background":"url('http://sofieviolett.se/ndxz-studio/site/svp/img/seasons/autumn.jpg')"});
			break;
			
		}
	}
	
}