//inicializacia stranky

$(document).ready(function(){
	//$('.simpleMenu li:first-child').addClass('first');
	
	//stromove menu
	//$('.simpleTreeMenu li:first-child').addClass('first');
	//$('.simpleTreeMenu').find('a + ul').prev().click(function(){
	//	var visib=$(this).next().is(':visible');
	//	$(this).next().slideToggle('slow');
	//	var link=$(this).attr('href');
	//	
	//	if (link.length>3 && !visib) $('.middlecolumn').load(link+'/ajax');
	//	return false;
	//});
//	$('.simpleTreeMenu > li').children('ul').css('display','block');
	
	
	//fancy box
	$("a.simpleFancy").fancybox({
		'titleShow': false,
		'zoomOpacity': true,
		'overlayShow': false,
		'transitionIn': 'elastic',
		'zoomSpeedIn': 500,
		'zoomSpeedOut': 500,
		'hideOnContentClick': true,
		'enableEscapeButton': true,
		'showNavArrows': true
	});
	
	//fancy box
	$("a.[rel=product_images]").fancybox({
		'titleShow': false,
		'zoomOpacity': true,
		'overlayShow': false,
		'transitionIn': 'elastic',
		'zoomSpeedIn': 500,
		'zoomSpeedOut': 500,
		'hideOnContentClick': true,
		'enableEscapeButton': true,
		'showNavArrows': true
	});	
  
	
	//uprava produktovej tabulky
	//$('.produkty tr td:last-child').css('border-right','none');
	/*
  var name = 'lightbox[content]';
  $('a[@rel*="lightbox[content]"]').lightBox();
  */    	
  
  $("#header").click(function() {
      if ($("#facebook").width() == 277) {
        $("#facebook").animate(
                {"height": "20px", "width": "99px"},
                "400"
        ); 
        $("#facebook .two").fadeOut("400");
        $("#facebook .one").fadeIn("400");
      }   
      if ($("#kontakt").width() == 210) {
        $("#kontakt").animate(
                {"height": "22px", "width": "101px"},
                "400"
        ); 
        $("#kontakt .two").fadeOut("400");
        $("#kontakt .one").fadeIn("400");
      }          
  });
    
  $("html").click(function() {
      if ($("#facebook").width() == 277) {
        $("#facebook").animate(
                {"height": "20px", "width": "99px"},
                "400"
        ); 
        $("#facebook .two").fadeOut("400");
        $("#facebook .one").fadeIn("400");
      }   
      if ($("#kontakt").width() == 210) {
        $("#kontakt").animate(
                {"height": "22px", "width": "101px"},
                "400"
        ); 
        $("#kontakt .two").fadeOut("400");
        $("#kontakt .one").fadeIn("400");
      }          
  });  
  
  // animovany rychly kontakt
  
  $("#kontakt").click(function() {
    if ($("#kontakt").width() < 210) { 
      $("#kontakt").animate(
              {"height": "160px", "width": "210px", "html": "test"},
              "400"
      );
      $("#kontakt .one").fadeOut("400");
      $("#kontakt .two").fadeIn("400");
      if ($("#facebook").width() == 277) {
        $("#facebook").animate(
                {"height": "20px", "width": "99px"},
                "400"
        ); 
        $("#facebook .two").fadeOut("400");
        $("#facebook .one").fadeIn("400");
      }         
    } else {
      $("#kontakt").animate(
              {"height": "22px", "width": "101px"},
              "400"
      ); 
      $("#kontakt .two").fadeOut("400");
      $("#kontakt .one").fadeIn("400");         
    }
  });
  
  // animovany facebook
  
  $("#facebook").click(function() {
    if ($("#facebook").width() < 277) {
      $("#facebook").animate(
              {"height": "118px", "width": "277px", "html": "test"},
              "400"
      );
      $("#facebook .one").fadeOut("400");
      $("#facebook .two").fadeIn("400");
      // schovame kontakt, ak je rozbaleny
      if ($("#kontakt").width() == 210) {
        $("#kontakt").animate(
                {"height": "22px", "width": "101px"},
                "400"
        ); 
        $("#kontakt .two").fadeOut("400");
        $("#kontakt .one").fadeIn("400");
      }         
    } else {
      $("#facebook").animate(
              {"height": "20px", "width": "99px"},
              "400"
      ); 
      $("#facebook .two").fadeOut("400");
      $("#facebook .one").fadeIn("400");               
    }
  });  
     
});

