function windowstop(){
	if(window.stop)window.stop();
	else if(document.execCommand) document.execCommand('Stop');
}

function winopen(url){
	window.open(url, arguments[1] ? arguments[1] : '_blank');
}

function popupopen(url){
	var name=arguments[3] ? arguments[3] : 'pwin';

	var p="toolbar=no,location=no,directories=no,status=0,menubar=no,scrollbars=yes,resizable=1";
	if(arguments[1]) p+=",width=" + arguments[1];
	if(arguments[2]) p+=",height=" + arguments[2];
	var win = window.open (url,name,  p);
	win.focus();
	return win;
}

function fitPic(p){
	window.open('picture.html?'+p,'fitWindow','height=100,width=100,top=0,left=0,z-lock=1,resizable=1');
}
function fitDialog(){
	var b=document.body;
	window.dialogWidth=parseInt(window.dialogWidth.substring(0, window.dialogWidth.length-2))+b.scrollWidth-b.clientWidth+'px';
	window.dialogHeight=parseInt(window.dialogHeight.substring(0, window.dialogHeight.length-2))+b.scrollHeight-b.clientHeight+'px';
	var x, y;
	x=(window.screen.width-parseInt(window.dialogWidth.substring(0, window.dialogWidth.length-2)))/2;
	y=(window.screen.height-parseInt(window.dialogHeight.substring(0, window.dialogHeight.length-2)))/2;
	if(x>=0)window.dialogLeft=x;
	else window.dialogLeft=0;
	if(y>=0)window.dialogTop=y;
	else window.dialogTop=0;
}
function fitWin(){
	if(navigator.appName.indexOf('Microsoft')>=0)
		window.resizeBy(document.body.scrollWidth-document.body.clientWidth, document.body.scrollHeight-document.body.clientHeight);
	else window.resizeBy(document.width-window.innerWidth, document.height-window.innerHeight);
}
function winCenter(){
	var w, h;

	if(document.body.clientWidth){
		w=document.body.clientWidth;
		h=document.body.clientHeight;
	}
	else if(window.outerWidth){
		w=window.outerWidth;
		h=window.outerHeight;
	}
	else if(window.documentElement && window.documentElement.clientWidth){
		w=window.documentElement.clientWidth;
		h=window.documentElement.clientHeight;
	}
	else return;
	var x, y;
	x=(screen.width-w)/2;
	y=(screen.height-h)/2;
//	x=(parent.width-w)/2;
//	y=(parent.height-h)/2;
	if(!(x>0))x=0;
	if(!(y>0))y=0;
	window.moveTo(x,y);

}
function modalOpen(url){
	return showModalDialog(url, window, "status:0;resizable:1;");
}
function clickwin(url){
	var w, h, n='clickwin';
	if(arguments[1]!=null)w=",width="+arguments[1];
	if(arguments[2]!=null)h=",height="+arguments[2];
	if(arguments[3]!=null)n=arguments[3];
	var win=window.open(url, n, 'toolbar=0'+w+h+',resizable=1,personalbar=0,status=0,scrollbars=1,menubar=0');
	win.focus();
}

function confirmgo(msg, url){
	if(!msg || msg=='')msg='Are you sure to delete this item?';
	if(arguments[2]) url+="&redirect="+encodeURIComponent(location.href);
	if(confirm(msg))window.location.href=url;
}
function locationgo(url){
	if(arguments[1]){
		if(arguments[1].confirm && !confirm(arguments[1].confirm))reutrn;
		if(arguments[1].prompt) url+=prompt(arguments[1].prompt, arguments[1].promptdft);
		if(arguments[1].addredir) url+="&redirect="+encodeURIComponent(location.url);
	}
	window.location.href=url;
}
