﻿
$('#sm1').hide();	
$('#sm2').hide();
$('#sm3').hide();
$('#sm4').hide();
$('#sm5').hide();

$(document).ready(function(){
	//alert(window.location);


	var url = document.URL;
	if(url.match("sms-") || url.match("-sms") || url.match("meniny-mena-datumy"))
	{
		//alert("sms");
		$('#m1').css("textDecoration","underline");	
		$('.submenu').hide();
		$('#sm1').show();
	}
	else if(url.match("vtipy") || url.match("vtip"))
	{
		$('#m2').css("textDecoration","underline");	
		$('.submenu').hide();
		$('#sm2').show();
	}
	else if(url.match("pozadi") || url.match("temy"))
	{
		$('#m3').css("textDecoration","underline");	
		$('.submenu').hide();
		$('#sm3').show();
	}
	else if(url.match("darcek"))
	{
		$('#m4').css("textDecoration","underline");	
		$('.submenu').hide();
		$('#sm4').show();
	}
	else if(url.match("kontakt") || url.match("reklama") || url.match("o-nas"))
	{
		$('#m5').css("textDecoration","underline");	
		$('.submenu').hide();
		$('#sm5').show();
	}

	//$('#sm1').show();	
	//$('#sm1').fadeIn(700);
	//$('#sm2').hide();
	//$('#sm3').hide();
	//$('#sm4').hide();
	//$('#sm5').hide();

	//animate top banner
	$('#banner').hide();
	$('#banner').fadeIn(700);

	//animate statements divs
	//$('.statement').css("backgroundColor","#202020").fadeIn(700);	
	$('.statement').css("backgroundColor","#202020").show();

	//load first random statement text
	$('#sChange').load("statement.aspx", function(){
		$("#loading").hide();
		$('#sChange').fadeIn(1000);
	});	
	
	//on next statement click
	$("#sNext").click(function(){
		$('#sChange').hide();
		$("#loading").show();

		//random number like parameter to statement.aspx, only for fix IE problem with cashing
		var rand = Math.random(1000);
		$('#sChange').load("statement.aspx?rand=" + rand, function(){
			$("#loading").hide();
			$('#sChange').fadeIn(1000);
		});			
	});

	//menu actions
	$("#m1").mouseover(function(){
		//hide all visible submenys
		$('.submenu').hide();
		//show submenu1
		$('#sm1').show();
	});

	$("#m2").mouseover(function(){
		$('.submenu').hide();
		$('#sm2').show();
	});

	$("#m3").mouseover(function(){
		$('.submenu').hide();
		$('#sm3').show();
	});

	$("#m4").mouseover(function(){
		$('.submenu').hide();
		$('#sm4').show();
	});

	$("#m5").mouseover(function(){
		$('.submenu').hide();
		$('#sm5').show(0);
	});
	
	//menu selected
	

});