
jQuery(document).ready(function($){
	//$('#StyledSelect').styledSelect();
	
	calculte_nav_offset(); // call this before lavaLamp
	
	buttonOverState('.newsletterForm .DivInputSubmit .inputSubmit', 'inputSubmitOver');
	buttonOverState('.formLoginPerson .input_submit_container .inputSubmit', 'inputSubmitOver');
	buttonOverState('.formLoginOrganizations .input_submit_container .inputSubmit', 'inputSubmitOver');
	buttonOverState('.registrationStep2 .input_submit_container .inputSubmit', 'inputSubmitOver');
	buttonOverState('.searchCalendar .inputSubmit', 'inputSubmitOver');
	
	//console.log( $('.leftMenu_2 li').text() );
	$('.leftMenu_2 li a.link').hover(function(){
		$(this).addClass('selected');
	},
	function(){
		$(this).removeClass('selected');
	});
	
	
	//button hover
	$('.buttonDark,.buttonLight').hover(function(){$(this).addClass('buttonOver')},function(){$(this).removeClass('buttonOver')})
	
	// Set captcha by JS
	$("input[name='cap_prot']").val('1');
	
	$('#faqList').accordion({header: '.head',alwaysOpen: false, autoheight: false ,active: false});
	
	$('.newsletterForm .DivInputText .inputText').each(function(){$(this).watermark($(this).val())})
	
	
	$('#styledSelect_1').styledSelect({
		"selectClass": "styledSelect_340_23"
		,"zIndexApply": true
		,"zIndexStart": 305
	});
	$('#styledSelect_2').styledSelect({
		"selectClass": "styledSelect_340_23"
		,"zIndexApply": true
		,"zIndexStart": 304
	});
	$('#styledSelect_3').styledSelect({
		"selectClass": "styledSelect_340_23"
		,"zIndexApply": true
		,"zIndexStart": 303
	});
	$('#styledSelect_4').styledSelect({
		"selectClass": "styledSelect_340_23"
		,"zIndexApply": true
		,"zIndexStart": 302
	});
	$('#styledSelect_5').styledSelect({
		"selectClass": "styledSelect_515_23"
		,"zIndexApply": true
		,"zIndexStart": 301
	});
	$('#styledSelect_birth_day').styledSelect({
		"selectClass": "styledSelect_80_21"
		,"zIndexApply": true
		,"zIndexStart": 293
	});
	$('#styledSelect_birth_month').styledSelect({
		"selectClass": "styledSelect_80_21"
		,"zIndexApply": true
		,"zIndexStart": 292
	});
	$('#styledSelect_birth_year').styledSelect({
		"selectClass": "styledSelect_110_21"
		,"zIndexApply": true
		,"zIndexStart": 291
	});
	$('#styledSelect_doc_type').styledSelect({
		"selectClass": "styledSelect_219_21"
		,"zIndexApply": true
		,"zIndexStart": 281
	});
	
	// calendar-dates
	$('#styledSelectCal_1').styledSelect({
		"selectClass": "styledSelect_149_23"
		,"zIndexApply": true
		,"zIndexStart": 281
	});
	$('#styledSelectCal_2').styledSelect({
		"selectClass": "styledSelect_149_23"
		,"zIndexApply": true
		,"zIndexStart": 281
	});
	$('#styledSelectCal_3').styledSelect({
		"selectClass": "styledSelect_179_23"
		,"zIndexApply": true
		,"zIndexStart": 281
	});
	

});



function calculte_nav_offset()
{
	var max_width = $('#contentLight .wrapper').width();
	var nav_width = $('#nav').width();
	//alert(nav_width);
	if(max_width>nav_width) {
		var margin_offset = (max_width-nav_width) / 2;
		if( margin_offset >0 ) {
			margin_offset = Math.floor(margin_offset);
			//alert(margin_offset);
			//$('#nav').width(nav_width).css('margin-left', margin_offset + 8); // we have 15px left offset of the background image in header. Use half of this width
			$('#nav').css('margin-left', margin_offset + 8);
		}
	}
}


/* OnOver - add class for IE - Should be used on elements different from Links */
function buttonOverState(selector, className)
{
	/* Hover over the login button */
	$(selector).hover(function(){
		$(this).addClass(className);
	},
	function(){
		$(this).removeClass(className);
	});
}

