﻿Cufon.replace("div#slides h1");
Cufon.replace("div#sub-nav li", {hover: true});
Cufon.replace("div#footer-nav");
Cufon.replace("div#footer p#author");
Cufon.replace("a.more");
Cufon.replace("div#nav > ul > li > a");
Cufon.replace("#content h1");
Cufon.replace("#content h2");
Cufon.replace("#content h3");
Cufon.replace("#content h4");
Cufon.replace("#side div#choice-list",	 {hover: true});
Cufon.replace("#side h3");


var id = 0;
var slideSwitch = function() {
	$('div#banner div:eq('+id+')').fadeOut(function(){
		id = (id + 1) % 3;
		$('div#banner div:eq('+id+')').fadeIn(2000);
	});
}

var timer = setInterval( "slideSwitch()", 7000 );	

$(document).ready(function(){


	$('div#slides div:gt(0)').hide();	

	// Przelaczanie kart
	$('div#sub-nav li').click(function(event){
		var id = $(this).index('div#sub-nav ul li');

		
		$('div#sub-nav li').removeClass('active');
		$(this).addClass('active');
		$('div#slides div').hide();
		$('div#slides div:eq('+id+')').show();

		Cufon.refresh('div#sub-nav li');
		event.preventDefault();

	});

	// dialog
	$('div#content div.sidebox-message div.side-box-wrapper div.side-box form input.submit-message').click(function(event){

	$('div#content div.sidebox-message').hide();
		
	//	Cufon.refresh('div#sub-nav li');
	event.preventDefault();

	});

	
		// dodanie koemntarza
	$('form#article_comment input.submit').click(function(event){
	
	//var key=$('form#article_comment input#formkey').val();
	//alert('key='+key);

		$('form#article_comment input#hidden_key').val('ABC');
	//var key2=$('form#article_comment input#formkey').val();

	//alert('key2='+key2);

//	event.preventDefault();

	});


	
///////////////////////////
	
//	var timer = setInterval( "sayHello2()", 20000 );	

	//////////////////////////
	
	var $dropdowns = $('div#nav > ul > li > div');
	
//	$dropdowns.css("opacity","1"); 
	$dropdowns.hide();
	$dropdowns.parent().hover(function(){
//			$(this).children("div").fadeIn('slow');
			$(this).children("div").show();
		$(this).addClass("expand");
	}, function(){
		$(this).children("div").hide();
		$(this).removeClass("expand");
	});

	var $deep_dropdowns = $('div#nav ul li div ul li div');
	$deep_dropdowns.hide();
	$deep_dropdowns.parent().hover(function(){
//	alert('123');

		$(this).children("div").fadeIn('slow');
//		$(this).children("div").show();
/*		
		 $(this).children("div").animate({
    width: "100%",
    opacity: 0.4,

    fontSize: "3em",
    borderWidth: "10px"
  }, 1500 );

		
	*/	
		
	}, function(){
	
		$(this).children("div").fadeOut('slow');
	});

	$('div#nav > ul > li > a').parent().has('div').each(function(){
		$(this).click(function(event){
			if(event.target == "[object HTMLCanvasElement]" || event.target == "[object HTMLGenericElement]" || event.target == "[object]" )
				event.preventDefault();
		});
	});

	$('div#nav div div').parent().children('a').each(function(){
			$(this).addClass('extended');
			$(this).click(function(event){
				event.preventDefault();
			});
	});

	$('table').each(function(){
			$(this).children("tbody").children("tr:gt(0):even").addClass('even');
	});

});



