﻿/////////
////javascript:ajax_net( 'post', 'center_Includesfile.asp' , 'setpage=help'  ,'respage' , 'respage' , 'pic' , '/images/load.gif' ,'');		 
function ajax_net( met, url , post  ,idshow , idwait , state_mode , wait_pic ,java_function ){
 var xmlhttp=false;
 var my_respons='';
 var my_new_fun='';
 //this is note for change in states
 var note_1='&#1583;&#1585; &#1581;&#1575;&#1604; &#1575;&#1585;&#1587;&#1575;&#1604;...'
 var note_2='&#1583;&#1585; &#1581;&#1575;&#1604; &#1576;&#1585;&#1585;&#1587;&#1740; &#1588;&#1583;&#1606;...'
 var note_3='&#1583;&#1585; &#1581;&#1575;&#1604; &#1583;&#1585;&#1740;&#1575;&#1601;&#1578; &#1575;&#1591;&#1604;&#1575;&#1593;&#1575;&#1578;...'
 var note_4=''
 var note_5='&#1594;&#1740;&#1585; &#1602;&#1575;&#1576;&#1604; &#1583;&#1587;&#1578;&#1585;&#1587;&#1740; ...'
 my_wait='<table border="0" width="100%" height="80%"><tr><td align="center" ><img src="'+wait_pic+'" border="0"></td></tr></table>';

 //END
     if (window.navigator.onLine==false){
	 alert('اشکالی در برقراری ارتباط با سایت وجود دارد');
	 return false;
	 }
	 ///////////
	 if(typeof(XMLHttpRequest)!=undefined)
	        {
                xmlhttp = new XMLHttpRequest();
            }
            else
            {
                try{
                    xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");                    
                   }catch(e)
                   {
                    try{
                       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                       }catch(e)
                       {
                       xmlhttp=false;
                       alert("Your Browser Does not Support Ajax");
                       }
                   }
            }
       ///////////     
  if (!xmlhttp){
  alert("CONNECT FAILURE");
  return false;
  }
		if( met =='post' ){
		    xmlhttp.open('POST', url, true);
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		    post=post+'&MY_AJAX_TIME_SEND='+escape(new Date().getTime());
		    xmlhttp.send(post);
		}else
		if( met == 'get' ){
		    url=url+'&MY_AJAX_TIME_SEND='+escape(new Date().getTime());
	        xmlhttp.open('GET',url, true);
		    xmlhttp.send(null);
		}
		if ( state_mode == 'text' ){
		    write_in_id(idwait,note_1);
		}else if ( state_mode == 'pic' ){
		    write_in_id(idwait,my_wait);
		}
   xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4  && xmlhttp.status == 200 ) {
		my_respons=xmlhttp.responseText;
	    my_respons = my_respons.replace('\n', '');
	    my_respons = my_respons.replace('\r', '');
	    my_respons = getscript(my_respons);
		}
	 if ( state_mode == 'return' && xmlhttp.readyState == 4  && xmlhttp.status == 200 ) {
	 
	 doeval(java_function+"'"+my_respons+"')");
	 }else if ( state_mode == 'newreturn'  && xmlhttp.readyState == 4  && xmlhttp.status == 200 ) {
	  my_new_fun = java_function.replace('#codehayeman#', my_respons);
	  doeval(my_new_fun);
	 }else if ( state_mode == 'js'  && xmlhttp.readyState == 4  && xmlhttp.status == 200 ) {
	 doeval(my_respons)
	 }else if ( state_mode == 'input'   && xmlhttp.readyState == 4  && xmlhttp.status == 200  ) {
	 document.getElementById(idshow).value=my_respons;
	 }else	if ( state_mode == 'text' ){
	   if(xmlhttp.readyState==1){
	   write_in_id(idwait,note_1);
	   }
	   if(xmlhttp.readyState==2){
	   write_in_id(idwait,note_2);
	   }
	   if(xmlhttp.readyState==3){
	   write_in_id(idwait,note_3);
	   }
       if (xmlhttp.readyState == 4  && xmlhttp.status == 200 ) {
	   write_in_id(idwait,note_4);
	   write_in_id(idshow,my_respons);
	   
	   }
	 }else if ( state_mode == 'pic' &&  xmlhttp.readyState == 4  && xmlhttp.status == 200 ) {
     write_in_id(idwait,'');
	 write_in_id(idshow,my_respons);
	 
	 }else if ( state_mode == 'no'   &&  xmlhttp.readyState == 4  && xmlhttp.status == 200 ) {
	 write_in_id(idshow,my_respons);
	 }else if ( xmlhttp.readyState == 4  &&  xmlhttp.status != 200 ) {
		 alert( 'با عرض پوزش \n در خواست شما به صورت كامل انجام نشد \لطفا اتصال خود را به شبكه اينترنت چك كنيد\nدرست رسي به اين آدرس مقدور نمي باشد \n '+url );
	 }
	 if ( xmlhttp.readyState == 4  &&  xmlhttp.status == 200 ){
        if(java_function !=='no' && java_function !=='' &&  state_mode != 'js' && state_mode != 'return'  && state_mode != 'newreturn'  ){
	    setTimeout("eval("+java_function+")",100)
		}
	 }
     }
}
///////
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 show_id(id){
    if( document.getElementById(id) ){
    document.getElementById(id).style.display ='';
	}
}
//////////
function getscript(str){
let_out=str;
str=str.split('#endofmyscript');
if( str[1] !=null){
doeval(str[0]);
let_out =let_out.replace(str[0]+'#endofmyscript', '');
}

return let_out;
}
//////////
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 = "\/\/ :-)";
	}
}
////
////END AJAX




/////////uploadajax
AIM = {

	frame : function(c) {

		var n = 'f' + Math.floor(Math.random() * 99999);
		var d = document.createElement('DIV');
		d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>';
		document.body.appendChild(d);

		var i = document.getElementById(n);
		if (c && typeof(c.onComplete) == 'function') {
			i.onComplete = c.onComplete;
		}

		return n;
	},

	form : function(f, name) {
		f.setAttribute('target', name);
	},

	submit : function(f, c) {
		AIM.form(f, AIM.frame(c));
		if (c && typeof(c.onStart) == 'function') {
			return c.onStart();
		} else {
			return true;
		}
	},

	loaded : function(id) {
		var i = document.getElementById(id);
		if (i.contentDocument) {
			var d = i.contentDocument;
		} else if (i.contentWindow) {
			var d = i.contentWindow.document;
		} else {
			var d = window.frames[id].document;
		}
		if (d.location.href == "about:blank") {
			return;
		}

		if (typeof(i.onComplete) == 'function') {
			i.onComplete(d.body.innerHTML);
		}
	}

}
		function startCallback() {
			// make something useful before submit (onStart)
			return true;
		}

		function completeCallback(response) {
			// make something useful after (onComplete)
			document.getElementById('upload_n').innerHTML = parseInt(document.getElementById('upload_n').innerHTML) + 1;
			document.getElementById('upload_d').innerHTML = response;
		}
		function completeCallback2(response) {
			// make something useful after (onComplete)
			document.getElementById('upload_n2').innerHTML = parseInt(document.getElementById('upload_n').innerHTML) + 1;
			document.getElementById('upload_d2').innerHTML = response;
		}

/////////uploadajax
function collex(id) {

		document.getElementById(id).style.display = "Block";
}



function copytoclipboard(elemnt) {
        document.getElementById(elemnt).select();
        document.getElementById(elemnt).focus();
        if (document.all) {
            textRange = document.getElementById(elemnt).createTextRange();
            textRange.execCommand("RemoveFormat");
            textRange.execCommand("Copy");
            alert("كد مورد نظر شما در حافظ موقت سيستم شما ذخيره شد.");
        }
    }

function count_text(message_Field,count_Field,english,farsi) {
 //alert(message_Field.value.length);
 var maxChr = (english); // For ASCII Messages
 for(i=0; i<message_Field.value.length; i++){
 if (message_Field.value.charCodeAt(i) > 256){
 maxChr = (farsi) ; // Message contains Unicode chars
 break;
 }
 }
 // Calculate message length
 count_Field.value = maxChr - message_Field.value.length;
 if(maxChr > 80){ // In ASCII messages \n is 2 characters
 lines = message_Field.value.split("\n")
 lineNumber = lines.length;
 count_Field.value = count_Field.value - lineNumber;
 }
 if (count_Field.value<=0) {
 message_Field.value = message_Field.value.substring(0,maxChr);
 count_Field.value=0;
 alert("كاربر گرامي تعداد كاراكتر مجاز شما به پايان رسيد");
 }
 //count_Field.value = message_Field.value.charCodeAt(0);
}
/////////عدد وارد شود
 var searchForNumbers2 = /^(d{1})?(\d{1})?(\d{2})?(\d{3})?(\d{4})?(\d{5})?(\d{6})?(\d{7})?(\d{8})?$/
function check_number(name) {

 if(!searchForNumbers2.test(name.value)){
 name.value = 0
 alert("كاربر گرامي در اين كادر عدد صحيح وارد كنيد");
 return false;
 }
 if(name.value == ''){
 name.value = 0
 alert("كاربر گرامي در اين كادر عدد صحيح وارد كنيد ");
 return false;
 }

}


/////////////////////////////////
function farsienter(myfield,e)
{
var key;
if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
if (key>31)
if (key<128)
{
if (window.event)
window.event.keyCode=' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُىلآ÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزيثبلاهتنمئدخحضقسفعرصطغظ<|>ّ'.charCodeAt(key-32);
else if (e)
e.which=' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُىلآ÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزيثبلاهتنمئدخحضقسفعرصطغظ<|>ّ'.charCodeAt(key-32);
}
return true;
}

/******************On Right Menu ***************/
var menu; 
function showMenu (evt) { 
  if (document.all) { 
    menx=document.body.scrollLeft + event.clientX;
    meny=document.body.scrollTop + event.clientY;
    //alert(window.document);
    document.all.contextMenu.style.pixelLeft = menx - document.all.contextMenu.offsetWidth; 
    document.all.contextMenu.style.pixelTop =   meny; 
    document.all.contextMenu.style.visibility = 'visible'; 
    return false; 
  } 
  else if (document.layers) { 
    if (evt.which == 3) { 
      document.contextMenu.left = evt.x; 
      document.contextMenu.top = evt.y; 
      document.contextMenu.onmouseout = 
        function (evt) { this.visibility = 'hide'; }; 
      document.contextMenu.visibility = 'show'; 
      return false; 
    } 
  } 
  return true; 
} 
if (document.all) 
  document.oncontextmenu =showMenu; 
if (document.layers) { 
  document.captureEvents(Event.MOUSEDOWN); 
  document.onmousedown = showMenu; 
  
}
function SavePage(){
	if (document.execCommand){
		document.execCommand("SaveAs")
	}
	else {
		alert("برای ذخیره صفحه به اینترنت اکسپلور نسخه 5 به بالا نیاز دارید")
	}

}
function showStatus(sMsg) {
    window.status = sMsg ;
    return true ;
}
/***********************************************/
///////////menu_up
function menu_rot()
{
eye={
p:0,x:0,y:0,w:0,h:0,r:0,v:0,s:0,isVertical:0,a1:0,a2:0,a3:0,color:'#ffffff',colorover:'#ffffff',backgroundcolor:'#0099ff',backgroundcolorover:'#000000',bordercolor:'#000000',fontsize:12,fontfamily:'Arial',pas:0,spinmenu:function(){this.p=this.r/this.s;

this.a1=this.a2=this.isVertical?0:Math.PI/2},spinmenuitem:function(a7,a6,a5){a4=" onclick='window.open(\""+a6+"\""+(a5?(",\""+a5+"\""):",\"_self\"")+")'";

document.write("<div id='spinmenu"+this.a3+"' style='cursor:pointer;cursor:expression(\"hand\");position:absolute;width:"+this.w+"px;left:"+this.h+"px;"+"background-color:"+this.backgroundcolor+";color:"+this.color+";border:1px solid "+this.bordercolor+";font:normal "+this.fontsize+"px "+this.fontfamily+";text-align:center;cursor:default;z-Index:1000;' onmouseover='this.style.color=\""+this.colorover+"\";this.style.backgroundColor=\""+this.backgroundcolorover+"\"'"+	"onmouseout='this.style.color=\""+this.color+"\";this.style.backgroundColor=\""+this.backgroundcolor+"\"'"+a4+">"+a7+"</div>");

this.a3++},muta:function(){a8=document.getElementById("controale");

for(i=0;

i<this.a3;

i++){a9=document.getElementById("spinmenu"+i+"");

a9s=a9.style;

if(this.isVertical){xi=parseInt(this.r*Math.cos(this.a1+i*this.pas))/this.s;

yi=parseInt(this.r*Math.sin(this.a1+i*this.pas));

a10=(this.p+xi)/(2*this.p);

a11=this.fontsize*(this.p+xi)/(2*this.p)+2;

a12=parseInt(100*(this.p+xi)/(2*this.p))}else{xi=parseInt(this.r*Math.cos(this.a1+i*this.pas));

yi=parseInt(this.r*Math.sin(this.a1+i*this.pas))/this.s;

a10=(this.p+yi)/(2*this.p);

a11=this.fontsize*(this.p+yi)/(2*this.p)+2;

a12=parseInt(100*(this.p+yi)/(2*this.p))};

a13=(this.w-20)*a10+20;

a14=(this.h-20)*a10+10;

a9s.top=(yi+this.y-a14/2)+"px";

a9s.left=(xi+this.x-a13/2)+"px";

a9s.width=a13+"px";

a9s.fontSize=a11+"px";

a9s.zIndex=a12};

a8.style.top=this.y+(this.isVertical?this.r:this.p)+this.h/2+6;

a8.style.left=this.x-a8.offsetWidth/2;

if(this.a1!=this.a2){this.a1=(this.a1>this.a2)?(this.a1-this.pas/this.v):(this.a1+this.pas/this.v);

if(Math.abs(this.a1-this.a2)<this.pas/this.v)
this.a1=this.a2;

setTimeout("eye.muta()",10)}},spinmenuclose:function(){this.pas=2*Math.PI/this.a3;

document.write('<div id="controale" style="position:absolute"><button type="" onclick="eye.a2+=eye.pas;eye.muta()" onfocus="this.blur()"><<</button> <button type="" onclick="eye.a2-=eye.pas;eye.muta()" onfocus="this.blur()">>></button></div>');

eye.muta()}};
}
function getposOffset(what, offsettype)
{
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null)
{
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft :totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
///////////menu_up