var scriptsOn = false;

if (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3)) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) || ((navigator.appName == "Opera") && (parseInt(navigator.appVersion) >= 6)))
 scriptsOn = true;

function RegisterImage(imgName, imgOn, imgOff) {
	if (scriptsOn) {
		eval (imgName + "1 = new Image()");
		eval (imgName + "1.src = \"" + imgOn + "\"");
		eval (imgName + " = new Image()");
		eval (imgName + ".src = \"" + imgOff + "\"");
	}
}

function ImageOver(imgName) {
	if (scriptsOn) {
		eval ("document." + imgName + ".src = " + imgName + "1.src");
	}
}
 
function ImageOut(imgName) {
	if (scriptsOn) {
		eval ("document." + imgName + ".src = " + imgName + ".src")
	}
}

function openwindow(adresa,sirka,vyska) {    
	var option = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + sirka +",height="+ vyska;
	okno = window.open(adresa, "okno", option);  
}

function openprog(adresa,sirka,vyska) {    
	var option = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=" + sirka +",height="+ vyska;
	okno = window.open(adresa, "okno", option);  
}

function naj() {
	document.write('<a href="http://naj.sk/"><img src="http://p1.naj.sk/hit?site=780;t=lb14;ref=;jss=0" width="0" height="0" alt="NAJ.sk" style="border: none; " /></a>');
}

function posl_zmena() {
	document.write('<script language="JavaScript">\n');
	document.write('<!-- \n');
	document.write('var datum = new Date(document.lastModified); \n');
	document.write('var rok = 1900; \n');
	document.write('if ((datum.getYear() > 100) && (datum.getYear() < 200)) { \n');
	document.write('rok+= datum.getYear(); \n');
	document.write('}  else { \n');
	document.write('rok = datum.getYear(); \n');
	document.write('} \n');
	document.write('document.write(" ",datum.getDate(),".",datum.getMonth()+1,".",rok); \n');
	document.write('//--> \n');
	document.write('</script> \n');
}

// funkcia na popup okna (najma pre obrazky v galeriach)
function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4  

	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Kliknutím zavrieš okno" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}
