var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 0;
$(function() {
        $('.gallery a, .home_photo').lightBox();
    });
$(function() {
				$('a.nyroModal').nyroModal({width:980, endShowContent: function() {$('#top').css('width', $('#nyroModalContent').width() -5 +"px");}});
				$('#container').tabs({ 
									 bookmarkable: true,
									 onShow: function() {
										DrawBackground();}
										});
				$('#news').tabs({ 
									 bookmarkable: true
									 
										});
});
 
 $(document).ready( function() {	
 			$('#s3capcha').s3Capcha();
			$("#s3capcha").css({ display: "none" });
				//validation
				// show a simple loading indicator
				var loader = jQuery('<img src="images/ajaxLoader.gif" alt="loading..." />')
					.css({relative: "relative", top: "0", left: "0"})
					.appendTo("#loader")
					.hide();
				jQuery().ajaxStart(function() {
					loader.show();
				}).ajaxStop(function() {
					loader.hide();
				}).ajaxError(function(a, b, e) {
					throw e;
				});
				jQuery.validator.messages.required = "";
				jQuery.validator.addMethod("notEqualTo", function(value, element, param) {
return $(param).val()?(value != $(param).val()):(value != param);}, "error");
				$("#formContact").validate({
					rules: {
						email: {
							required: true,
							email: true
						},
						fname: {
							required: true,
							notEqualTo: "first name"
						},
						lname: {
							required: true,
							notEqualTo: "family name"
						},
						address: {
							required: true,
							notEqualTo: "address"
						}
					},
					messages: {
						email: "",
						fname: "",
						lname: "",
						address: ""
					},
					invalidHandler: function(e, validator) {
						var errors = validator.numberOfInvalids();
						if (errors) {
							var message = errors == 1
								? 'You missed mandatory field! It has been highlighted above'
								: 'You missed ' + errors + ' mandatory fields!  They have been highlighted above';
							$("div.errorContainer span").html(message);
							$("div.errorContainer").show();
						} else {
							$("div.errorContainer").hide();
						}
					},
					submitHandler: function(form) {
						jQuery(form).ajaxSubmit({
							target: "#ajaxContent"
						});
					}
				});
				//multiselect control
				$("#control_1").multiSelect( null, function() {
					var results = '';
					$("#others:checked").each(
						  function() {
						   results = results + $(this).val();
						  }
						);
					if (results.indexOf("others")>-1) {
							$("#others1").css({ visibility: "visible" });
						} else {
							$("#others1").css({ visibility: "hidden" });
						}
				});
				/*$('.prikazi').ajaxContent({
				   type:'Post',
				   loaderType:'img',
				   loadingMsg:'images/ajaxLoader.gif',
				   target:'#ajaxContent', 
				   bind:'#title,#fname,#lname,#company,#address,#phone,#email'
				});*/
				
				$("#formContact input").focus(function() {
					$("#s3capcha").css({ display: "block" });
				});
});
 

$(document).ready(function() {
	//accordion
	$("div.hiddenOutput").toggle();
	$("div.output1:first").next("div.hiddenOutput").toggle();
	$("div.output1").click(function() {
		$("div.hiddenActivity").slideUp("fast");
		$("div").removeClass("aktivan");
		$(this).siblings("div").next("div.hiddenOutput").slideUp("fast");
		$(this).next("div.hiddenOutput").slideToggle("fast");
		return false;
	});
	$("div.hiddenActivity").hide();
	$("div.activity").click(function() {
		var vidljivost = $(this).next("div.hiddenActivity").css("display");
		$(this).siblings("div").next("div.hiddenActivity").slideUp("fast");
		$(this).siblings("div").removeClass("aktivan");
		$(this).next("div.hiddenActivity").slideToggle("fast");
		$(this).toggleClass("aktivan");
		return false;
	});
	
	$("div.hiddenPeople").toggle();
	$("div.people").click(function() {
		$("div.hiddenPeople").slideUp("fast");
		$("div").removeClass("aktivan");
		$(this).siblings("div").next("div.hiddenPeople").slideUp("fast");
		$(this).next("div.hiddenPeople").slideToggle("fast");
		return false;
	});
	
	//news-events formular
	$("input[name=newsSelection]").click(function(){
		if ($("input[name=newsSelection]:checked").val() == 'news') {
			$("#newsContainer").show();
			$("#eventsContainer").hide();
			DrawBackground();
		} else {
			$("#newsContainer").hide();
			$("#eventsContainer").show();
			DrawBackground();
		}
	});
	
	//download formular
	$("#newsForm select").selectbox();
	$(".docsContainer").hide();
	$("#docs_1").show();
	DrawBackground();
	$("#docsSelection").change(function(){
		$(".docsContainer").hide();
		$("#"+$(this).val()).show();
		DrawBackground();
	});
	
	//top menu
	$(".subMenu").toggle();
	$(".subLink").hover(function(){
		$(this).find(".subMenu").animate({width: 'toggle', opacity: 'toggle'});
	}, function(){
			$(this).find(".subMenu").animate({width: 'toggle', opacity: 'toggle'});
		});	
});
