//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; } } //LIMITATION FUNCTIONS document.onselectstart=new Function("return false") document.oncontextmenu=new Function("return false") //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+=" .... (ادامه متن)";} } 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';} } //SCROLLING MENU function scrolling(objectname,objecttop) { document.getElementById(objectname).style.position='absolute'; document.getElementById(objectname).style.top=parseInt(document.getElementById(objectname).style.top)+(document.body.scrollTop-parseInt(document.getElementById(objectname).style.top)+objecttop)/20; setTimeout('scrolling("'+objectname+'",'+objecttop+')',50); } bool=false; bool2=false; menunum=0; function showsubmenus(menuscount,n) { n+=5; document.getElementById('submenu'+menunum).style.display=''; if (document.getElementById('submenu'+menunum)!=null) document.getElementById('submenu'+menunum).style.filter='alpha(opacity='+n+')'; if (document.getElementById('subtext'+menunum)!=null) document.getElementById('subtext'+menunum).style.display=''; if (n>=60 && menunum1) {if (document.getElementById('submenu'+(menunum-1))!=null) document.getElementById('submenu'+(menunum-1)).style.filter='alpha(opacity='+(n+60)+')';} if (bool) setTimeout('showsubmenus('+menuscount+','+n+')',25); } function hidesubmenus(menuscount) { for (i=1;i<=menuscount;i++) {document.getElementById('submenu'+i).style.filter='alpha(opacity=0)';document.getElementById('submenu'+i).style.display='none';} for (i=1;i<=menuscount;i++) {document.getElementById('subtext'+i).style.display='none';} } function menuout() { if (!bool2) {document.getElementById('menu').style.filter='alpha(opacity=80)';bool=false;setTimeout('hidesubmenus(5)',200);} } //RIGHT CLICK function rightclick() { if (document.getElementById('popup2').style.display=='none') document.getElementById('popup').style.display=''; return false; } function objmenu() { parent.document.getElementById('popup2').style.display=''; return false; } function popupmove(objectname,e) { if (parent.document.getElementById(objectname)!=null) { if (MouseX(e)parseInt(parent.document.getElementById(objectname).style.left)+parseInt(parent.document.getElementById(objectname).style.width) || MouseY(e)parseInt(parent.document.getElementById(objectname).style.top)+parseInt(parent.document.getElementById(objectname).style.height)) { parent.document.getElementById(objectname).style.display='none'; if (MouseX(e)+parseInt(parent.document.getElementById(objectname).style.width)<778) {parent.document.getElementById(objectname).style.left=MouseX(e);} else {parent.document.getElementById(objectname).style.left=MouseX(e)-parseInt(parent.document.getElementById(objectname).style.width);} if (MouseY(e)+parseInt(parent.document.getElementById(objectname).style.height)<600) {parent.document.getElementById(objectname).style.top=MouseY(e);} else {parent.document.getElementById(objectname).style.top=MouseY(e)-parseInt(parent.document.getElementById(objectname).style.height);} } } } //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)); } //ITEMS objectid=0; objectkind=''; function addtextarea(backcolor,bordercolor,bordercolor2) { parent.document.getElementById('textareacount').value=parseInt(parent.document.getElementById('textareacount').value)+1; parent.farmandarips.document.getElementById('textareacount').value=parseInt(parent.farmandarips.document.getElementById('textareacount').value)+1; document.getElementById('globaltag').innerHTML+=""; parent.document.getElementById('textarea_'+parent.document.getElementById('textareacount').value).style.voiceFamily=""; setrightclick(); document.getElementById('popup').style.display='none'; } function addimage(rnd,imgw,imgh) { parent.document.getElementById('imagecount').value=parseInt(parent.document.getElementById('imagecount').value)+1; parent.farmandarips.document.getElementById('imagecount').value=parseInt(parent.farmandarips.document.getElementById('imagecount').value)+1; parent.document.getElementById('globaltag').innerHTML+=""; parent.document.getElementById('image_'+parent.document.getElementById('imagecount').value).style.voiceFamily="globalpics/"+rnd+".jpg"; setrightclick(); parent.document.getElementById('popup').style.display='none'; } function getcount(objectkind) { result=0; while (parent.document.getElementById('span_'+objectkind+'_'+(result+1))!=null) result++; return result; } function setrightclick() { for (q=1;q<=parent.document.getElementById('textareacount').value;q++) {if (parent.document.getElementById('textarea_'+q)!=null) parent.document.getElementById('textarea_'+q).oncontextmenu=objmenu;} for (q=1;q<=parent.document.getElementById('imagecount').value;q++) {if (parent.document.getElementById('image_'+q)!=null) parent.document.getElementById('image_'+q).oncontextmenu=objmenu;} } function tostring(str) { result=''; if (str!=null) result=str; return result; } function isselected(objectproperty,value) { result = ''; if (objectproperty==value) result='selected'; return result; } function showproperties() { if (objectkind=='textarea') { propertiestag=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+="
نام"+objectid+"
طول افقی
ارتفاع
مختصات افقی
مختصات عمودی
فونت
پررنگ
اندازه نوشته
فاصله خطوط
رنگ
پس زمینه
جهت
لینک
نوع لینک
"; parent.document.getElementById('propertiesin').innerHTML=propertiestag; } if (objectkind=='image') { propertiestag=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+="
نام"+objectid+"
طول افقی
ارتفاع
مختصات افقی
مختصات عمودی
لینک
نوع لینک
"; parent.document.getElementById('propertiesin').innerHTML=propertiestag; } if (objectkind=='base') { docname=separate(document.farmandarips.location.href,'='); doc=' '; if (docname.length==2) doc=docname[1]; propertiestag=""; propertiestag+=""; propertiestag+=""; propertiestag+=""; propertiestag+="
نام"+doc+"
ارتفاع
"; parent.document.getElementById('propertiesin').innerHTML=propertiestag; } } //FORM FUNCTIONS formpress=''; formx=0; formy=0; formw=0; formh=0; mx=0; my=0; xresizing=false; yresizing=false; function dragdown(myobject,e) { formx=parseInt(myobject.style.left); formy=parseInt(myobject.style.top); formw=parseInt(myobject.style.width); formh=parseInt(myobject.style.height); mx=MouseX(e); my=MouseY(e); formpress=myobject.id; if (myobject.style.cursor=='e-resize') xresizing=true; if (myobject.style.cursor=='s-resize') yresizing=true; if (myobject.style.cursor=='se-resize') {xresizing=true;yresizing=true;} } function dragup() { if (formpress!='') { parent.document.getElementById(formpress).style.cursor='default'; if (xresizing) parent.document.getElementById(formpress).style.cursor='e-resize'; if (yresizing) parent.document.getElementById(formpress).style.cursor='s-resize'; if (xresizing && yresizing) parent.document.getElementById(formpress).style.cursor='se-resize'; showproperties(); } formpress=''; xresizing=false; yresizing=false; } function dragmove(e) { if (formpress!='') //****main if***// { if (xresizing) { if (MouseX(e) - mx + formw>=20) parent.document.getElementById(formpress).style.width=MouseX(e) - mx + formw; } if (yresizing) { if (MouseY(e) - my + formh>=20) parent.document.getElementById(formpress).style.height=MouseY(e) - my + formh; } if (!xresizing && !yresizing) { if (MouseX(e) - mx + formx>0) {parent.document.getElementById(formpress).style.left=MouseX(e) - mx + formx;} else {parent.document.getElementById(formpress).style.left=0;} if (MouseY(e) - my + formy>0) {parent.document.getElementById(formpress).style.top=MouseY(e) - my + formy;} else {parent.document.getElementById(formpress).style.top=0;} parent.document.getElementById(formpress).style.cursor='move'; } } //****end of main if****// } function formclose(myobject) { myobject.style.display='none'; } function resizecursor(myobject,e) { if (MouseX(e)>=parseInt(myobject.style.left)+parseInt(myobject.style.width)-4) {myobject.style.cursor='e-resize';} if (MouseY(e)>=parseInt(myobject.style.top)+parseInt(myobject.style.height)-4) {myobject.style.cursor='s-resize';} if (MouseX(e)>=parseInt(myobject.style.left)+parseInt(myobject.style.width)-4 && MouseY(e)>=parseInt(myobject.style.top)+parseInt(myobject.style.height)-4) {myobject.style.cursor='se-resize';} if (MouseX(e)=6 && MouseX(e) - mx + formx<=106) parent.document.getElementById(barpress).style.left=MouseX(e) - mx + formx; } } function setcolor() { rcol=Math.round((parseInt(document.getElementById('rbar').style.left)-6) * 255 / 100); gcol=Math.round((parseInt(document.getElementById('gbar').style.left)-6) * 255 / 100); bcol=Math.round((parseInt(document.getElementById('bbar').style.left)-6) * 255 / 100); document.getElementById('rcolor').innerHTML=rcol; document.getElementById('gcolor').innerHTML=gcol; document.getElementById('bcolor').innerHTML=bcol; document.getElementById('maincolor').style.backgroundColor=tohex(rcol)+''+tohex(gcol)+''+tohex(bcol); } function ishex(char) { return ((char.charCodeAt(0)>='0'.charCodeAt(0) && char.charCodeAt(0)<='9'.charCodeAt(0)) || (char.charCodeAt(0)>='A'.charCodeAt(0) && char.charCodeAt(0)<='F'.charCodeAt(0)) || (char.charCodeAt(0)>='a'.charCodeAt(0) && char.charCodeAt(0)<='f'.charCodeAt(0))); } function iscolorcode(mcolor) { bool=false; if (mcolor.length==7) bool=(String.fromCharCode(mcolor.charCodeAt(0))=='#' && ishex(String.fromCharCode(mcolor.charCodeAt(1))) && ishex(String.fromCharCode(mcolor.charCodeAt(2))) && ishex(String.fromCharCode(mcolor.charCodeAt(3))) && ishex(String.fromCharCode(mcolor.charCodeAt(4))) && ishex(String.fromCharCode(mcolor.charCodeAt(5))) && ishex(String.fromCharCode(mcolor.charCodeAt(6)))); if (mcolor.length==6) bool=(ishex(String.fromCharCode(mcolor.charCodeAt(0))) && ishex(String.fromCharCode(mcolor.charCodeAt(1))) && ishex(String.fromCharCode(mcolor.charCodeAt(2))) && ishex(String.fromCharCode(mcolor.charCodeAt(3))) && ishex(String.fromCharCode(mcolor.charCodeAt(4))) && ishex(String.fromCharCode(mcolor.charCodeAt(5)))); return bool; } function getcolor(mcolor) { if (iscolorcode(mcolor)) { rcol=todec(String.fromCharCode(mcolor.charCodeAt(1))+''+String.fromCharCode(mcolor.charCodeAt(2))); gcol=todec(String.fromCharCode(mcolor.charCodeAt(3))+''+String.fromCharCode(mcolor.charCodeAt(4))); bcol=todec(String.fromCharCode(mcolor.charCodeAt(5))+''+String.fromCharCode(mcolor.charCodeAt(6))); document.getElementById('rcolor').innerText=rcol; document.getElementById('gcolor').innerText=gcol; document.getElementById('bcolor').innerText=bcol; document.getElementById('rbar').style.left=(rcol * 100 / 255)+6; document.getElementById('gbar').style.left=(gcol * 100 / 255)+6; document.getElementById('bbar').style.left=(bcol * 100 / 255)+6; document.getElementById('maincolor').style.backgroundColor=mcolor; } } function dectohex(d) { result=d+''; if (result==10) result='A'; if (result==11) result='B'; if (result==12) result='C'; if (result==13) result='D'; if (result==14) result='E'; if (result==15) result='F'; return result; } function tohex(d) { return dectohex(Math.floor(d /16)) + dectohex(d%16) + ''; } function hextodec(h) { result=h+''; if (result=='A' || result=='a') result=10; if (result=='B' || result=='b') result=11; if (result=='C' || result=='c') result=12; if (result=='D' || result=='d') result=13; if (result=='E' || result=='e') result=14; if (result=='F' || result=='f') result=15; return parseInt(result); } function todec(h) { return (hextodec(String.fromCharCode(h.charCodeAt(0)))) * 16 + hextodec(String.fromCharCode(h.charCodeAt(1))); } //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; }