














function puwinget(path,wname,title,w,h) {
	if(path.search('http://')==-1) path='../'+path;
	if(wname=='') wname='puwin';
	if(title=='') title=' ';
	if(!w) w=100; if(!h) h=100;
	window.open('php/puwinget.php?path='+urlencode(path)+'&title='+urlencode(title)+'&w='+w+'&h='+h,wname,'width='+w+',height='+h+',resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no');
}
var puwinchild=new Object();
function puwin(path,wname,title,w,h) {
	if(wname=='') wname='puwin';
	if(title=='') title=' ';
	if(!w) w=100; if(!h) h=100;
	if( !(path.toLowerCase().substring(path.indexOf('.jpg'))=='.jpg')&&
		!(path.toLowerCase().substring(path.indexOf('.gif'))=='.gif')&&
		!(path.toLowerCase().substring(path.indexOf('.png'))=='.png')&&
		!(path.toLowerCase().substring(path.indexOf('.bmp'))=='.bmp')&&
		!(path.toLowerCase().substring(path.indexOf('.pdf'))=='.pdf')&&
		!(path.toLowerCase().substring(path.indexOf('.avi'))=='.avi')&&
		!(path.toLowerCase().substring(path.indexOf('.wmv'))=='.wmv')&&
		!(path.toLowerCase().substring(path.indexOf('.mpg'))=='.mpg')&&
		!(path.toLowerCase().substring(path.indexOf('.mov'))=='.mov')&&
		!(path.toLowerCase().substring(path.indexOf('.m4v'))=='.m4v')&&
		!(path.toLowerCase().substring(path.indexOf('.mp4'))=='.mp4')&&
		!(path.toLowerCase().substring(path.indexOf('.flv'))=='.flv')&&
		!(path.toLowerCase().substring(path.indexOf('.swf'))=='.swf') ) {
		window.open(path,wname,'width='+w+',height='+h+',top='+((screen.height-h)/2)+',left='+((screen.width-w)/2)+',resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no');
		return;
	}
	if(path.search('http://')==-1) path='../'+path;
	var bd=document.body;
	var d=document.createElement('div');
	d.style.visibility='hidden';
	var f=document.createElement('form');
	f.action='php/puwin.php'; f.target=wname; f.method="post";
	var hid=0;
	hid=document.createElement('input'); hid.type='hidden';
	hid.name='path'; hid.value=path; f.appendChild(hid);
	hid=document.createElement('input'); hid.type='hidden';
	hid.name='title'; hid.value=title; f.appendChild(hid);
	hid=document.createElement('input'); hid.type='hidden';
	hid.name='w'; hid.value=w; f.appendChild(hid);
	hid=document.createElement('input'); hid.type='hidden';
	hid.name='h'; hid.value=h; f.appendChild(hid);
	d.appendChild(f);
	bd.appendChild(d);


puwinchild[wname]=window.open('',wname,'width='+w+',height='+h+',alwaysRaised=yes,resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no');
puwinchild[wname].focus();

	f.submit();
}
function resizepuwin(imgid) {
	var img=document.getElementById(imgid); var ow=img.width; var oh=img.height;
	var fixw=0; var fixh=0;
	if(isie()){fixw=-20;fixh=-20;}
	/*if(isie()&&isie()<=6) fixh=60;
	else if(isie()>=7) fixh=80;
	else if(isff()) fixh=85;
	else if(issaf()) {fixw=5; fixh=30;}*/
	//window.moveTo((screen.availWidth-img.width+fixw)/2,(screen.availHeight-img.height+fixh)/2);
	window.resizeTo(img.width+getwinframew(window)+fixw,img.height+getwinframeh(window)+fixh);
}
function resizepuwinflv(flvw,flvh) {
	var fixw=0; var fixh=0;
	if(isie()){fixw=-20;fixh=-20;}
	/*if(isie()&&isie()<=6) fixh=60;
	else if(isie()>=7) fixh=80;
	else if(isff()) fixh=85;
	else if(issaf()) {fixw=5; fixh=30;}*/
	//window.moveTo((screen.availWidth-flvw+fixw)/2,(screen.availHeight-flvh+fixh)/2);
	window.resizeTo(flvw+getwinframew(window)+fixw,flvh+getwinframeh(window)+fixh);
}
function centerpuwin(win) {
	if(!win) win=window;
	var screenw=screen.availWidth; var screenh=screen.availHeight;
	var winw=getwinw(win); var winh=getwinh(win);
	var winx=(screenw-winw)/2; var winy=(screenh-winh)/2;
	if(winw>screenw) winx=0; if(winh>screenh) winy=0;
	win.moveTo(winx,winy);
}





