$(document).ready(function() {


    $('.choose-ul div').addClass('test');

	/*rand = Math.round(7*Math.random())+1;
	$('#white').attr('class','bg'+rand);*/
	
	$('div').click(function() {
	 if ($(this).hasClass('test:not(.hover)') && $('.choose-ul ul').not(':animated')) {	 
	  $('.choose-ul').css('z-index','1');
	  $('.choose-ul ul').css('z-index','2');
	  $(this).parent().css('z-index','2'); 
      $('.choose-ul ul').slideUp();
      $(this).parent().children('ul').slideDown();
      $('.choose-ul div').removeClass('hover');
      $(this).addClass('hover');
     return false     
	 } else {
	  setTimeout("$('.choose-ul div').removeClass('hover')",400);
	  $('.choose-ul ul').slideUp();
	 }    
    });
	
	
	/*$('#lang #current a').click(function(){
	 $('#lang #what').slideDown();
	 $('#head #bron_now').slideUp();
	 return false
	}); */	
	
	$('#lang #google-trans a').click(function(){
	if ($(this).hasClass('active')) {
	 $(this).removeClass('active');
	 $('#lang #what').slideUp();
	} else {	 
	$(this).addClass('active');
	 $('#lang #what').slideDown();
	 $('#head #bron_now').slideUp();
	 }
	 return false
	}); 
	
	
	
	$("a.pob-link").click(function(){
	 $("#pob").show();
	 $("#pob-mini").show();
	return false;
    });
    
    $("#pob-mini #pob-mini-text").click(function(){
	 $("#pob").hide();
	 $("#pob-mini").hide();
	return false;
    });
    
    $("#pob .close img").click(function(){
     $("#pob").hide();
	 $("#pob-mini").hide();
	return false;
    });
    
	
	
	
	$('#lang .close').click(function(){
	 $('#lang #what').slideUp();
	 $('#lang #google-trans a').removeClass('active');
	});	
	
	$('a#index-bron').click(function(){
	 $('#head #bron_now').slideDown();
	 $('#lang #what').slideUp();
	 return false
	});	
	
	$('a.yakor').click(function(){
     $.scrollTo( $('#bron-content'), {speed:1500} )
	 return false
	});	
	
	$('#head #bron_now .close').click(function(){
	 $('#head #bron_now').slideUp();
	});
	
	
	$("a[rel*=blank]").click(function(){
	window.open(this.href);
	return false;
    });
    
	
    
    
	
	$('.item:not(.out)').click(function(){
	if ($(this).hasClass('active')) {
	 $(this).removeClass('active');
	 $(this).parent().children('.slide').slideUp(300);
	 $('#sub-menu').animate({ height: 47}, 300 );
	} else {
	 $('.item').removeClass('active');
	 $(this).addClass('active');	
	 $('.slide').slideUp(300);	    
     setTimeout("$('.item.active').parent().children('.slide').slideDown(300)",300);
     hheight = $(this).parent().children('.slide').height();
	 $('#sub-menu').animate({ height: hheight+40}, 300 );
	}
	//$('.item:not(.active) .img_new').remove();	
    //$(this).parent().children('.slide').slideDown(300);
	//setTimeout("$.scrollTo( $('#sub-menu'), {speed:1500} )",610);
	//$('#sub-menu').css('height','1%');
	return false
    });	
	
	
	
	
	
	
	/*$('.item').hover(function(){
	  $('a',this).append('<img class="img_new" />')
	  img_src = $('img',this).attr('src');
	  img_src = img_src.substring(0,(img_src.length - 4));
	  $('.img_new',this).attr('src', img_src + '-act.gif');	
	  },function(){
	  $('.item:not(.active) .img_new').remove();
	});
	
	 function go() {
      $('.item').removeClass('active');
      $('.item:not(.active) .img_new').remove();	
      $('.item:eq('+num+')').addClass('active');
      $('.item:eq('+num+') a').append('<img class="img_new" />')
      img_src = $('.item:eq('+num+') img').attr('src');
	  img_src = img_src.substring(0,(img_src.length - 4));
	  $('.item:eq('+num+') .img_new').attr('src', img_src + '-act.gif');
	  $('.slide').slideUp(300);
      $('.slide:eq('+num+')').slideDown(300);
      setTimeout("$.scrollTo( $('#sub-menu'), {speed:1500} )",300);
    }
	
	$('a.link-reg').click(function(){
	 num = 1
	 go();
	 return false
    }); 
    $('a.link-abyss').click(function(){
     num = 2
	 go();
	 return false
    });     */
    
    
    $('a.link-card').click(function(){
     $('#sub-menu').animate({ height: 357}, 300 );
     $('.slide').slideUp(300);
     $('.item').removeClass('active');
     $('.card').parent().children('.item').addClass('active');
     setTimeout("$('.slide.card').slideDown(300)",300);
     setTimeout("$.scrollTo( $('#sub-menu'), {speed:1500} )",300);
     return false
    }); 
    
   
    
    
    $('a.link-abyss').click(function(){
     $('#sub-menu').animate({ height: 390}, 300 );
     $('.slide').slideUp(300);
     $('.item').removeClass('active');
     $('.abyss').parent().children('.item').addClass('active');
     setTimeout("$('.slide.abyss').slideDown(300)",300);
     setTimeout("$.scrollTo( $('#sub-menu'), {speed:1500} )",300);
     return false
    }); 
    
    $('.tomap, .show-center').click(function(){
     $.scrollTo( $('#textContact'), {speed:1500} );
     return false
    }); 
    
    
    //$('.one-card input').hide();
    //$('.one-card').append('<div class="check"></div>');
    $('.one-card').parent().children('input').css('visibility','hidden');
    $('.one-card:eq(0) .check').addClass('active');
    $('.one-card .check').click(function(){
     $('.one-card .check').removeClass('active');
     $(this).addClass('active');
     $(this).prev().attr('checked','checked');
     fsd = $('.check.active').parent().prevAll('.one-card').size();
     $('.one-card').parent().children().children().children('input:eq('+fsd+')').attr('checked','checked');
     
    });     

   
    $('.pickup .services div a').click(function(){
     if ($(this).parent().hasClass('active')) {$(this).parent().removeClass('active')}
     else
     {$(this).parent().addClass('active')}
     return false
    });
    
    $('.pickup .listing div a').click(function(){
     $('.pickup .listing div').removeClass('active');
     $(this).parent().addClass('active');
     return false
    });
    
    $('.all-hotels-tbl div a').click(function(){
     $('.all-hotels-tbl div').removeClass('active');
     $(this).parent().addClass('active');
     return false
    });
    
    try
    {
        $('.one-card a').lightBox();
        $('#right_recomend td a.popup').lightBox();
        $('#recomend-td td a.popup').lightBox();
        $('a.scheme').lightBox();
        $('div.block .spec-block a').lightBox();
        $('a[rel*=lightbox]').lightBox();
        
        $('#pageHeader_toptel_Logos').parent().css('padding-top','31px');
        
    }
    catch(e)
        {
        ;
        }
    
	$(".gal-nav:not(.price) li").click( function() {
	   $('ul',this).show();
	});
	
	$(".gal-nav:not(.price) li a").click( function() {
	   $(".gal-nav li").removeClass('active');
	   $(this).parent().parent().parent().addClass('active');
	   $(this).parent().addClass('active');
	   
	});
	
	$(".gal-nav.price li").click( function() {
	   $('ul',this).show();
	});
	
	
	
	$(".gal-nav.price li a").click( function() {
	   $(".gal-nav.price li").removeClass('active');
	   $(this).parent().parent().parent().addClass('active');
	   $(this).parent().addClass('active');
	   $(this).parent().children('ul').children('li:first-child').addClass('active');
	});
	
	$('.content-form input:checkbox').css('margin-right','3px');
	
	
	$('.one-line .rotate:first-child').show();

	
	num = 0;
	setInterval("news();",3000);
	
    
	
	$('.point').hover( function() {
	  //$('.world').hide();
	  $(this).css('z-index','3000');
	  wrld = $(this).attr('id');
	  $('.world#sub-'+wrld).show();
	 },function() {
	  //$('.world').css('display','none');
	  $(this).css('z-index','100');
	});


    $('.spec-block p:last-child').css('border','none');
	$('#ctl00_leftHolder_DDLhotel').css('width','195px');
	$('.bron1 #ctl00_leftHolder_DDLhotel').css('width','193px');
	
	   $('.world').hover( function() {
	   
	    $(this).show;
	    
	   },function() {
	    $('.world').css('display','none');
	   });
	   
	   
	   $('.table-cell table tr:first-child td').css('border-top','none');
            $('.table-cell table tr td:first-child').not('.align-center').css('border-left','none').css('text-align','left');
            $('.table-cell table tr td:last-child').css('border-right','none');            
            $('.table-cell table tr:last-child td').css('border-bottom','none');
	
	schema_src = $('.schema p img').attr('src');
	$('.schema .for-print a').attr('href',schema_src);
	 
   $('.schema .for-print a').click(function(){
     popupWin=window.open(schema_src);
	 popupWin.focus();
	 popupWin.print();
     return false
   });

	
}); 


function news() {
 num = num+1;
 
 if(num != 4) {
  $('.one-line .rotate').fadeOut();
  setTimeout("$('.one-line .rotate:eq('+num+')').fadeIn()",300); 
 }else {num=-1}

} 
