$(document).ready(function(){	
	var msie=jQuery.browser['msie'];
	var version=jQuery.browser['version'];
	var menuDelay=null;
	
	if(msie==false || (msie==true && version>6.0)) {			
		var menu_item=$('ul#mnu>li');
		
		$('ul#mnu').children('li').bind('mouseenter', function(){
			$(this).siblings('li').removeClass('navhover');
			$(this).siblings('li').children('ul').css('z-index', '1');
			$(this).siblings('li').children('ul').css('visibility', 'hidden');
		});
						
		$(menu_item).children('ul').bind('mouseover', function(){
			if(menuDelay) clearTimeout(menuDelay);
			if($(this).parent('li').hasClass('navhover')==false) {
				$(this).parent('li').addClass('navhover');
			}			
		});
		
		$(menu_item).children('ul').bind('mouseout', function(){			
			if($(this).parent('li').hasClass('active')==false) {
				$(this).css('visibility', 'visible');
				$(this).css('z-index', '2');
				var e=this;				
				menuDelay=setTimeout(function(){
					$(e).parent('li').removeClass('navhover');
					$(e).css('visibility', 'hidden');
					$(e).css('z-index', '1');
				}, 1000);
			}
		});		
	}	
	
	/*
	if(msie==true && (version==6.0 || version<6.0)) {
	 alert('Verzi pro staré prohlížeče upravujeme pro korektní zobrazení. Děkujeme za pochopení!');
	}
	*/
	
	//$('table.tab-price thead').click(function(){$(this).next('tbody').toggle();});
	
	$(".stripeMe tr").mouseover(function() {
		$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");
	});
	$(".stripeMe tr:even").addClass("alt");
	
	$('.qtip-cenik').each(function() {
    $(this).qtip({
     		position: {target:'mouse'},
        content: $(this).children('span').html(),
        style: {
            border: {
               width: 5,
               radius: 10
            },
            padding: 10, 
            tip: true, 
            name: 'red' 
         }
      }
    );  
   });
	
	$('a.verze-tisk ').show();
	$('a.verze-tisk').click(function(){
		$('body').prepend(
			"<p class='info-nahled-tisk'>Tip:<br /><br />Pokud chcete vytisknout tabulky včetně pozadí a ohraničení, musíte si tuto volbu zaškrtnout v nastavení vašeho prohlížeče. <br /> <br /><strong>Mozilla Firefox:</strong> Soubor &gt; Vzhled stránky &gt; záložka Formáty a možnosti <br /><br /> <strong>Internet Explorer:</strong> Nástroje &gt; Možnosti internetu &gt; záložka Upřesnit (Nastavení) <br /><br /> Pokud se chcete vrátit zpět na klasické zobrazení stránky, <a href='#' onclick='location.reload(); return false;'>klikněte na tlačítko Obnovit</a> nebo zmáčkněte klávesu F5.</p>"
		);
		showPrint();    
	});
	
	$('a.poslat-odkaz').attr('href',PROJECT_ROOT+'/sendFriendForm.php?iframe=false&height=300&width=400&lang=cs&url='+self.location.href);
	
	//prozatim pripojeno v main.js - prettyPhoto se musi poustet jen jednou, jinak to blbne
	/*$('a.poslat-odkaz').prettyPhoto({
		theme: 'light_square',
		showTitle: false,
		animationSpeed: 'fast'
	});*/
	
	//kulate rohy
	$('.rounded10').cornerz({radius: 10, corners: "bl br"});
	$('#bcrumb').cornerz({radius: 3});
	$('#menu ul li ul').cornerz({radius:5, corners: "bl br"});
	$('#col1 #alt-menu').cornerz({radius:5, corners: "bl br"});
	$('#col1 #alt-menu h2').cornerz({radius:5, corners: "tl tr"});	
});

function showPrint()  {
  if(document.styleSheets[0].disabled==true)  {
    document.styleSheets[0].disabled=false;     
  }
  else  {
    document.styleSheets[0].disabled=true;
    var cssTisk = document.createElement('link');
    cssTisk.setAttribute('rel','stylesheet');
    cssTisk.setAttribute('type','text/css');
    cssTisk.setAttribute('href','http://www.centrumbabylon.cz/prnt.css');
    cssTisk.setAttribute('media','screen');
    document.getElementsByTagName('head').item(0).appendChild(cssTisk);
  }
}

function afterSendLink(responseText) {
	if(responseText=='TRUE') {
		$.prettyPhoto.close();
		showMessage("event", 'Link byl uspesne odeslan.', 1);
	}else{
		showMessage("error", 'Chyba pri zpracovani formulare. Zkontrolujte prosim, zda mate vyplnene spravne jednotlive polozky', 1);
	}
}
