var pathname = ""+window.location;
var language="eng";
if((pathname.indexOf("slo"))!=-1)
	language="slo";




function printpage(){window.print();}
function refresh(){window.refresh()};
$(document).ready(function(){

    $(".gal_thumb").click(function() {
		var image = $(this).attr("rel");
		$(".gal_thumb").each(function(){
			$(this).css("border","2px solid #FFFFFF");
		});
		$(".video_thumb").each(function(){
			$(this).css("border","2px solid #FFFFFF");
		});
		$(this).css("border","2px solid #8A8D09");
		$('#main_foto').hide();
		$('#main_foto').fadeIn('slow');
		$('#main_foto').html('<a class="single_image" href="'+ image +'"><img src="' + image + '"/></a>');
			$("a.single_image").each(function(){
			$(this).fancybox({
				titleShow : false,
				transitionIn : "elastic",
				transitionOut : "elastic",
				padding : 1,
				overlayOpacity : 0.4,
				hideOnContentClick : true
			});
		});
		return false;
	});

	$(".video_thumb").click(function() {
  		var video = $(this).attr("rel");

  		$(".gal_thumb").each(function(){
			$(this).css("border","2px solid #FFFFFF");
		});
		$(".video_thumb").each(function(){
			$(this).css("border","2px solid #FFFFFF");
		});

		$(this).css("border","2px solid #8A8D09");
		$('#main_foto').hide();
		$('#main_foto').fadeIn('slow');
		$('#main_foto').html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="382" height="250" id="mail_player">'+
							'<param name="movie" value="/player_small.swf?url=/files/video/'+video+'" />'+
							'<param name="flashvars" value="url=/files/video/'+video+'" />'+
							'<!--[if !IE]>-->'+
							'<object type="application/x-shockwave-flash" data="/player_small.swf?url=/files/video/'+video+'" width="382" height="250">'+
							'<param name="flashvars" value="url=/files/video/'+video+' />'+
							'<!--<![endif]-->'+
							'GET FLASH'+
							'<!--[if !IE]>-->'+
							'</object>'+
							'<!--<![endif]-->'+
							'</object>');

		return false;
	});






	$("button").button();

	$('.button').each(function(){
		var sub=$(this).attr("rel");
		$(this).hover(
		function () {
			var childNum=$(this).children().size();
			childNum=childNum*34;

			$(this).stop().animate({
				"height" : childNum,
				backgroundColor : "#DEDCD0"
			},333);
		},
		function () {
			$(this).stop().animate({
				"height" : "32px",
				backgroundColor : "#FFFFFF"
			},333);
		});
	});

	$("a.single_image").each(function(){
			$(this).fancybox({
			titleShow : false,
			transitionIn : "elastic",
			transitionOut : "elastic",
			padding : 1,
			overlayOpacity : 0.4,
			hideOnContentClick : true
		});
	});


	$("#search_it").click(function(){
		var pathname = ""+window.location;
		var lang="slo";
		if((pathname.indexOf("eng"))!=-1)
			lang="eng";

		var keywords=$("#keyword").val();

		keywords = keywords.split(" ");
  		keywords = keywords.join(";");
		$.ajax({
			type: "GET",
			url: "/sys/search.php",
			data: 'lang='+lang+'&keyword='+keywords,
			success: function(msg){
				//alert(msg);
				$(".search_results").html(msg);
			}
		});

	});

	$(".slika img").not(".small").each(function(){
		var h=$(this).height();
		var p_h=266;
		var raz=Math.round((h-p_h)/4);

		$(this).css("margin-top",-raz);
	});
});
$(window).load(function(){
	$("#belina").children(".vsebina").fadeTo(3000,0.6);
});


