$(document).ready(function() {
    $('#overlay').css('opacity','0.3');

//	$('.opinion div').click(function(){
//	    ofset = $(document).scrollTop() + ($(window).height()/2) - 216;
//	    $('#wrapper #op').show().css('top',ofset);
//	    $('#wrapper #overlay')
//	    .width($(document).width())
//	    .height($(document).height())
//	    .show()
//	    return false
//	});
	
	
	$('.photo a').fancybox();
	
	
	
	$('.slider').addClass('visible');
	
	$('.slider .ticket_switch').click(function(){
	 if ($(this).hasClass('t_act')) { 
	    $(this).removeClass('t_act');
	    $(this).parent().children('.myticket').slideUp();
	 } else {
	    $('.myticket').slideUp();
	    $('.ticket_switch').removeClass('t_act');
	    $(this).addClass('t_act');
	    $(this).parent().children('.myticket').slideDown();
	    }
	    
	    if ($(this).parent().hasClass('visible')){
	        $(this).parent().removeClass('visible');
	       // 
	        $(this).parent().find('.one').each(function(){
	          ds = $(this).find('li').size();
	          if (ds <= 4) { 
	            $(this).find('.photo').width('auto');
	            } else {
	            $(this).find('.photo').children('ul').jcarousel();
	        }
	          })
	       
	    }
	});
	
	
	
	   /*  $('.slider:not(.hotell) .photo').each(function(){
	        ds = $(this).find('li').size();
	        if (ds <= 4) {
	           $(this).css('width','auto');
	           $(this).find('.jcarousel-prev').remove();
	        }
	    })
	
	
    */
    $('.reg acronym').bind('mousemove',function(e){	
        $('#acrhint img,#mob_acronym').hide();
        if ($(this).hasClass('passport')) {
            $('#passport_acronym').show();
        }
        if ($(this).hasClass('bron')) {
            $('#bron_acronym').show();	       
        }
        if ($(this).hasClass('mob')) {
            $('#mob_acronym').show();	       
        }			 
	    $('#acrhint').show().css('left',e.pageX+8+'px').css('top',e.pageY+8+'px');
	    return false;
    });
    
    $('.reg acronym').bind("mouseout", function() {
	    $('#acrhint').hide();
	    return false;
    });
	
	$('a.gmap').click(function(){
	    $('#overlay').show().css('opacity','0.3').css('height',$('#aspnetForm').height());
	    $('#op').addClass('active');
	    return false
	});
	
	$('.close a').click(function(){
	    $('#overlay').hide();
	    $('#op').removeClass('active');
	    $('#video').removeClass('active');
	    $('#video object').remove();
	    return false
	});
	
	$('.video a').click(function(){
	     $('#overlay').css('opacity','0.3').css('height',$('#aspnetForm').height()).show();
	     
	     getscroll();
	      $('#video').addClass('active').css('top',yScroll+$(window).height()/2);
	      gv = $(this).attr('name');
	      gvt = $(this).attr('title');
	      $('.gv').html('<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+gv+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+gv+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>')
	        $('#video .close div').html(gvt);
	    return false
	});
    $('#overlay').click(function(){
    
        $('.close a').click();
    })
	
}); 

function clickOtziv(hotelId,date1,date2)
{
        document.getElementById(ctrlHotelId).value=hotelId;
        document.getElementById(ctrlDate1).value=date1;
        document.getElementById(ctrlDate2).value=date2;
        ofset = $(document).scrollTop() + ($(window).height()/2) - 216;
	    $('#wrapper #op').show().css('top',ofset);
	    $('#wrapper #overlay')
	    .width($(document).width())
	    .height($(document).height())
	    .show()
	    return false
}


function getscroll(){
	if (self.pageYOffset){
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body){
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}
};
