
// W osobnym oknie.
function ShowPicture(FileName, picWidth, picHeight, left, top, scrollbars) {
  var width = picWidth; 
  var height = picHeight;
  if(!left) left = 300;
  if(!top) top = 300;
  if(left == -1) left = (screen.width - width )/ 2;
  if(top == -1) top = (screen.height - height)/ 2 ;
  
  if (scrollbars=='') scrollbars='no';
  
//  left = Math.min(left, screen.width - width - 50);
//  top = Math.min(top, screen.height - height - 50);
  var w = window.open("./inc/newWindow.php?URL="+URLSafeEncode(FileName),'Zdjecie',
            'scrollbars='+scrollbars+',resizable=no,status=no,width=' + width + ',height=' + height + 
            ',dependent=yes,left=' + left + ',top=' + top);
  w.focus();
}   

function ShowHTML(FileName, Width, Height, left, top) {
  var width = Width; 
  var height = Height;
  if(!left) left = 300;
  if(!top) top = 300;
  if(left == -1) left = (screen.width - width )/ 2;
  if(top == -1) top = (screen.height - height)/ 2 ;
//  left = Math.min(left, screen.width - width - 50);
//  top = Math.min(top, screen.height - height - 50);
  var w = window.open(URLSafeEncode(FileName),'Mapka',
            'scrollbars=no,resizable=no,status=no,width=' + width + ',height=' + height + 
            ',dependent=yes,left=' + left + ',top=' + top);
  w.focus();
}   


// Koduje adres WWW tak, aby bez problemów przesłać jako parametr w adresie www.
// W szczególności zamienia znak "&" na coś bez "&".
// Oryginał można otrzymać funkcją URLSafeDecode.
function URLSafeEncode(str)
{
  return(str.replace(/x/g, 'xx').replace(/&/g, 'xy'));
}

// Odtwarza tekst zakodowany funkcją URLSafeEncode.
function URLSafeDecode(str)
{
  return(str.replace(/xx|xy/g, function($0){return $0 == 'xx' ? 'x' : '&';}));
}


	function IGN_Show( URL, W, H, FlashVarsCustom ) {
//		s = document.getElementById("test").innerHTML;

		var d = document.getElementById("dprv");	
	//	if (!d) return false;
		var p = document.getElementById("prv");
	//	var p2 = document.frames["prv"];		
//		var p = document.frames["prv"];		
//		if (!p) return false;		
	
//fix_eolas();
//	document.getElementById('txt').value = s;
//		d.innerHTML = s;

		f = 'img='+URL+'&W='+W+'&H='+H;
	d.innerHTML = IGN_Show_RF(f, FlashVarsCustom);
//d.innerHTML = '<a href="www.wp.pl">osiem</a> <img src="d:\Blaszczak.gif">'
//		prv.location = './Admin/Lukuc_Certificates.php?PageName=ShowPic&ID=1';
		
		d.style.position = 'absolute';
		d.style.zIndex = 9; 
		d.style.display = "block";				
		d.style.left = 0;		
		d.style.top = 0;				
		d.style.width = '100%';
		d.style.height = '100%';//document.body.scrollHeight;
		// '100%';
		d.style.verticalAlign = 'top';
		d.style.textAlign = 'center';		
//		d.style.backgroundColor = '#FF0000';

		//p.src = URL;
		/*
		p2.document.write('osiem');
		p.width = 0;
		p.height = 0;
		p.scrolling = 'auto';
		p.marginWidth = 0;
		p.marginHeight = 0;
		p.frameBorder = 0;
		p.style.position = 'absolute';
//		p.contentDocument.body.onload = IGN_Show_IFrameOnLoad;

		x = (document.body.clientWidth - W ) / 2;
		y = (document.body.clientHeight - H ) / 2;
		p.style.left = x;
		p.style.top = y;
		*/
		
		IGN_OnScroll();
//				alert ('sss');
//		alert (d.style.height);
	}
	
	function IGN_OnResize() {
		var d = document.getElementById("dprv");	
		if (!d) return false;		
//		d.style.width = 0;
//		d.style.height = 0;		
//		d.style.width = document.body.scrollWidth;
//		d.style.height = document.body.scrollHeight;
//		d.style.top = document.documentElement.scrollTop;		
//		d.style.left = document.documentElement.scrollLeft;			
	}
	
	window.onresize = function() {
		
//		IGN_OnResize();	
	}

	window.onscroll = function() {			
		IGN_OnScroll();
	}
	
	function IGN_OnScroll() {
		var d = document.getElementById("dprv");	
		d.style.top = document.body.scrollTop;		
		d.style.left = document.body.scrollLeft;	
//		d.style.width = document.body.scrollWidth;
//		d.style.height = document.body.scrollHeight;		
	}
	
	function IGN_Hide () {
		var d = document.getElementById("dprv");	
		
		d.style.display = "none";	
		
		IGN_ShowHideControls(true);		
	}
	
	function IGN_Show_IFrameOnLoad() {
		resizeTo(200,200);
		alert('ok');
	}
	
	
	function IGN_Show_RF(FlashVars, FlashVarsCustom) {

		FlashVars = FlashVars + '&bgcolor=999999&bgalpha=75&op=1111&CF=1'+FlashVarsCustom;

	
	s = 
"<SCRIPT type=text/javascript>AC_FL_RunContent( 'codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','100%','height','100%','src','Admin/icons/RF?{FlashVars}','quality','high','allowscriptaccess','sameDomain','pluginspage','http://www.macromedia.com/go/getflashplayer','wmode','transparen','scale','noscale','flashvars','{FlashVars}','movie','Admin/icons/RF?{FlashVars}' ); //end AC code  </SCRIPT>" + 

'<OBJECT codeBase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 height="100%" width="100%" classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000><PARAM NAME="_cx" VALUE="29924"><PARAM NAME="_cy" VALUE="529"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="Admin/icons/RF.swf?{FlashVars}"><PARAM NAME="Src" VALUE="Admin/icons/RF.swf?{FlashVars}"><PARAM NAME="WMode" VALUE="Transparent"><PARAM NAME="Play" VALUE="0"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE="sameDomain"><PARAM NAME="Scale" VALUE="NoScale"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false">  <embed width="100%" height="100%" src="Admin/icons/RF.swf?{FlashVars}" quality="high" allowscriptaccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" scale="noscale" flashvars="{FlashVars}" type="application/x-shockwave-flash"  ></embed></OBJECT><NOSCRIPT>  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%">    <param name="movie" value="Admin/icons/RF.swf?{FlashVars}">    <param name="quality" value="high">    <param name="allowScriptAccess" value="sameDomain">    <param name="wmode" value="transparent">    <param name="SCALE" value="noscale">    <param name="flashVars" value="{FlashVars}">  <embed src="Admin/icons/RF.swf?{FlashVars}" width="100%" height="100%" quality="high" allowscriptaccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" scale="noscale" flashvars="{FlashVars}"></embed> </object>  </NOSCRIPT>'
	
//	var s1 = new String(s)
	s = s.replace(/{FlashVars}/g, FlashVars);
//alert(s)

//	document.getElementById('txt').value = s;
	
	//wylaczam
	
	IGN_ShowHideControls(false);


	return s;

}
	

//sztuczka
function IGN_ShowHideControls ( Show ) {
	
	var objField = document.getElementsByTagName('select');
		for (var i=0; i<objField.length; i++) {
			if (Show) objField[i].style.display = 'inline';
				 else objField[i].style.display = 'none';
		}	
		
}
	
	
	