$(document).ready(function() {

 //Cufon.replace('#newsletter span',{fontFamily: 'Wide Latin'})
 Cufon.replace('.menu a, #virtual a', {hover: true, fontFamily: 'Wide Latin' });
 Cufon.replace('a#week, a#akce', {hover: true, fontFamily: 'Clarendon' });
 Cufon.replace('#contact-form span', {fontFamily: 'Clarendon' });
 Cufon.replace('#photo-menu li a', {hover: true, fontFamily: 'Wide Latin' });
 // Cufon.replace('.paging a', {hover: true, fontFamily: 'Wide Latin' });
 Cufon.replace('.menu2 a', {hover: true, fontFamily: 'Clarendon', fontSize: '20px' });
 
 //$('#newsletter span, .menu a, .menu2 a, a#week, #contact-form span, #photo-menu li a, .paging a').css("visibility","visible");
 $('.menu a, .menu2 a, a#week, a#akce, #contact-form span, #photo-menu li a, .paging a').css("visibility","visible");
 
 if ($("a[rel^='fancybox']").length != 0) $("a[rel^='fancybox']").fancybox({
  overlayColor: "#000",
  overlayOpacity: 0.8,
  titlePosition: 'inside'
 }); 
 
 $(".scrollable").scrollable().navigator({navi:'.paging'});
 
 $(".items img").click(function() {

		// see if same thumb is being clicked
		if ($(this).hasClass("active")) { return; }

		// calclulate large image's URL based on the thumbnail URL (flickr specific)
		var url = $(this).attr("src").replace("_a", "_b");
		var url2 = $(this).attr("src").replace("_a", "_c");

		// get handle to element that wraps the image and make it semi-transparent
		var wrap = $("#image_wrap div").fadeTo("medium", 0.5);

		// the large image from www.flickr.com
		var img = new Image();

		// call this function after it's loaded
		img.onload = function() {
			// make wrapper fully visible
			wrap.fadeTo("fast", 1);
			// change the image
			wrap.find("img").attr("src", url);
			wrap.find("a").attr("href", url2);
		};

		img.src = url;

		// activate item
		$(".items img").removeClass("active");
		$(this).addClass("active");

 // when page loads simulate a "click" on the first image
 }).filter(":first").click();

	$("#wantnews2").click(function(){
		if($('input[name="news"]').val().match(/^([A-Za-z0-9-_]+(\.?[_A-Za-z0-9-]+)*){2,}@([A-Za-z0-9-_]+(\.[A-Za-z0-9-_]+)*){2,}(\.[A-Za-z]{2,3})$/)){
			$('input[name="news"]').css('background-color', 'transparent');
			$("#fnews").submit();
			return false;
		}
		else{
			$('input[name="news"]').css('background-color', '#f04231');
		}
	});
  
});

function initialize() {
 var latlng = new google.maps.LatLng(50.107830, 14.450127);
 var myOptions = {zoom: 16, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
 var map = new google.maps.Map(document.getElementById("map"), myOptions);   
 var marker = new google.maps.Marker({position: latlng, map: map, title:"7 Tacos"});
}
  
function showNewsletterForm() {
	$('#searchForm').hide();
	$('#newsletterForm').slideToggle('slow');
}

function checkForm(myForm) {
	
	/*
	regMail = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");		
	if (form.email.value == "" || !regMail.test(form.email.value)){
		alert("Zadejte korektne Váš email!");
		form.email.focus();
		return false;
	}
	 */
}


