var LANG_URL = '/'+$('html').attr('lang');
if (LANG_URL == '/'+$('html').attr('default_lang')) { LANG_URL = ''; }
bsp = {};
bsp.photos = {};
bsp.selected = {};
var document_location_host = document.location.host.split(".")
var document_domain = document_location_host[document_location_host.length-2]+'.'+document_location_host[document_location_host.length-1];
document.domain = document_domain;
lang = {};
bsp.hasPostMessage =  (typeof window.postMessage === "undefined") ? false : true;
var optimizely = optimizely || [];
var ABtest = { "events" : {  } };
ABtest.events.paygo_purchase = ABtest.events.paygo_purchase || 1;
ABtest.events.credits_download = ABtest.events.credits_download || 1;
ABtest.events.credit_pack_purchase = ABtest.events.credit_pack_purchase || 1;
var ABtestPurchase = ABtestPurchase || 0;


//header
$(document).ready(function(){
	var header_timeout = [];
	var header_timeout_this;
	var header_hover_timeout;
	var header_hover_this;
	$('#header2 .navbar table  td.menu_item').hover(function(){ 
			clearTimeout(header_timeout[$(this).attr('id')])
		
		header_hover_this = this;
		
		header_hover_timeout = setTimeout(function() {
			$('#header2').find('.top_link').removeClass('hover');
			$('#header2').find('.divider').css('visibility','visible');
			$('#header2').find('.dropdown').hide();
			$(header_hover_this).find('.dropdown').show();
			$(header_hover_this).find('.divider').css('visibility','hidden');
			$(header_hover_this).find('.top_link').addClass('hover');
		},100);
	},
	function(){
		clearTimeout(header_hover_timeout);
		
		header_timeout_this = this;
		
		header_timeout[$(this).attr('id')] = setTimeout(function() {
			if(typeof header_timeout_this == 'undefined') 
			{ 
				$('#header2').find('.top_link').removeClass('hover');
				$('#header2').find('.divider').css('visibility','visible');
				$('#header2').find('.dropdown').hide(); 
			} 
			else
			{ 
				$(header_timeout_this).find('.dropdown').hide();
				$(header_timeout_this).find('.divider').css('visibility','visible');
				$(header_timeout_this).find('.top_link').removeClass('hover');
			} 
		},300);
		
	});
	$('#header2 .navbar table td:not(.lang) li').click(function(){
		window.location = $(this).find('a').attr('href');
	});
	
})();



