$(document).ready(function(){
	$(function() {
	  $("a[rel^='lightbox']").lightbox();
	}); 
	$("#topmenu2>li:last").css("margin-right","0"); 
  $("#topmenu2>li").hover(function() {
    $("#topmenu2>li").removeClass("now")
    $("#topmenu2>li").css("margin-right","1px").css("margin-left","0px");
    $(this).addClass("now")
    if($("#topmenu2 li:last").hasClass("now")) { $(this).css("margin-right","0px").css("margin-left","5px"); }
    else {$(this).css("margin-left","0px").css("margin-right","5px");}    
  });
	$('#vip').lofJSidernews( {interval:4000,
   direction:'opacity',
   duration:1000,
   easing:'easeInOutSine'
  }); 
  
  
  $('.manikura td a').click(function(){
  if ($(this).parents("tr").next('tr.none').css("display") == "none") { $(this).parents("tr").next('tr').removeClass("none"); }
  else { $(this).parents("tr").next('tr').addClass("none"); }
  return false;
});
});

/* rezervace tooltip*/
$(function(){
  $(".rezervovano[title]").mbTooltip({ // also $([domElement]).mbTooltip
    opacity : .80,       //opacity
    wait:300,           //before show
    cssClass:"default",  // default = default
    timePerWord:5000,      //time to show in milliseconds per word
    hasArrow:false,                 // if you whant a little arrow on the corner
    hasShadow:false,
    imgPath:"/admin/pic/",
    anchor:"parent", //or "parent/mouse" you can ancor the tooltip to the mouse  or to the element
    shadowColor:"black", //the color of the shadow
    mb_fade:200 //the time to fade-in
  });
});

/* kalndar */
$(function() {
	$("#date").datepicker({ minDate: -20, maxDate: "+1M +10D" });
});

/* virtualni prochazka */
function newelement(newid)
{ 
    if(document.createElement)
    { 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style)
        { 
            left = '190px';
            top = '100px';
						display = 'none';
        } 
        el.innerHTML = '&nbsp;'; 
        document.getElementById('mapa-centra').appendChild(el); 
    } 
}

function posunX(poziceX) {
	var tempX = document.getElementById('tooltip').style.left;
	var tempX = tempX.replace("px", "");
	var rozdilX = poziceX - tempX;
		
	if (Math.abs(rozdilX) != 0) {
		if (rozdilX > 0) {
			var pulkaX = Math.floor(rozdilX/2)
		} else {
			var pulkaX = Math.round(rozdilX/2)
		}
		var bbbX = poziceX - pulkaX;
		document.getElementById('tooltip').style.left = bbbX+'px';
		aaaX = poziceX;
		setTimeout("posunX(aaaX);", 30);
	}
}

function posunY(poziceY) {
	var tempY = document.getElementById('tooltip').style.top;
	var tempY = tempY.replace("px", "");
	var rozdilY = poziceY - tempY;
		
	if (Math.abs(rozdilY) != 0) {
		if (rozdilY > 0) {
			var pulkaY = Math.floor(rozdilY/2)
		} else {
			var pulkaY = Math.round(rozdilY/2)
		}
		var bbbY = poziceY - pulkaY;
		document.getElementById('tooltip').style.top = bbbY+'px'; 
		aaaY = poziceY;
		setTimeout("posunY(aaaY);", 30);
	}
}

function oznacPopis(popis,xpos,ypos) {
		if(!document.getElementById('tooltip')) newelement('tooltip');
    var ukaz_tooltip = document.getElementById('tooltip');
    if(!popis) {popis='<br />'};
    ukaz_tooltip.innerHTML = popis;
    ukaz_tooltip.style.display = 'block';
		posunX(xpos);
		posunY(ypos);
}
/* virtualni prochazka konec */

function zmenahesla() {

 if (document.zmena.stare.value== ""){
			alert("Prosím, vložte své staré heslo!");
    document.zmena.stare.focus();
    document.zmena.stare.select();
			return false;
			}
 if (document.zmena.nove1.value== ""){
			alert("Prosím, vložte své nové heslo!");
    document.zmena.nove1.focus();
    document.zmena.nove1.select();
			return false;
			}
 if (document.zmena.nove2.value== ""){
			alert("Prosím, vložte znovu své nové heslo!");
    document.zmena.nove2.focus();
    document.zmena.nove2.select();
			return false;
			}
 if (document.zmena.nove1.value != document.zmena.nove2.value){
			alert("Nové heslo a potvrzující heslo nejsou shodné!");
    document.zmena.nove1.focus();
    document.zmena.nove1.select();
			return false;
			}

}
re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;
function KontrolaTurnaje() {

if (document.formturnaje.turnaj.selectedIndex == 0){
		alert("Prosím, vyberte druh turnaje");
    document.formturnaje.turnaj.focus();
    document.formturnaje.turnaj.select();
			return false;
		}
			
 if (document.formturnaje.datum.value== ""){
			alert("Prosím, vložte datum!");
    document.formturnaje.datum.focus();
    document.formturnaje.datum.select();
			return false;
			}
 if (document.formturnaje.hrac.value== ""){
			alert("Prosím, vložte své jméno!");
    document.formturnaje.hrac.focus();
    document.formturnaje.hrac.select();
			return false;
			}
 if (document.formturnaje.telefon.value== ""){
			alert("Prosím, vložte znovu své telefonní číslo!");
    document.formturnaje.telefon.focus();
    document.formturnaje.telefon.select();
			return false;
			}
 if (document.formturnaje.email.value== ""){
			alert("Prosím, vložte svůj email");
    document.formturnaje.email.focus();
    document.formturnaje.email.select();
			return false;
			}
	
	if ( document.formturnaje.email.value != "" ) {
		if (re.test(document.formturnaje.email.value) == 0) {
			alert ("E-mailová adresa není správná");
			document.formturnaje.email.focus();
			document.formturnaje.email.select();
			return false;
		}
	}
}
function kontrola() {
	
  if (document.uprav.jmeno.value== ""){
			alert("Prosím, vložte své jméno");
    document.uprav.jmeno.focus();
    document.uprav.jmeno.select();
			return false;
			}
			
  if (document.uprav.prijmeni.value== ""){
			alert("Prosím, vložte své příjmení");
    document.uprav.prijmeni.focus();
    document.uprav.prijmeni.select();
			return false;
	   }
	
 

 if (document.uprav.email.value== ""){
			alert("Prosím, vložte svůj email");
    document.uprav.email.focus();
    document.uprav.email.select();
			return false;
			}

//	Kontrola e-mailu
	if ( document.uprav.email.value != "" ) {
		if (re.test(document.uprav.email.value) == 0) {
			alert ("E-mailová adresa není správná");
			document.uprav.email.focus();
			document.uprav.email.select();
			return false;
		}
	}
 if (document.uprav.telefon.value== ""){
			alert("Prosím, vložte svůj telefon");
    document.uprav.telefon.focus();
    document.uprav.telefon.select();
			return false;
			}
}
