

  $(document).ready(function(){
  
	$("#jmeno").focus();
	$("#popDetailTable").hide();		
	$("#popDetailChbx").click( function(){ $("#popDetailTable").toggle(); });

	$("#plAcomware").show();	
	$(".inradio").change(function(){
		var rel = $(this).attr("rel");
		var sRel = "#"+rel;
		
		$(".pl").hide();
		$(sRel).show();
		
	});

	if( $(".artDetail img").attr("align")=="left" ){
		$(".artDetail img").addClass("imgLeft");
	}
	if( $(".artDetail img").attr("align")=="right" ){
		$(".artDetailimg").addClass("imgRight");
	}

  	// definice menu
  	$("#header").ndMenu();
	$("#form").ndFormValidator({autoSizeAlert:"false"});
	$("#miniContact").ndFormValidator({autoSizeAlert:"false"});
	
	$('a.nw').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});	
	
	$("a[rel='nw']").click( function() {
		window.open( $(this).attr('href') );
		return false;
	});	
	
	
	/*
	$("#verticalTabs2-env .text").hide();
	$("#verticalTabs2-env #c1.text").show();
	*/

	$("#control a").click(function(){
		var myHref = $(this).attr("href");	// ziskani retezce z odkazu
			myHref = myHref.substring(1);	// odseknuti #
		
		$("#control a").removeClass("active");
		$(this).addClass("active");
		
		// prace s obsahovymi prvky
		$("#verticalTabs2-env .text").hide();
		$("#verticalTabs2-env .text").each(function(){				
			if( $(this).attr("id") == myHref ){ $(this).show(); }
		});
		
		return false;			
	});
	
	/* novy mini formular */
	$("#minicontact2").ndFormValidator({errorToAlert: "true"});
	
	$("#yourMessage")
	.click(function(){
		if( $(this).val() == "Wiadomość dla nas..." ){
			$(this).text("");
		}
	})
	.blur(function(){
		if( $(this).val() == "" ){
			$(this).text("Wiadomość dla nas...");
		}
	});
		
  });	

function random(X){
    return Math.floor(X * (Math.random() % 1));
}

function randomBetween(MinV, MaxV){
  return MinV + random(MaxV - MinV + 1);
}


function GenerateCustomFckGallery(files_array)
{
		var result="";
		for (var a=0;a<files_array.length;a++)
			result+="<a href=\""+files_array[a].path+"\" class=\"nyroModal\" rel=\"lightbox\"><img alt=\"\" src=\""+files_array[a].thumb+"\" /></a>";
		return result;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
