function activateFlash(objName)
{
  var objO = document.getElementById(objName);
  if (objO != null)
  {
    var newCtnt = "";
    for (var i=0; i < objO.childNodes.length; i++)
    {
      if (objO.childNodes[i].nodeType == 1)
      {
          newCtnt = newCtnt + objO.childNodes[i].outerHTML+'\n';
      }
    }
    if (objO.outerHTML != null)
    {
      var n = objO.outerHTML.substr(0, objO.outerHTML.indexOf(">")) + ">\n" + newCtnt + objO.innerHTML + "\n</OBJECT>";
      objO.outerHTML = n;
    }
  }
}

function JustSoWindow(imageName,imageWidth,imageHeight,alt,objectType,bgcolor,hugger,hugMargin) {
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10;
	var myWidth = imageWidth;
	var myHeight = imageHeight;
	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 {
	
	if (objectType=="image") {
		if ((myWidth>w)||(myHeight>h)){
			newWindow = window.open("vwd_justso.htm","newWindow","scrollbars=yes, resizable=yes, width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
			bodyContent = '<html><title>'+alt+'</title><body title="ZavLTA­t okno" style="margin:0px;" onBlur="self.close()" onClick="self.close()"><img src="'+imageName+'", width="'+myWidth+'", height="'+myHeight+'"></body></html>';
		}
		else {
			newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+", height="+scrHeight+",left="+posLeft+",top="+posTop);
			bodyContent = '<html><title>'+alt+'</title><body title="ZavLTA­t okno" style="margin:0px; background-image: url('+imageName+');"><div onBlur="self.close()" onClick="self.close()" style="width:'+myWidth+'px; height:'+myHeight+'px">&nbsp;</div></body></html>';
		}
	}
	else if (objectType=="flash") {
		newWindow = window.open("vwd_justso.htm","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
		bodyContent = '<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">';  
		bodyContent = bodyContent + '<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>';
		bodyContent = bodyContent + '<object type="application/x-shockwave-flash" data="'+imageName+'" width='+imageWidth+' height='+imageHeight+'><param name="movie" value="'+imageName+'" /></object>'; 
		bodyContent = bodyContent + '</td></tr></table></body></html>';
	}
	else if (objectType=="screensaver") {
		newWindow = window.open("vwd_justso.htm","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
		bodyContent = '<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()" style="background-image:url(/img/monitor.jpg) ">';  
		bodyContent = bodyContent + '<div style="position:absolute; top:59px; left:66px; ">';
		bodyContent = bodyContent + '<object type="application/x-shockwave-flash" data="'+imageName+'" width="663" height="497"><param name="movie" value="'+imageName+'" /></object>'; 
		bodyContent = bodyContent + '</div></body></html>';
	}
	else if (objectType=="html") {
		newWindow = window.open(imageName,"newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	}
	
	if (objectType!="html"){
		newWindow.document.open();
		newWindow.document.write(bodyContent);
		newWindow.document.close();
		newWindow.focus();
	}
	
	
	}
}

