function showsp(spname)
{
for (i=1;i<=20;i++)
if (document.getElementById('sp'+i)!=null) document.getElementById('sp'+i).style.display='none';
if (document.getElementById(spname)!=null) document.getElementById(spname).style.display='';
}
//GENERAL FUNCTION
function replaceAll(source, findString, replaceString)
{
var result = source;
var i = source.indexOf(findString);
var l1 = findString.length;
while (i >= 0) { result = source.substring(0, i); result += replaceString; result += source.substring(i + l1); source = result; i = source.indexOf(findString); }
return result;
}
function separate(str,separator)
{
s='';
result = new Array();
for (w=0;w<=str.length-1;w++)
{
if (String.fromCharCode(str.charCodeAt(w))!=separator) s+=String.fromCharCode(str.charCodeAt(w));
if (String.fromCharCode(str.charCodeAt(w))==separator) {result.push(s);s='';}
if ((w==str.length-1) && (String.fromCharCode(str.charCodeAt(w))!=separator)) {result.push(s);s='';}
}
return result;
}
//MENUS FUNCTIONS
function showhide(object)
{
if (object.style.display=='none') {object.style.display='block';} else {object.style.display='none';}
}
//PS
function drawtag(title,globalvalue)
{
mainbody=new Array("","","");
innertag=mainbody[0]+title+mainbody[1]+globalvalue+mainbody[2];
return innertag;
}
function loaddata(newobject,innertag)
{
if (parent.document.getElementById(newobject)!=null) {parent.document.getElementById(newobject).innerHTML=innertag};
}
function savedata(newobject,innertag)
{
if (document.getElementById('ps')!=null) {ps.document.getElementById(newobject).innerHTML=innertag};
}
function savebody()
{
if (document.getElementById('bodyid')!=null) savedata('bodyid',document.getElementById('bodyid').innerHTML);
}
//NEWS_PANEL FUNCTIONS
function closeall()
{
for (i=1;i<=10;i++) {
if (document.getElementById('Panel'+i)!=null) document.getElementById('Panel'+i).style.display='none';
if (document.getElementById('RadioButton'+i)!=null) document.getElementById('RadioButton'+i).checked=false;
}
}
function radio_select(code)
{
closeall();
if (document.getElementById('Panel'+code)!=null) document.getElementById('Panel'+code).style.display='block';
if (document.getElementById('RadioButton'+code)!=null) document.getElementById('RadioButton'+code).checked=true;
if (document.getElementById('ps')!=null)
{
if (ps.document.getElementById('Panel'+code)!=null) ps.document.getElementById('Panel'+code).style.display='block';
if (ps.document.getElementById('RadioButton'+code)!=null) ps.document.getElementById('RadioButton'+code).checked=true;
}
}
//SHORTSTR FUNCTIONS
function shortstr(str,strcount,code)
{
result=str;
if (str.length>=strcount)
{
result='';
bool=true;
for (k=0;k<=str.length-1;k++) {if (bool) if ((k==strcount) || (String.fromCharCode(str.charCodeAt(k))=='<')) {result+=" .... (ادامه متن)";bool=false;}result +=String.fromCharCode(str.charCodeAt(k));if (k==str.length-1) result+="
(بستن متن)";}
}
return result;
}
function continue_click(myobject,code)
{
myobject.style.display='none';
if (myobject.id=='continue_link_'+code) document.getElementById('close_link_'+code).style.display='inline';
if (myobject.id=='close_link_'+code) document.getElementById('continue_link_'+code).style.display='inline';
if (document.getElementById('continue_'+code).style.display=='none') {document.getElementById('continue_'+code).style.display='inline';} else {document.getElementById('continue_'+code).style.display='none';}
}
//MOUSE POSITION
function MouseX(event)
{
return (event.pageX || event.x + (parent.document.documentElement.scrollLeft || parent.document.body.scrollLeft));
}
function MouseY(event)
{
return (event.pageY || event.y + (parent.document.documentElement.scrollTop || parent.document.body.scrollTop));
}
//PERSIAN REQUIRED
function submitenter(myfield,e)
{
var key;
if (event)
key = event.keyCode;
else if (e)
key = e.which;
if (key>31)
if (key<128)
{
if (event)
event.keyCode=' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُىلآ÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزیثبلاهتنمئدخحضقسفعرصطغظ<|>ّ'.charCodeAt(key-32);
else if (e)
e.which=' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُىلآ÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزیثبلاهتنمئدخحضقسفعرصطغظ<|>ّ'.charCodeAt(key-32);
}
return true;
}