// JavaScript Document

function drukuj(imageName,oknoWidth,oknoHeight,alt,hugger,displayUrl,id_firmy) {

	var adj=10
	var hugMargin=0;
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;
//	var displayUrl = 'display.php'

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){0
	  var lift=0.93;
	}
	if (oknoWidth>w){	
	  byFactor = w / oknoWidth;			
	  oknoWidth = w;
	  oknoHeight = oknoHeight * byFactor;
	}
	if (oknoHeight>h-adj){
	  byFactor = h / oknoHeight;
	  oknoWidth = (oknoWidth * byFactor);
	  oknoHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (oknoHeight>scrHeight){
  	  oknoHeight=oknoHeight*lift;
	  oknoWidth=oknoWidth*lift;
	}

	var posLeft=0;
	var posTop=0;


	if (oknoHeight > (h*lift)-adj || oknoWidth > w-adj){
		oknoHeight=oknoHeight-adj;
		oknoWidth=oknoWidth-adj;
	}

	posTop =  ((h-(oknoHeight/lift)-adj)/2);
	posLeft = ((w-(oknoWidth)-adj)/2);


	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	
	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="+oknoWidth+",height="+oknoHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title>');  
	newWindow.document.write('<frameset rows="50,*" frameborder="NO" border="0" framespacing="0">');
	newWindow.document.write('<frame src="control.htm" name="controls" scrolling="NO" noresize>'); 
	newWindow.document.write('<frame src='+displayUrl+' name="display">'); 
	newWindow.document.write('</frameset>'); 
	newWindow.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor=#01156C>');
	newWindow.document.write('<table width='+oknoWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+oknoHeight+' ><tr><td>');
//	newWindow.document.write('dupa: ***'+imageName+'  *** '+oknoWidth+'  ***  '+oknoHeight+'  ***  '+alt+'  ***  '+hugger+' *** '+displayUrl+' ');
	newWindow.document.write('<div align="center">Twoja przegladarka nie obsluguje ramek - zastosuj IE w wersji 5.0 </div>');
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}

