
$(document).ready(function(){
	$(".scroll").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();
		
		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;
		
		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];
		
		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top-10;
		
		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 800);
	});
	$("a.popup_trigger[rel]").overlay({top: 120});
	$('.toggler').live('click', function(e) {
		e.preventDefault();
		$(this).toggleClass('active');
		$($(this).attr('rel')).slideToggle(500);
	});
	
	$('a.rates').live('click', function(e) {
		$('span.rates').toggle(500);
	});
	
	$('.stripes tr:odd').addClass('alt'); 

	$('.facebook_rss li:odd').addClass('alt');
	
		// select all desired input fields and attach tooltips to them
	$("a.has_tooltip[title]").tooltip({
		
	
		// use the built-in fadeIn/fadeOut effect
		effect: "fade",
	
		// the time before the tooltip is shown
		predelay: 200,
		
		position: "bottom center"
								
	});
	
	$("table.shop a[title]").tooltip({
		
		tipClass: "tooltip big",
		// use the built-in fadeIn/fadeOut effect
		effect: "fade",
		
		position: "top center",
		offset: [30,0]
								
	});
	
	$('.stripes tr:odd').addClass('alt');
	
	//gallery
	$("a.gallery").fancybox({
                'titlePosition' : 'inside',
		'margin' : '60'
	});
	$("img.thumbnail").one("load", function(){
		$('img.thumbnail').each(function(){
			$(this).parent().addClass(this.width > this.height ? 'landscape' : 'portrait');
		});
	}).each(function() {
		if(this.complete) $(this).trigger("load");
	});
	
	//inputs take title text and have class
	$(":text").labelify({labelledClass: "labelHighlight"});


	
	$("a.close").click(function(e){
		e.preventDefault();
		$(this).parent().fadeOut(500);
	});
	
	
	//language menu active
	if(location.pathname.indexOf('/ru/') > 0 ){
		$(".lang_menu li:nth-child(1)").addClass("active");
	}
	if(location.pathname.indexOf('/es/') > 0 ){
		$(".lang_menu li:nth-child(2)").addClass("active");
	}
	if(location.pathname.indexOf('/en/') > 0 ){
		$(".lang_menu li:nth-child(3)").addClass("active");
	}
	
	
});








