$(document).ready(function() {
	//mainMenu();
	//BackSite();
	
	Shadowbox.init();
	
	Select(1);
	Select(2);
	Select(3);
	Select(4);
	Select(5);
	
	NewsletterSelect();
	
	jQuery("#carousel-1").jcarousel({
        scroll: 1,
        initCallback: mycarousel_1_initCallback,
        itemFirstInCallback: {
			onAfterAnimation: mycarousel_1_itemFirstInCallback_onAfterAnimation
		}
    });
    jQuery("#carousel-2").jcarousel({
        scroll: 1,
        initCallback: mycarousel_2_initCallback,
        itemFirstInCallback: {
			onAfterAnimation: mycarousel_2_itemFirstInCallback_onAfterAnimation
		}
    });
    jQuery("#carousel-3").jcarousel({
        scroll: 1,
        initCallback: mycarousel_3_initCallback,
        itemFirstInCallback: {
			onAfterAnimation: mycarousel_3_itemFirstInCallback_onAfterAnimation
		}
    });
    jQuery("#carousel-4").jcarousel({
        scroll: 1,
        initCallback: mycarousel_4_initCallback
    });
    jQuery("#carousel-5").jcarousel({
        scroll: 1,
        initCallback: mycarousel_5_initCallback
    });
    jQuery("#carousel-6").jcarousel({
        scroll: 1,
        initCallback: mycarousel_6_initCallback
    });
    jQuery("#carousel-7").jcarousel({
        scroll: 1,
        initCallback: mycarousel_7_initCallback
    });
    
    jQuery("#carousel-10").jcarousel({
        scroll: 1,
        initCallback: mycarousel_10_initCallback
    });
    
    jQuery("#carousel-11").jcarousel({
        scroll: 1,
        initCallback: mycarousel_11_initCallback,
        itemFirstInCallback: {
			onAfterAnimation: mycarousel_11_itemFirstInCallback_onAfterAnimation
		}
    });
    
    jQuery("#carousel-12").jcarousel({
        scroll: 1,
        initCallback: mycarousel_12_initCallback,
        itemFirstInCallback: {
			onAfterAnimation: mycarousel_12_itemFirstInCallback_onAfterAnimation
		}
    });
});

CufonReplace();

function mainMenu()
{
	$("#mainMenu a").each(function(i)
	{
		$(this).hover(
			function()
			{
				$(this).animate({ fontSize: 18 }, 150);
				$(this).css("color", "#e81c2b");
			},		
			function()
			{
				$(this).animate({ fontSize: 17 }, 150);
				$(this).css("color", "#D7D7D7");
			}
		);
	});
}

function BackSite()
{
	cont = 0;
	
	$("#siteBackSlider").height( $("#innerWrapper").height() );
	$("#siteBackSliderShadow").height( $("#innerWrapper").height() );
	
	currentSliderId = 1;
	nextSliderId = -1;
	
	$("#slider1").animate({ top: -100 }, 10000);
	
	setInterval ( function(){
		if( $("#slider"+currentSliderId).is(":visible") )
		{	
			$("#slider"+currentSliderId).fadeOut(2000, function(){
				nextSliderId = currentSliderId + 1;
				if(nextSliderId > 6)
				{
					nextSliderId = 1;
				}
				$("#slider"+nextSliderId).fadeIn(2000);
				currentSliderId = nextSliderId;
				cont = 0;
				$("#slider"+nextSliderId).animate({ top: -100 }, 10000);
			});
		}
	}, 10000 );
	/*
	previousX = -1;
	currentX = -1;
	
	setInterval ( function(){
		
		cont ++;
		
		$(document).mousemove(function(e){
			currentX = e.pageX;
			return;
		});
		
		sliderTime = 10000 - 500 * cont;
		
		sliderLeft = 0;
		if(50 - 2.5 * cont > 0)
			sliderLeft = 50 - 2.5 * cont;
		//$("#log").append(sliderLeft + ' ');
		
		if(currentX > previousX)
		{
			if(nextSliderId==-1)
			{
				$("#slider1").stop().animate({ top: -100, left: '+='+sliderLeft }, sliderTime);
			}
			else
			{
				$("#slider"+nextSliderId).stop().animate({ top: -100, left: '+='+sliderLeft }, sliderTime);
			}
		}
		if(currentX < previousX)
		{
			if(nextSliderId==-1)
			{
				$("#slider1").stop().animate({ top: -100, left: '-='+sliderLeft }, sliderTime);
				
			}
			else
			{
				$("#slider"+nextSliderId).stop().animate({ top: -100, left: '-='+sliderLeft }, sliderTime);
			}
		}
		
		previousX = currentX;
		//$("#log").append(previousX + ' ' + previousY + ' : ' + currentX + ' ' + currentY + '<br />');
	}, 500 );
	*/
}

function HomePageImage(id, image)
{
	$("#homePageImage" + id).attr("src", "inc/img/page/2/" + image + ".jpg");
	if( $("#homePageText" + id).css("display")=="none" )
	{
		$("#homePageText" + id).css("display", "block");
	}
	else
	{
		$("#homePageText" + id).css("display", "none");
	}
}

function RestaurantImage(id, image, page)
{
	$("#genericImage" + id).attr("src", "inc/img/page/" + page + "/" + image + ".jpg");
}

function RestaurantImageClick(id, type, value)
{
	$(".galleryExtension").show();
	$(".galleryExtension").children().hide();
	$("#galleryExtension"+id).show();
	$("#galleryExtensionClose").show();
	
	if(type=="horizontal")
	{
		slideValue = value - 607;
		
		$("#galleryExtension"+id).animate({ left: -slideValue }, 20000);
		$("#galleryExtension"+id).animate({ left: 0 }, 20000);
		setInterval ( function(){
			$("#galleryExtension"+id).animate({ left: -slideValue }, 20000);
			$("#galleryExtension"+id).animate({ left: 0 }, 20000);
		}, 40000 );
	}
	if(type=="vertical")
	{
		slideValue = value - 500;
		
		$("#galleryExtension"+id).animate({ top: -slideValue }, 20000);
		$("#galleryExtension"+id).animate({ top: 0 }, 20000);
		setInterval ( function(){
			$("#galleryExtension"+id).animate({ top: -slideValue }, 20000);
			$("#galleryExtension"+id).animate({ top: 0 }, 20000);
		}, 40000 );
	}
	
}

function RestaurantGalleryCloseOver()
{
	$("#galleryExtensionClose").css("background", "url(inc/img/restaurantGallery2.jpg) left top no-repeat");
}

function RestaurantGalleryCloseOut()
{
	$("#galleryExtensionClose").css("background", "url(inc/img/restaurantGallery1.jpg) left top no-repeat");
}

function RestaurantGalleryCloseClick()
{
	$(".galleryExtension").hide();
	$("#galleryExtensionClose").hide();
}

function MenuImageOver(id)
{
	$("#menuImage" + id).attr("src", "inc/img/menu/_" + id + ".jpg");
}

function MenuImageOut(id)
{
	$("#menuImage" + id).attr("src", "inc/img/menu/" + id + ".jpg");
}

function ChefImageOver(id)
{
	$("#chefImage" + id).attr("src", "inc/img/chef/_" + id + ".jpg");
}

function ChefImageOut(id)
{
	$("#chefImage" + id).attr("src", "inc/img/chef/" + id + ".jpg");
}





function GenericImage(id, image, page)
{
	$("#genericImage" + id).attr("src", "inc/img/page/" + page + "/" + image + ".jpg");
	$(".galleryExtension").children().hide();
	$("#galleryExtensionImage"+id).show();
	$("#galleryExtensionPrice"+id).show();
	$("#galleryExtensionDescription"+id).show();
}


function ProductImage(id, image)
{
	$("#productImage" + id).attr("src", "inc/img/product/" + image + ".jpg");
	$(".galleryExtension").children().hide();
	$("#galleryExtensionImageLink"+id).show();
	$("#galleryExtensionImage"+id).show();
	$("#galleryExtensionPrice"+id).show();
	$("#galleryExtensionDescription"+id).show();
}


function ContactSubmitOver()
{
	$("#contactSubmit").css("background", "url(inc/img/contactSubmit2.jpg) left top no-repeat");
}
function ContactSubmitOut()
{
	$("#contactSubmit").css("background", "url(inc/img/contactSubmit1.jpg) left top no-repeat");
}

function NewsletterSubmitOver()
{
	$("#newsletterSubmit").css("background", "url(inc/img/newsletter2.jpg) left top no-repeat");
}
function NewsletterSubmitOut()
{
	$("#newsletterSubmit").css("background", "url(inc/img/newsletter1.jpg) left top no-repeat");
}

function EventsListItemOver(id)
{
	$("#eventsListItem"+id).css("background-color", "#e81c2b");
	$("#eventsListItem"+id).css("cursor", "pointer");
	$("#eventsListItem"+id+" .title a").css("color", "#ffffff");
}

function EventsListItemOut(id)
{
	$("#eventsListItem"+id).css("background-color", "transparent");
	$("#eventsListItem"+id).css("cursor", "auto");
	$("#eventsListItem"+id+" .title a").css("color", "#e81c2b");
}

///////////////////////////
function BuyListItemOver(id)
{
	$("#buyListItem"+id).css("background-color", "#e81c2b");
	$("#buyListItem"+id).css("cursor", "pointer");
	$("#buyListItem"+id+" .title a").css("color", "#ffffff");
	
	$("#buyImage" + id).attr("src", "inc/img/buy/_" + id + ".jpg");
}
function BuyListItemOut(id)
{
	$("#buyListItem"+id).css("background-color", "transparent");
	$("#buyListItem"+id).css("cursor", "auto");
	$("#buyListItem"+id+" .title a").css("color", "#e81c2b");
	
	$("#buyImage" + id).attr("src", "inc/img/buy/" + id + ".jpg");
}
function BuyImageOver(id)
{
	$("#buyImage" + id).attr("src", "inc/img/buy/_" + id + ".jpg");
	
	$("#buyListItem"+id).css("background-color", "#e81c2b");
	$("#buyListItem"+id).css("cursor", "pointer");
	$("#buyListItem"+id+" .title a").css("color", "#ffffff");
}
function BuyImageOut(id)
{
	$("#buyImage" + id).attr("src", "inc/img/buy/" + id + ".jpg");
	
	$("#buyListItem"+id).css("background-color", "transparent");
	$("#buyListItem"+id).css("cursor", "auto");
	$("#buyListItem"+id+" .title a").css("color", "#e81c2b");
}
/////////////////////////////////

function EventCloseOver()
{
	$("#carousel-close-6").css("background", "url(inc/img/restaurantGallery2.jpg) left top no-repeat");
}
function EventCloseOut()
{
	$("#carousel-close-6").css("background", "url(inc/img/restaurantGallery1.jpg) left top no-repeat");
}
function EventPrevOver()
{
	$("#carousel-6-prev").css("background", "url(inc/img/eventGalleryPrev3.jpg) left top no-repeat");
}
function EventPrevOut()
{
	$("#carousel-6-prev").css("background", "url(inc/img/eventGalleryPrev2.jpg) left top no-repeat");
}
function EventNextOver()
{
	$("#carousel-6-next").css("background", "url(inc/img/eventGalleryNext3.jpg) left top no-repeat");
}
function EventNextOut()
{
	$("#carousel-6-next").css("background", "url(inc/img/eventGalleryNext2.jpg) left top no-repeat");
}

function BuyCloseOver()
{
	$("#buyClose").css("background", "url(inc/img/restaurantGallery2.jpg) left top no-repeat");
}
function BuyCloseOut()
{
	$("#buyClose").css("background", "url(inc/img/restaurantGallery1.jpg) left top no-repeat");
}

///////////////////////////
function PressListItemOver(id)
{
	$("#pressListItem"+id).css("background-color", "#e81c2b");
	$("#pressListItem"+id).css("cursor", "pointer");
	$("#pressListItem"+id+" .title a").css("color", "#ffffff");
	
	$("#pressImage" + id).attr("src", "inc/img/press/_" + id + ".jpg");
}
function PressListItemOut(id)
{
	$("#pressListItem"+id).css("background-color", "transparent");
	$("#pressListItem"+id).css("cursor", "auto");
	$("#pressListItem"+id+" .title a").css("color", "#e81c2b");
	
	$("#pressImage" + id).attr("src", "inc/img/press/" + id + ".jpg");
}
function PressImageOver(id)
{
	$("#pressImage" + id).attr("src", "inc/img/press/_" + id + ".jpg");
	
	$("#pressListItem"+id).css("background-color", "#e81c2b");
	$("#pressListItem"+id).css("cursor", "pointer");
	$("#pressListItem"+id+" .title a").css("color", "#ffffff");
}
function PressImageOut(id)
{
	$("#pressImage" + id).attr("src", "inc/img/press/" + id + ".jpg");
	
	$("#pressListItem"+id).css("background-color", "transparent");
	$("#pressListItem"+id).css("cursor", "auto");
	$("#pressListItem"+id+" .title a").css("color", "#e81c2b");
}
/////////////////////////////////

function NewsletterEmailBlur()
{
	if( $("#newsletterEmail").val()=='' || $("#newsletterEmail").val()=='Adresa email' )
	{
		$("#newsletterEmail").val("Adresa email");
	}
}
function NewsletterEmailFocus()
{
	
		$("#newsletterEmail").val("");
	
}


function CufonReplace()
{
	Cufon.replace('.innerTitle');
	Cufon.replace('.innerSubTitle');
	Cufon.replace('.innerSubSubTitle');
	Cufon.replace('.menuInnerTitle');
	Cufon.replace('.menuInnerSubTitle');
	Cufon('#mainMenu a', {
		hover: {
			fonSize: '17px',
			color: '#e81c2b'
		}
	});
	Cufon('#mainMenu .subMenu a', {
		hover: {
			fonSize: '15px',
			color: '#e81c2b'
		}
	});
	Cufon('#menuPage .menuSuperTopLink a', {
		hover: {
			fonSize: '22px',
			color: '#f17171'
		}
	});
	Cufon('#menuPage .menuTopLink a', {
		hover: {
			fonSize: '20px',
			color: '#f17171'
		}
	});
	Cufon('#menuPage .menuBottomLink a', {
		hover: {
			fonSize: '26px',
			color: '#f17171'
		}
	});
	Cufon('#menuPage .menuSuperBottomLink a', {
		hover: {
			fonSize: '18px',
			color: '#f17171'
		}
	});
	Cufon('#cateringPage .cateringTopLink a', {
		hover: {
			fonSize: '26px',
			color: '#f17171'
		}
	});
	Cufon('#cateringPage .cateringBottomLink a', {
		hover: {
			fonSize: '18px',
			color: '#f17171'
		}
	});
	Cufon.replace('.buyPrice');
	Cufon.replace('.pressDate');
	Cufon.replace('.galleryExtensionPrice');
	Cufon.replace('#homePageSay .first');
	Cufon.replace('#homePageSay .second');
	
	Cufon.replace('#calendarHeader');
	Cufon.replace('#calendarDays div');
	Cufon.replace('#currentMonthName');
	
	Cufon.replace('#lunchFormula');
}

function Select(id)
{
	$("#select-"+id).css("visibility", "hidden");
	$("#replace-"+id).css("visibility", "visible");
	$("#options-"+id+" .listItem").each(function (index, element){
		$(this).bind('click', function() {
			$(this).css("background", "#090a0b");
			$(".head", this).css("background", "none");
			$(".tail", this).css("background", "none");
			
			$("#select-"+id).val( $(this).attr("title") );
			$("#options-"+id).css("visibility", "hidden");
			$("#current-"+id).html( $(this).html() );
		});
		$(this).bind('mouseover', function() {
			$(this).css("background", "#090a0b url(inc/img/dropdownSelectCenter.jpg) left top repeat-x");
			$(".head", this).css("background", "url(inc/img/dropdownSelectLeft.jpg) left top no-repeat");
			$(".tail", this).css("background", "url(inc/img/dropdownSelectRight.jpg) right top no-repeat");
		});
		$(this).bind('mouseout', function() {
			$(this).css("background", "#090a0b");
			$(".head", this).css("background", "none");
			$(".tail", this).css("background", "none");
		});
	});
	
	$("#replace-"+id).bind('mouseover', function() {
		$("#options-"+id).css("visibility", "visible");
		$("#current-"+id).css("background", "#161718 url(inc/img/dropdown2.jpg) right center no-repeat");
	});
	$("#replace-"+id).bind('mouseout', function() {
		$("#options-"+id).css("visibility", "hidden");
		$("#current-"+id).css("background", "#161718 url(inc/img/dropdown1.jpg) right center no-repeat");	
	});
	
	ScrollContent(id);
}

function NewsletterSelect()
{
	$("#select-10").val(1);
	$("#option-1").css("display", "none");
	$("#select-10").css("visibility", "hidden");
	$("#replace-10").css("visibility", "visible");
	$("#options-10 .listItem").each(function (index, element){
		$(this).bind('click', function() {
			$("#select-10").val( $(this).attr("title") );
			$("#options-10").css("visibility", "hidden");
			$("#current-10").html( $(this).html() );
		});
		$(this).bind('mouseover', function() {
			$(this).css("background", "#090a0b url(inc/img/dropdownSelect1.jpg) left top no-repeat");
		});
		$(this).bind('mouseout', function() {
			$(this).css("background", "#090a0b");
		});
	});
	
	$("#replace-10").bind('mouseover', function() {
		if( $("#select-10").val()==1 )
		{
			$("#option-1").css("display", "none");
			$("#option-2").css("display", "block");
		}
		else
		{
			$("#option-1").css("display", "block");
			$("#option-2").css("display", "none");
		}
		$("#options-10").css("visibility", "visible");
		$("#current-10").css("background", "#161718 url(inc/img/dropdown2.jpg) right center no-repeat");
	});
	$("#replace-10").bind('mouseout', function() {
		$("#options-10").css("visibility", "hidden");
		$("#current-10").css("background", "#161718 url(inc/img/dropdown1.jpg) right center no-repeat");	
	});
}

function ScrollContent(id) 
{
	if( parseInt($("#content-item-"+id).height()) > 100 )
	{
		$("#content-slider-"+id).slider({
			orientation: "vertical",
			range: "min",
			min: 0,
			max: 100,
			value: 100,
			animate: true,
			change: function(e, ui) {
				var maxScroll = $("#content-scroll-"+id).attr("scrollHeight") - $("#content-wrapper-"+id).height() + 50;
				$("#content-scroll-"+id).animate({scrollTop: maxScroll - ui.value * (maxScroll / 100) }, 1000);
			},
			slide: function(e, ui) {
				var maxScroll = $("#content-scroll-"+id).attr("scrollHeight") - $("#content-wrapper-"+id).height() + 50;
				$("#content-scroll-"+id).attr({scrollTop: maxScroll - ui.value * (maxScroll / 100) });
			}
		});
	}
}

function Slide(id, height) 
{
	if( parseInt($("#content_item_"+id).height()) > height )
	{
		$("#content_slider_"+id).slider({
			orientation: "vertical",
			range: "min",
			min: 0,
			max: 100,
			value: 100,
			animate: true,
			change: function(e, ui) {
				var maxScroll = $("#content_scroll_"+id).attr("scrollHeight") - $("#content_wrapper_"+id).height() + 50;
				$("#content_scroll_"+id).animate({scrollTop: maxScroll - ui.value * (maxScroll / 100) }, 1000);
			},
			slide: function(e, ui) {
				var maxScroll = $("#content_scroll_"+id).attr("scrollHeight") - $("#content_wrapper_"+id).height() + 50;
				$("#content_scroll_"+id).attr({scrollTop: maxScroll - ui.value * (maxScroll / 100) });
			}
		});
	}
}

function mycarousel_1_initCallback(carousel) {
	jQuery('#carousel-1 #carousel-control-1 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-1 #carousel-control-1 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
    	$(".genericGallery").fadeOut(1000, function(){
  			$(".genericGallery").children().hide();
  			$(".genericGallery").show();
			$("#genericGalleryTop"+id).fadeIn(1000);
			
		});
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function mycarousel_2_initCallback(carousel) {
	jQuery('#carousel-2 #carousel-control-2 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-2 #carousel-control-2 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
    	$(".genericGallery").fadeOut(1000, function(){
  			$(".genericGallery").children().hide();
  			$(".genericGallery").show();
			$("#genericGalleryBottom"+id).fadeIn(1000);
			
		});
		
		if(id==1)
		{
			jQuery("#carousel-1").jcarousel({
		        scroll: 1,
		        initCallback: mycarousel_1_initCallback
		    });
		    
		    jQuery('#carousel-1 #carousel-control-1 a').removeClass('active');
		    jQuery('#carousel-1 #carousel-control-1 a:first').addClass('active');
		    CufonReplace();
		}
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function mycarousel_3_initCallback(carousel) {
	jQuery('#carousel-3 #carousel-control-3 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-3 #carousel-control-3 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
    	$(".genericGallery").fadeOut(1000, function(){
  			$(".genericGallery").children().hide();
  			$(".genericGallery").show();
			$("#genericGallerySuperTop"+id).fadeIn(1000);
			
		});
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function mycarousel_1_itemFirstInCallback_onAfterAnimation(a, b, c, d)
{
	Slide(3, 350);
	Slide(4, 350);
	Slide(5, 350);
	Slide(6, 350);
	Slide(7, 350);
}

function mycarousel_2_itemFirstInCallback_onAfterAnimation(a, b, c, d)
{
	Slide(1, 400);
	Slide(2, 400);
}

function mycarousel_3_itemFirstInCallback_onAfterAnimation(a, b, c, d)
{
	Slide(8, 400);
	Slide(9, 400);
}

function mycarousel_11_itemFirstInCallback_onAfterAnimation(a, b, c, d)
{
	Slide(10, 260);
	Slide(11, 260);
	Slide(12, 260);
}

function mycarousel_12_itemFirstInCallback_onAfterAnimation(a, b, c, d)
{
	Slide(13, 260);
	Slide(14, 260);
	Slide(15, 260);
}

function mycarousel_4_initCallback(carousel) {
	jQuery('#carousel-4 #carousel-control-4 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-4 #carousel-control-4 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function mycarousel_5_initCallback(carousel) {
	jQuery('#carousel-5 #carousel-control-5 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-5 #carousel-control-5 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function mycarousel_6_initCallback(carousel) {
	jQuery('#carousel-6-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#carousel-6-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function mycarousel_7_initCallback(carousel) {
	jQuery('#carousel-7-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#carousel-7-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function mycarousel_10_initCallback(carousel) {
	jQuery('#carousel-10 #carousel-control-10 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-10 #carousel-control-10 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function mycarousel_11_initCallback(carousel) {
	jQuery('#carousel-11 #carousel-control-11 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-11 #carousel-control-11 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function mycarousel_12_initCallback(carousel) {
	jQuery('#carousel-12 #carousel-control-12 a').bind('click', function() {
    	jQuery(this).blur();
    	jQuery('#carousel-12 #carousel-control-12 a').removeClass('active');
    	jQuery(this).addClass('active');
    	CufonReplace();
    	
    	id = jQuery(this).attr('title');
    	
        carousel.scroll(jQuery.jcarousel.intval(id));
        return false;
    });
};

function isValidEmail(emailAddress)
{
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}

function CheckOrderForm()
{
	error=0;
	
	$('#nameLabel').removeClass('error');
	if($.trim($('#name').val()).length===0) {
		$('#nameLabel').addClass('error');
		error=1;
	}
	
	$('#personNrLabel').removeClass('error');
	if($.trim($('#select-1').val())==="0") {
		$('#personNrLabel').addClass('error');
		error=1;
	}
	
	$('#dataLabel').removeClass('error');
	if($.trim($('#select-3').val())==="0" || $.trim($('#select-4').val())==="0" || $.trim($('#select-5').val())==="0") {
		$('#dataLabel').addClass('error');
		error=1;
	}
	
	$('#hourLabel').removeClass('error');
	if($.trim($('#select-2').val())==="0") {
		$('#hourLabel').addClass('error');
		error=1;
	}
	
	$('#emailLabel').removeClass('error');
	if(!isValidEmail($("#email").val())) {
		$('#emailLabel').addClass('error');
		error=1;
	}
	
	$('#telephoneLabel').removeClass('error');
	if($.trim($('#telephone').val()).length===0) {
		$('#telephoneLabel').addClass('error');
		error=1;
	}
	
	if(error===0)
	{
		return true;
	}
	else
	{
		return false;
	}
}
