var prefix = document.location.host == "playfractal.com" ? "www." : "" ;
if(prefix == "www."){
	document.location.href = "http://" + prefix + document.location.href.substr(7);
}


$(document).ready(function(){
	init_page();
	
	$("#content .list li a").click(function(){
		if($(this).parent().hasClass('active')){
			$(this).next("p").slideUp('medium');
			$(this).parent().removeClass('active');
		}else{
			$(this).next("p").slideDown('medium');
			$(this).parent().addClass('active');
		}
		$(this).blur();
		return false;
	});
	
	
	$("#email_input").attr("value", "type email");
	
	$("#email_input").focus(function(){
		if($(this).attr("value") == "type email"){
			$(this).attr("value", "");
		}	
	})
	
	$("#email_input").blur(function(){
		if($(this).attr("value") == ""){
			$(this).attr("value", "type email");
		}	
	})
	
	$(".toggle").click(function(){
		if($(this).attr('rel') == 'active'){
			$(this).prev("ul").children("li").removeClass('active').children("p").slideUp("medium");
			$(this).children('a').html("show all");
			$(this).attr('rel', '');
		}else{
			show_section( $(this) );
		}
		$(this).blur();
		return false;
	});
	
	$(".expand").click(function(){
		show_section($('#' + $(this).attr('rel')).children(".toggle"));
		$(this).blur();
	});
})

function show_section( ulLink ){
	ulLink.parent().children("ul").children("li").addClass('active').children("p").slideDown("medium");
	ulLink.children('a').html("hide all");
	ulLink.attr('rel', 'active');
	return false;
}


function init_page(){

	//sIFR

	if(typeof sIFR == "function")
	{
		sIFR.replaceElement("#influences h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#cc9445"}));
	
		sIFR.replaceElement("#screenshots h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#673b99"}));	
		sIFR.replaceElement("#modes h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#c2cb2d"}));			
		sIFR.replaceElement("#credits h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#565656"}));	
		sIFR.replaceElement("#release h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#cb2d2d"}));			
		sIFR.replaceElement("#reviews h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#cb2d2d"}));			
		sIFR.replaceElement("#subscribe h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#ffae00"}));			
		sIFR.replaceElement("#preface h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#2da8cb"}));	
		sIFR.replaceElement("#howto h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#fd2298"}));			
		
		sIFR.replaceElement("#techinfo h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#007506"}));
		sIFR.replaceElement("#techteaser h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#007506"}));	
		sIFR.replaceElement("#techdown h2", named({sFlashSrc: "/swf/univers.swf", sCase: "upper", sWmode: "transparent", sColor: "#007506"}));	
				
	};

}