///////////////////////////////////////////////////

// tools.js, last edited: 29.12.2001             //

// required modules:  none                       //

// by WIERZBICKI.ORG, http://www.WIERZBICKI.ORG  //

///////////////////////////////////////////////////



function openMediaWindow(url,w,h,x0,y0) {

///////////////////////////////////////

        WinAtts='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=50,top=50'

        WinAtts+=',copyhistory=0,width='+w+',height='+h+',alwaysRaised=1'

	if (x0!='') WinAtts+=',left='+x0+',top='+y0

        mediaWindow=window.open(url,'mediaWindow',WinAtts)

}



function codeImage(url) {

///////////////////////

	str+='<img src="'+url+'">'

	return str;

}



function codeFlashObject(url,w,h,bgcolor) {

/////////////////////////////////////////

	l=codeFlashObject.arguments.length;

	if (l<4) {bgcolor='#000000'};

	if (l<3) {h=300;}

	if (l<2) {w=400;}			

	str='';

	str+='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+w+' HEIGHT='+h+'>';

	str+='<PARAM NAME=movie VALUE="'+url+'">';

	str+='<PARAM NAME=quality VALUE=high>';

	str+='<PARAM NAME=bgcolor VALUE='+bgcolor+'>';

	str+='<EMBED src="'+url+'" quality=high bgcolor='+bgcolor+' WIDTH='+w+' HEIGHT='+h+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>';

	return str;

}



function openMediaWindow(url,w,h,x0,y0,bgcolor,scrollingOn) {

///////////////////////////////////////////////////////////

	isFlash=(url.indexOf('swf')>0);

	if (openMediaWindow.arguments.length<7) scrollingOn=0;

	if (openMediaWindow.arguments.length<6) bgcolor='#000000';

	dw=0;dh=0;

	if (browserType=='ne') {dw=36;dh=36}

	w_w=w+dw; w_h=h+dh;//alert(w+"  "+h)

	WinAtts='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+scrollingOn;

	WinAtts+=',resizable=0,copyhistory=0,width='+w_w+',height='+w_h+',alwaysRaised=1';

	if (x0!='') WinAtts+=',left='+x0+',top='+y0;

	mediaWindow=window.open("",'mediaWindow',WinAtts);

	if (isFlash) {

		if (browserType=='ie')  {mediaWindow.resizeTo(w+10,h+30);}

		if (browserType=='ne6') {mediaWindow.resizeTo(w+20,h+26);}

	}

	else mediaWindow.resizeTo(w,h);

	mediaWindow.document.clear();

	mediaWindow.document.close();

	mediaWindow.document.open();



	str='<html><head><title>[:::::::::: WIERZBICKI.ORG, Media Viewer ::::::::::]</title>';

	str+='<scr'+'ipt language="JavaScript"><!--\nfunction alwaysOnTop() { setTimeout("self.focus()",400);}\n'

	str+='//-->\n</scr'+'ipt>\n</head>\n';

	str+='<body bgcolor="'+bgcolor+'" topmargin="0" leftmargin="0" onblur="alwaysOnTop()">';

	str+='<div align="center"><center>';

	str+='<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td align="center" width="100%" height="100%">';

//	content here



	if (url.indexOf('swf')>0) {str+=codeFlashObject(url,w,h,bgcolor)}

	else {str+=codeImage(url)};



	str+='</td></tr></table></center></div></body></html>';  //<p align="center">

	mediaWindow.document.write(str);

	mediaWindow.document.close();

	mediaWindow.focus();

}





function openMediaWindow2(url,w,h,x0,y0,scrollingOn) {

////////////////////////////////////////////////////

	if (openMediaWindow2.arguments.length) scrollingOn=0;

        WinAtts='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+scrollingOn;

        WinAtts+=',resizable=0,copyhistory=0,width='+w+',height='+h+',alwaysRaised=1';

	if (x0!='') WinAtts+=',left='+x0+',top='+y0;

        mediaWindow=window.open("",'mediaWindow',WinAtts);

	mediaWindow.resizeTo(w,h);

//	mediaWindow.document.clear();

//	mediaWindow.document.open();

//	str='<html><head><title>[:::::::::: WIERZBICKI.ORG, Media Viewer ::::::::::]</title>';

//	str+='<scr'+'ipt language="JavaScript"><!--\nfunction alwaysOnTop() { setTimeout("self.focus()",400);}\n'

//	str+='//-->\n</scr'+'ipt>\n</head>\n';

//	str+='<body topmargin="0" leftmargin="0" onblur="alwaysOnTop()">';

//	str+='<table border="0" cellspacin="0" cellpadding="0" width="100%"><tr><td width="100%">';

//	content here	

//	str+='<img src="'+url+'">'

	

//	str+='</td></tr></table></body></html>';  //<p align="center">



	mediaWindow.location.href=url;



//	mediaWindow.document.write(str);

//	mediaWindow.document.close();

	mediaWindow.focus();

}



function newImage(arg) {

//////////////////////

	if (document.images) {

		rslt = new Image();

		rslt.src = arg;

		return rslt;

	}

}



function changeImages() {

///////////////////////

	if (document.images && (preloadFlag == true)) {

		for (var i=0; i<changeImages.arguments.length; i+=2) {

			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];

		}

	}

}



function setFullScreen() {

/////////////////////

	if ((window.resizeTo) && (window.moveTo)) {

		window.moveTo ("-4","-4");

		window.resizeTo(screen.availWidth+4, screen.availHeight+4);	

	}

} 



function getHtmlName(n) {

///////////////////////

	n=n+"";

	len=n.length;

	pos=n.indexOf("/");

	while (pos!=-1) {

		n=n.substring(pos+1,len);

		pos=n.indexOf("/");

		len=n.length;

	}

	return n;

}
