function popup(url, window_name, window_width, window_height, scrollbars) 
{
	settings=
	"toolbar=0,location=0,directories=0,"+
	"status=0,menubar=0,scrollbars="+(scrollbars?scrollbars:"0")+","+
	"resizable=yes,width="+window_width+",height="+window_height;
	NewWindow=window.open(url,window_name,settings);
}
function playflash(place,width,height,url)
{
	echo(place,'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,42,0" id="flashplayer" width='+width+' height='+height+' topmargin=0 leftmargin=0 style="padding:0"> <param name="movie" value="'+dc(url)+'"> <param name="quality" value="high"></object>')
}
function playmedia(place,width,height,url)
{
	echo(place,'<object id="MyPlayer" pluginspage=http://www.microsoft.com/windows/downloads/contents/products/mediaplayer/ type=application/x-mplayer2 width='+width+' height='+height+' autostart=1 showcontrols=1 classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6"> <param name="showstatusbar" value="0"> <param name="volume" value="100"><param name="enableContextMenu" value="0"> <param name="enableErrorDialogs" value="0"> <param name="url" value="'+url+'"></object>');
	MyPlayer.settings.setMode("shuffle",true);
	MyPlayer.settings.setMode("loop",true);
}
function str_replace(oldstr,newstr,str)
{
	var markstr="`~`";
	while(str.match(oldstr))
		str=str.replace(oldstr,markstr);
	while(str.match(markstr))
		str=str.replace(markstr,newstr);
	return(str);
}
function addslashes(str)
{
	var sl=String.fromCharCode(92);
	var qt=String.fromCharCode(34);
	var dqt=String.fromCharCode(39);
	//str=str_replace(sl,sl+sl,str);
	str=str_replace(dqt,sl+dqt,str);
	str=str_replace(qt,sl+qt,str);	
	return(str);
}
function stripslashes(str)
{
	var sl=String.fromCharCode(92);
	var qt=String.fromCharCode(34);
	var dqt=String.fromCharCode(39);
	//str=str_replace(sl+sl,sl,str);
	str=str_replace(sl+dqt,dqt,str);
	str=str_replace(sl+qt,qt,str);	
	return(str);
}
function repdq(str)
{
	str=str_replace("\"","~dq~",str);
	return(str);
}
function resdq(str)//restore double quote
{
	str=str_replace("~dq~","\"",str);
	return(str);
}
function repnl(str)//Replace newline
{
	str=str_replace("\n","~nl~",str);
	return(str);
}
function resnl(str)//Restore new line
{
	str=str_replace("~nl~",String.fromCharCode(13),str);
	return(str);
}
function reptag(str)
{
	str=str_replace("<","~ot~",str);
	str=str_replace(">","~ct~",str);
	return(str);
}
function restag(str)
{
	str=str_replace("~ot~","<",str);
	str=str_replace("~ct~",">",str);
	return(str);
}
//All quotes and dbquotes
function repqs(str)
{
	str=str_replace("'","!q!",str);
	str=str_replace("\"","!dq!",str);
	return str;
}
function resqs(str)
{
	str=str_replace("!q!","'",str);
	str=str_replace("!dq!","\"",str);
	return str;
}
function dc(str)
{
	var	markstr="!?";
	var newstr="";
	if(str.match(markstr))
	{		
		str=str.replace(markstr,"");
		str=str_replace("!qt","'",str);
		str=str_replace("!dqt","\"",str);
		str=str_replace("!bsl","\\",str);
		str=str_replace("!per","%",str);
		for(var i=0; i<str.length; i++)
		{
			newstr+=String.fromCharCode(str.charCodeAt(i)+10);
		}
		return newstr;
	}
	else return str;
}
function htmlspecialchars(str)
{
	str=str_replace("&","&amp;",str);
	str=str_replace("<","&lt;",str);
	str=str_replace(">","&gt;",str);
	return(str);
}
function echo(id,msg)
{
	id.innerHTML=msg;
}
//graphic////////////////////////////////////////////////////////////////////////
function newImage(arg) 
{
	if (document.images) 
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
