/* eSmaeilpoor.info@gmail.com */ var Try={these:function(){var returnValue;for(var i=0;i]*>([\s\S]*?)<\/script>/gi;while((script=regexp.exec(this)))scripts.push(script[1]);scripts=scripts.join('\n');if(scripts) (window.execScript)?window.execScript(scripts):window.setTimeout(scripts,0);}catch(e){}}});new function(){var b=navigator.userAgent.toLowerCase();browser={safari:/webkit/.test(b),opera:/opera/.test(b),msie:/msie/.test(b)&&!/opera/.test(b),mozilla:/mozilla/.test(b)&&!/(compatible|webkit)/.test(b)};};var Event={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},pointerX:function(event){return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(event){return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation();}else{event.returnValue=false;}},findElement:function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase()))) element=element.parentNode;return element;},observers:false,_observeAndCache:function(element,name,observer,useCapture){if(!this.observers)this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer);}},unloadCache:function(){if(!Event.observers)return;for(var i=0;i0)||element.attachEvent)) name='keydown';this._observeAndCache(element,name,observer,useCapture);},stopObserving:function(element,name,observer,useCapture){var element=$(element);useCapture=useCapture||false;if(name=='keypress'&&((navigator.appVersion.indexOf('AppleWebKit')>0)||element.detachEvent)) name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){element.detachEvent('on'+name,observer);}},isReady:false,readyList:[],onReady:function(fn){Event.readyList.push(fn);},ready:function(){if(!Event.isReady){Event.isReady=true;if(Event.readyList){Event.readyList.each(function(f){f.apply(document);});Event.readyList=null;} if(browser.mozilla||browser.opera) document.removeEventListener("DOMContentLoaded",Event.ready,false);}}};new function(){if(browser.mozilla||browser.opera) document.addEventListener("DOMContentLoaded",Event.ready,false);else if(browser.msie){document.write("<\/script>");var script=document.getElementById("__ie_init");if(script) script.onreadystatechange=function(){if(this.readyState!="complete")return;this.parentNode.removeChild(this);Event.ready();};script=null;}else if(browser.safari) var safariTimer=setInterval(function(){if(document.readyState=="loaded"||document.readyState=="complete"){clearInterval(safariTimer);safariTimer=null;Event.ready();}},10);else Event.observe(window,"load",Event.ready);} var XHR=new Class({options:{method:'post',async:true,onRequest:Class.empty,onSuccess:Class.empty,onFailure:Class.empty,urlEncoded:true,encoding:'utf-8',autoCancel:false,headers:{}},setTransport:function(){this.transport=Try.these(function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')},function(){return new XMLHttpRequest()})||false;return this;},initialize:function(options){this.setTransport().setOptions(options);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers={};if(this.options.urlEncoded&&this.options.method=='post'){var encoding=(this.options.encoding)?'; charset='+this.options.encoding:'';this.setHeader('Content-type','application/x-www-form-urlencoded'+encoding);} if(this.options.initialize)this.options.initialize.call(this);},onStateChange:function(){if(this.transport.readyState!=4||!this.running)return;this.running=false;var status=0;try{status=this.transport.status;}catch(e){};if(this.options.isSuccess.call(this,status))this.onSuccess();else this.onFailure();this.transport.onreadystatechange=Class.empty;},isSuccess:function(status){return((status>=200)&&(status<300));},onSuccess:function(){this.response={'text':this.transport.responseText,'xml':this.transport.responseXML};this.fireEvent('onSuccess',[this.response.text,this.response.xml]);},onFailure:function(){this.fireEvent('onFailure',this.transport);},setHeader:function(name,value){this.headers[name]=value;return this;},send:function(url,data){if(this.options.autoCancel)this.cancel();else if(this.running)return this;this.running=true;if(data&&this.options.method=='get'){url=url+(url.contains('?')?'&':'?')+data;data=null;} this.transport.open(this.options.method.toUpperCase(),url,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);if((this.options.method=='post')&&this.transport.overrideMimeType) this.setHeader('Connection','close');_extend(this.headers,this.options.headers);for(var type in this.headers) try{this.transport.setRequestHeader(type,this.headers[type]);}catch(e){};this.fireEvent('onRequest');this.transport.send(data||null);return this;},cancel:function(){if(!this.running)return this;this.running=false;this.transport.abort();this.transport.onreadystatechange=Class.empty;this.setTransport();this.fireEvent('onCancel');return this;}});XHR.implement(new Events,new Options);var Ajax=XHR.extend({options:{data:null,update:null,onComplete:Class.empty,evalScripts:false,evalResponse:false},initialize:function(url,options){this.addEvent('onSuccess',this.onComplete);this.setOptions(options);this.options.data=this.options.data||this.options.postBody;if(!['post','get'].contains(this.options.method)){this._method='_method='+this.options.method;this.options.method='post';} this.parent();this.setHeader('X-Requested-With','XMLHttpRequest');this.setHeader('Accept','text/javascript, text/html, application/xml, text/xml, */*');this.url=url;},onComplete:function(){if(this.options.update)$(this.options.update).innerHTML=this.response.text;if(this.options.evalScripts||this.options.evalResponse)this.evalScripts();this.fireEvent('onComplete',[this.response.text,this.response.xml],20);},request:function(data){data=data||this.options.data;if(this._method)data=(data)?[this._method,data].join('&'):this._method;return this.send(this.url,data);},evalScripts:function(){try{var script,scripts;if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))scripts=this.response.text;else{scripts=[];var regexp=/]*>([\s\S]*?)<\/script>/gi;while((script=regexp.exec(this.response.text)))scripts.push(script[1]);scripts=scripts.join('\n');} if(scripts)(window.execScript)?window.execScript(scripts):window.setTimeout(scripts,0);}catch(e){}},getHeader:function(name){try{return this.transport.getResponseHeader(name);}catch(e){};return null;}});var Effect={};Effect.Base=new Class({options:{transitions:function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;},duration:1,fps:10,onStart:Class.empty,onUpdate:Class.empty,onEnd:Class.empty},initialize:function(options){this.setOptions(options);this.startOn=new Date().getTime();this.finishOn=this.startOn+(this.options.duration*1000);this.fireEvent('onStart');this.timer=this.loop.periodical(this.options.fps,this);},loop:function(){var timePos=new Date().getTime();if(timePos>=this.finishOn){this.fireEvent('onEnd');clearInterval(this.timer);return;} var pos=(timePos-this.startOn)/(this.finishOn-this.startOn);pos=this.options.transitions(pos);this.fireEvent('onUpdate',[pos]);}});Effect.Base.implement(new Events,new Options);function pageSize(){var d=document;return[(d.compatMode=='BackCompat'?d.body:d.documentElement).scrollWidth,d.documentElement.scrollHeight];} function setStyle(elm,property){var type=_type(property);if(type=='object'){for(var prop in property){elm.style[prop]=property[prop];}}} function imageLoad(src,callback){var img=new Image();img.onload=callback;img.src=src;return img;} var ShadowLayer=new Class({options:{element:'shadowWindow',parent:null},initialize:function(options){this.setOptions(options);this.element=$(this.options.element);this.status='idle';setStyle(this.element,{'visibility':'hidden'});with(this.element.style){if(typeof(filter)!='undefined'){filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=images/shadow.png,sizingMethod='scale')";}else{backgroundImage='url(images/shadow.png)';}}},pageShadow:function(flg){if($('PageShadowLayer')&&flg)setStyle($('PageShadowLayer'),{'display':'block'});else if(!$('PageShadowLayer')){var lay=document.createElement('DIV');var size=pageSize();with(lay){id='PageShadowLayer';style.position='absolute';style.zIndex=998;style.left='0px';style.top='0px';style.width=size[0]+'px';style.height=size[1]+'px';if(typeof(style.filter)!='undefined'){style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=images/shadow.png,sizingMethod='scale')";}else{style.backgroundImage='url(images/shadow.png)';}} if(browser.msie){var iframe=document.createElement('IFRAME');lay.appendChild(iframe);lay.className+='select-free';} document.body.appendChild(lay);} setStyle($('PageShadowLayer'),{'display':flg?'block':'none'});},getParentSize:function(){var parent=this.element.parent;if(!parent){do{parent=this.element.parentNode;if(parent.tagName=='DIV')break;}while(parent.tagName!='BODY');this.options.parent=parent;} return[parent.offsetWidth,parent.offsetHeight];},show:function(callback){if(this.status!='idle')return false;callback=callback||Class.empty;var h=this.getParentSize()[1];new Effect.Base({duration:1,onStart:(function(){if($('progress_status'))setStyle($('progress_status'),{'display':'block'});this.status='runnig';setStyle(this.element,{'visibility':'visible','height':'0px'});}).bind(this),onUpdate:(function(pos){setStyle(this.element,{'height':(pos*h)+'px'});}).bind(this),onEnd:(function(){this.status='idle';callback();}).bind(this)});},hide:function(){if(this.status!='idle')return false;var h=this.getParentSize()[1];new Effect.Base({duration:1,onStart:(function(){this.status='runnig';}).bind(this),onUpdate:(function(pos){setStyle(this.element,{'height':h-(pos*h)+'px'});}).bind(this),onEnd:(function(){this.status='idle';setStyle(this.element,{'visibility':'hidden'});if($('progress_status'))setStyle($('progress_status'),{'display':'none'});}).bind(this)});}});ShadowLayer.implement(new Options);var eWindow=new Class({options:{element:'WindowLayer',title:'windowTitle',body:'windowContent',close:'windowClose',imgpath:'templates/default/images/zwindow/'},initialize:function(options){this.setOptions(options);this.element=$(this.options.element);var self=this,close=$(this.options.close);Event.observe(this.options.close,'mouseover',(function(){this.src=self.options.imgpath+'close_over.gif';}).bind(close));Event.observe(this.options.close,'mouseout',(function(){this.src=self.options.imgpath+'close_normal.gif';}).bind(close));Event.observe(this.options.close,'mousedown',(function(){this.src=self.options.imgpath+'close_down.gif';}).bind(close));Event.observe(this.options.close,'click',this.hide.bindAsEventListener(this));setStyle($(this.options.close),{'cursor':'pointer'});},setSize:function(size){var size=pageSize();setStyle(this.element,{'width':size[0]+'px'});return this;},show:function(){this.setSize();setStyle(this.element,{'display':'block'});},hide:function(){this.setTitle('').setBody('');setStyle(this.element,{'display':'none'});if(Shadow)Shadow.pageShadow(false);this.fireEvent('onHide');},setTitle:function(text){$(this.options.title).innerHTML=text;return this;},setBody:function(text){$(this.options.body).innerHTML=text;return this;}});eWindow.implement(new Events,new Options);var imageChanger=new Class({options:{path:'',changeSpeed:2000,statusEl:null,statusStyle:'visibility'},initialize:function(el,images,options){this.setOptions(options);this.loaded=[];this.images=images.map(this._realpath.bind(this));this.element=$(el);Event.observe(this.element,'load',(function(e){this.change.delay(this.options.changeSpeed,this,[this.element.src]);}).bind(this));if(this.element.complete){this.change.delay(this.options.changeSpeed,this,[this.element.src]);}},change:function(url){if(!this.images.length)return;if(this.loaded[url]){this.replaceImage(url);}else{if(this.options.statusEl) $(this.options.statusEl).style[this.options.statusStyle]=this.options.statusStyle=='visibility'?'visible':'';var self=this;this._imageLoad(this.nextImage(url),function(){self.loaded.push(this.src);self.replaceImage(this.src);});}},replaceImage:function(url){this.element.src=url;if(this.options.statusEl) $(this.options.statusEl).style[this.options.statusStyle]=this.options.statusStyle=='visibility'?'hidden':'none';},nextImage:function(url){var pos=this.images.indexOf(url)+1;pos=pos';return div.childNodes[0].href;}});imageChanger.implement(new Events,new Options);function ajaxReq(url,options,callback,fx){var req=function(){try{if($(options.update).id=='main_area'){$('homePageLoadTitle').style.display='none';$('main_area').style.display='';}}catch(e){} options=options||{};options.evalScripts=true;if(options.update)initPage(options.update);var ajax=new Ajax(url,options);ajax.addEvent('onComplete',function(r){if(options.update&&($(options.update).id=='main_area'||$(options.update).id=='cpanel_body'))backUp();if(fx)Shadow.hide();(callback||Class.empty)(r);});ajax.addEvent('onFailure',function(r){if(fx)Shadow.hide();});ajax.request();} fx?Shadow.show(req):req();} function simpleLoad(element,zp,body,callback){ajaxReq('index.php?'+zp+'&t=a',{update:element,data:body,method:body?'post':'get'},callback);} function ajaxLoad(element,zp,callback){ajaxReq('index.php?'+zp+'&t=a',{update:element,method:'get'},callback,true);} function ajaxPost(element,zp,body,callback){ajaxReq('index.php?'+zp+'&t=a',{update:element,data:body,method:body?'post':'get'},callback,true);} function ajaxCall(zp,callback){ajaxReq('ajaxserver.php?'+zp,{method:'get'},function(responseText){try{eval(responseText);}catch(e){} if(typeof(data)!='undefined'&&data['status']==0) callback(data);else return false;},true);} function ajaxPostCall(zp,body,callback){ajaxReq('ajaxserver.php?'+zp,{data:body},function(responseText){try{eval(responseText);}catch(e){} if(typeof(data)!='undefined'&&data['status']==0) callback(data);else return false;},true);} function winAjaxLoad(title,zp,body,callback){if(!zWindow)return false;try{stopScroll=stopScroll||function(){};}catch(e){stopScroll=false;} if(stopScroll)stopScroll();zWindow.addEvent('onHide',initLinkDetails||function(){});ajaxPost(null,zp,body,function(r){if(Shadow)Shadow.pageShadow(true);zWindow.setTitle(title).setBody(r).show();backUp();});} function homepageLoad(title,zp){simpleLoad(null,zp,null,function(r){var Htitle=$('homePageLoadTitle');var Hcontent=$('homePageLoadContent');var Hwindow=$('homePageLoadWin');Htitle.innerHTML=title;Hcontent.innerHTML=r;$('main_area').style.display='none';Hwindow.style.display='';});} var customer_num=0;function scrollCustomer(pos){$('customers_box').scrollTop=$('customers_box').scrollTop+1;if(pos>$('customers_box').scrollTop)setTimeout('scrollCustomer('+pos+');',10);else setTimeout(nextCustomer,3000);} function nextCustomer(){customer_num++;if(customer_num==$('customers_table').rows.length){customer_num=1;$('customers_box').scrollTop=0;} scrollCustomer($('customers_table').rows[customer_num].offsetTop);} function initPage(element){if(!$(element)||$(element).id!='main_area')return;try{stopScroll=stopScroll||function(){};}catch(e){stopScroll=false;} if(stopScroll)stopScroll();if(!$('back_content')._cachePage){$('back_content')._cachePage=true;$('back_content').innerHTML=$('main_area').innerHTML;}} function back_page(){try{var back=$('back_content');initLinkDetails=initLinkDetails||function(){};}catch(e){initLinkDetails=false;} if(back&&back.childNodes.length){$('main_area').innerHTML=$('back_content').innerHTML;String($('main_area').innerHTML).evalScripts();if(initLinkDetails)initLinkDetails();$('back_content').innerHTML='';$('back_content')._cachePage=false;return;} goHome();} function getCountSubCategory(zp){if(!category||!category.length)return false;var query=[];category.each(function(i){query.push('group[]='+i);});simpleLoad(null,zp,query.join('&'),function(r){try{var res=eval(r);}catch(e){} if(!res)return;var i=0;var showT=setInterval(function(){if(i>=category.length+1){clearInterval(showT);showT=null;return;} try{var sms_count_span=$('count_sub_group_sms');}catch(e){} var inf=res[i].split('-');if(inf[0]=='s'){if(sms_count_span)sms_count_span.innerHTML='( '+inf[1]+' )';}else{$('count_sub_group_'+inf[0]).innerHTML='( '+inf[1]+' )';} i++;},100);});} function initNewsLink(){document.getElementsByClassName('newsLink').each(function(link){Event.observe(link,'click',function(e){Event.stop(e);var location=link.getAttribute('location');if(location.length>1)ajaxLoad('main_area',location);});});} function initAdsCommentLink(){document.getElementsByClassName('adsCommentLink').each(function(link){Event.observe(link,'click',function(e){Event.stop(e);var location=link.getAttribute('location');if(location.length>1)ajaxLoad('main_area',location);});});} function initLinkDetails(){document.getElementsByClassName('detailsLink').each(function(link){Event.observe(link,'click',function(e){Event.stop(e);var location=link.getAttribute('location');if(location.length>1)ajaxLoad('main_area',location,initLinkDetails);});});} function initPageLinks(){initLinkDetails();initNewsLink();initAdsCommentLink();} function addSMSCounter(textarea){if(typeof(textarea)=='string'){textarea=document.getElementById(textarea);} var counterDiv=document.createElement('div');counterDiv.innerHTML='تعداد کاراکتر باقیمانده : ';counterDiv.style.fontSize="11px";var counterSpan=document.createElement('span');counterSpan.innerHTML='160';counterDiv.appendChild(counterSpan);if(textarea.nextSibling){textarea.parentNode.insertBefore(counterDiv,textarea.nextSibling);}else textarea.parentNode.appendChild(counterDiv);textarea.onkeypress=function(event){event=event||window.event;return checkSMSLength(textarea,counterSpan,event);} textarea.onkeyup=function(event){event=event||window.event;checkSMSLength(textarea,counterSpan,event);} checkSMSLength(textarea,counterSpan);} function checkSMSLength(textarea,counterSpan,event){var key;if(event){if(window.event){key=event.keyCode;}else{key=event.charCode;}} var text=textarea.value;var maxlen=160;if(text.search(/[^\x00-\x7D]/)!=-1)maxlen=70;counterSpan.innerHTML=(maxlen-text.length);if(event){if(text.length>=maxlen&&event.keyCode!=8&&event.keyCode!=46&&event.keyCode!=37&&event.keyCode!=38&&event.keyCode!=39&&event.keyCode!=40) return false;else return true;}} function logout(zp){ajaxCall(zp,function(data){if(data['result']=='logged out'){goHome();}});} function goHome(){window.location='index.php';} var g_USER_AGENT=getAgent();function getAgent(){var userAgent=navigator.userAgent;var charIndex;var majorVersion;charIndex=userAgent.indexOf("MSIE");if(charIndex){majorVersion=userAgent.charAt(charIndex+4+1);if(majorVersion>4){return("IE5");}else if(majorVersion==4){return("IE4");}} charIndex=userAgent.indexOf("Mozilla");majorVersion=userAgent.charAt(charIndex+7+1);if(majorVersion>4){return("NN5");}else if(majorVersion==4){return("NN4");} return("Unknown");} function getWindowYOffset(){if(g_USER_AGENT=="IE5"||g_USER_AGENT=="IE4"){return document.body.scrollTop;}else if(g_USER_AGENT=="NN5"||g_USER_AGENT=="NN4"){return window.pageYOffset;}else{return 0;}} var waitTimer;function jumpTo(dstY,srcY,scrollRate,waitMillSec){if(waitTimer){clearTimeout(waitTimer);} if(!dstY||dstY<0){dstY=0;} if(!srcY){srcY=0+getWindowYOffset();} if(!scrollRate){scrollRate=6;} if(!waitMillSec){waitMillSec=20;} srcY+=(dstY-getWindowYOffset())/scrollRate;if(srcY<0){srcY=0;} posY=Math.floor(srcY);window.scrollTo(0,posY);if(posY!=dstY){waitTimer=setTimeout("jumpTo("+dstY+", "+srcY+", "+scrollRate+", "+waitMillSec+")",waitMillSec);}else if(posY==dstY){clearTimeout(waitTimer);}else if(posY<1){window.scroll(0,0);}} function backUp(){jumpTo(0,0,7,14);} var graphMaxWidth=130;var graphMinWidth=35;var pollScrollSpeed=5;var pollVotes;function getAjaxResult(radioName,but){if(!survey_result_path){alert('امکان شرکت در نظر سنجی وجود ندارد');return;} var options=document.getElementsByName(radioName),userOpinion=false;for(var i=0;i(.*?)<.*$","gi");var pollerError=xml.replace(reg,'$1');var reg=new RegExp("^.*?(.*?)<.*$","gi");var pollerTitle=xml.replace(reg,'$1');var resultDiv=document.getElementById('poller_results');var opinion_result_table=document.getElementById('opinion_result_table');if(pollerError.replace('^\s+$','').replace('\s+$','')!==''){var opinionError=opinion_result_table.insertRow(opinion_result_table.rows.length);var titleTd=opinionError.insertCell(opinionError.cells.length);with(titleTd){style.color='red';align='right';dir='rtl';colSpan=2;innerHTML=pollerError;}} var opinionTitle=opinion_result_table.insertRow(opinion_result_table.rows.length);var titleTd=opinionTitle.insertCell(opinionTitle.cells.length);with(titleTd){align='right';dir='rtl';colSpan=2;innerHTML=pollerTitle;} var options=xml.split(/