

/*
SimpleJS ver 0.1 beta
----------------------
SimpleJS is developed by Christophe "Dyo" Lefevre (http://bleebot.com/)
*/
function $(id){
return document.getElementById(id);
}
function STO(_24,_25){
return window.setTimeout(_24,_25);
}
function DecToHexa(_26){
var _27=parseInt(_26).toString(16);
if(_26<16){
_27="0"+_27;
}
return _27;
}
function addslashes(str){
str=str.replace(/\"/g,"\\\"");
str=str.replace(/\'/g,"\\'");
return str;
}
function $toggle(id){
if(act_height(id)==0){
$blinddown(id);
}else{
$blindup(id);
}
}
function act_height(id){
height=$(id).clientHeight;
if(height==0){
height=$(id).offsetHeight;
}
return height;
}
function act_width(id){
width=$(id).clientWidth;
if(width==0){
width=$(id).offsetWidth;
}
return width;
}
function max_height(id){
var ids=$(id).style;
ids.overflow="hidden";
if(act_height(id)!=0){
return act_height(id);
}else{
origdisp=ids.display;
origheight=ids.height;
origpos=ids.position;
origvis=ids.visibility;
ids.visibility="hidden";
ids.height="";
ids.display="block";
ids.position="absolute";
height=act_height(id);
ids.display=origdisp;
ids.height=origheight;
ids.position=origpos;
ids.visibility=origvis;
return height;
}
}
function $blindup(id,_2f){
if(!_2f){
_2f=200;
}
acth=act_height(id);
maxh=max_height(id);
if(acth==maxh){
$(id).style.display="block";
var _30;
_30=Math.ceil(_2f/acth);
for(i=0;i<=acth;i++){
newh=acth-i;
STO("$('"+id+"').style.height='"+newh+"px'",_30*i);
}
}
}
function $blinddown(id,_32){
if(!_32){
_32=200;
}
acth=act_height(id);
if(acth==0){
maxh=max_height(id);
$(id).style.display="block";
$(id).style.height="0px";
var _33;
_33=Math.ceil(_32/maxh);
for(i=1;i<=maxh;i++){
STO("$('"+id+"').style.height='"+i+"px'",_33*i);
}
}
}
function $opacity(id,_35,_36,_37){
if($(id).style.width==0){
$(id).style.width=act_width(id);
}
var _38=Math.round(_37/100);
var _39=0;
if(_35>_36){
for(i=_35;i>=_36;i--){
STO("changeOpac("+i+",'"+id+"')",(_39*_38));
_39++;
}
}else{
if(_35<_36){
for(i=_35;i<=_36;i++){
STO("changeOpac("+i+",'"+id+"')",(_39*_38));
_39++;
}
}
}
}
function $pulsate(id,num,speed){
if (!speed) speed = 300;
for(i = 1; i <= num; i++) {
numx=i*((speed*2)+100)-(speed*2);
STO("$opacity('"+id+"', 100, 0, "+speed+")",numx);
STO("$opacity('"+id+"', 0, 100, "+speed+")",numx+speed+100);
}
}
function changeOpac(_3a,id){
var ids=$(id).style;
ids.opacity=(_3a/100);
ids.MozOpacity=(_3a/100);
ids.KhtmlOpacity=(_3a/100);
ids.filter="alpha(opacity="+_3a+")";
}
function $shiftOpacity(id,_3e){
if($(id).style.opacity<0.5){
$opacity(id,0,100,_3e);
}else{
$opacity(id,100,0,_3e);
}
}
function currentOpac(id,_40,_41){
var _42=100;
if($(id).style.opacity<100){
_42=$(id).style.opacity*100;
}
$opacity(id,_42,_40,_41);
}
function $highlight(id,_44,_45,_46){
if(_44){
milli=_44;
}else{
milli=900;
}
if(_45){
endcol=_45;
}else{
endcol="#FFFFFF";
}
if(_46){
origcol=_46;
}else{
origcol="#FFFFA6";
}
$colorize(origcol,endcol,id,milli,"high");
}
function $textColor(id,_48,_49,_4a){
if(_4a){
milli=_4a;
}else{
milli=900;
}
$colorize(_48,_49,id,milli,"text");
}
function $morphColor(id,_4c,_4d,_4e,_4f,_50,_51,_52){
if(_52){
milli=_52;
}else{
milli=900;
}
$colorize(_4c,_4d,id,milli,"text");
$colorize(_4e,_4f,id,milli,"back");
if(_50!=false){
$colorize(_50,_51,id,milli,"border");
}
}
function $colorize(_53,end,id,_56,_57){
dr=parseInt(_53.substring(1,3),16);
dg=parseInt(_53.substring(3,5),16);
db=parseInt(_53.substring(5,7),16);
fr=parseInt(end.substring(1,3),16);
fg=parseInt(end.substring(3,5),16);
fb=parseInt(end.substring(5,7),16);
steps=_56/10;
cr=dr;
cg=dg;
cb=db;
sr=(fr-dr)/steps;
sg=(fg-dg)/steps;
sb=(fb-db)/steps;
var zzi=10;
for(var x=0;x<steps;x++){
color="#"+DecToHexa(cr)+DecToHexa(cg)+DecToHexa(cb);
if(x==(steps-1)){
if(_57=="high"){
color="";
}else{
color=end;
}
}
mytime=(x);
if(_57=="back"||_57=="high"){
newfonc="$(\""+id+"\").style.backgroundColor=\""+color+"\";";
}else{
if(_57=="text"){
newfonc="$(\""+id+"\").style.color=\""+color+"\";";
}else{
if(_57=="border"){
newfonc="$(\""+id+"\").style.borderColor=\""+color+"\";";
}
}
}
STO(newfonc,zzi);
cr+=sr;
cg+=sg;
cb+=sb;
zzi+=10;
}
}
function create_request_string(theForm){
var reqStr = "";
var theForm=$(theForm);
for(i=0; i < theForm.elements.length; i++){
isFormObject = false;
switch (theForm.elements[i].tagName){
case "INPUT":
switch (theForm.elements[i].type){
case "text":
case "password":
case "hidden":
reqStr += theForm.elements[i].name + "=" + (theForm.elements[i].value);
isFormObject = true;
break;
case "checkbox":
if (theForm.elements[i].checked){
reqStr += theForm.elements[i].name + "=" + theForm.elements[i].value;
}else{
reqStr += theForm.elements[i].name + "=";
}
isFormObject = true;
break;
case "radio":
if (theForm.elements[i].checked){
reqStr += theForm.elements[i].name + "=" + theForm.elements[i].value;
isFormObject = true;
}
}
break;
case "TEXTAREA":
reqStr += theForm.elements[i].name + "=" + (theForm.elements[i].value);
isFormObject = true;
break;
case "SELECT":
var sel = theForm.elements[i];
reqStr += sel.name + "=" + sel.options[sel.selectedIndex].value;
isFormObject = true;
break;
}
if ((isFormObject) && ((i+1)!= theForm.elements.length))
{
reqStr += "&";
}
}
return reqStr;
}
function serialize(form) {
  if (!form || !form.elements) return;

  var serial = [], i, j, first;
  var add = function (name, value) {
    serial.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));
  }

  var elems = form.elements;
  for (i = 0; i < elems.length; i += 1, first = false) {
    if (elems[i].name.length > 0) { /* don't include unnamed elements */
      switch (elems[i].type) {
        case 'select-one': first = true;
        case 'select-multiple':
          for (j = 0; j < elems[i].options.length; j += 1)
            if (elems[i].options[j].selected) {
              add(elems[i].name, elems[i].options[j].value);
              if (first) break; /* stop searching for select-one */
            }
          break;
        case 'checkbox':
        case 'radio': if (!elems[i].checked) break; /* else continue */
        default: add(elems[i].name, elems[i].value); break;
      }
    }
  }

  return serial.join('&');
}


/*
SimpleAjax for SimpleJS ver 0.1 beta
------------------------------------
SimpleJS is developed by Christophe "Dyo" Lefevre (http://bleebot.com/)
$ajax function is based on Simple AJAX Code-Kit (SACK)
Gregory Wild-Smith (http://www.twilightuniverse.com/)
*/
var enableCache=true;
var jsCache=new Array();
var DynObj=new Array();
function $ajax(_1){
this.xmlhttp=null;
//
this.setOptions=function(options){
    this.method = options.method.toLowerCase();
    //if(options.evalScripts)this.execute=true;
    if (typeof options.postBody == 'string')
      this.URLString += options.postBody;
  }
  //
this.resetData=function(){
this.method="POST";
this.queryStringSeparator="?";
this.argumentSeparator="&";
this.URLString="";
this.encodeURIString=false;
this.execute=false;
this.element=null;
this.elementObj=null;
this.requestFile=_1;
this.vars=new Object();
this.responseStatus=new Array(2);
};
this.resetFunctions=function(){
this.onLoading=function(){
};
this.onLoaded=function(){
};
this.onInteractive=function(){
};
this.onCompletion=function(){
};
this.onError=function(){
};
this.onFail=function(){
};
};
this.reset=function(){
this.resetFunctions();
this.resetData();
};
this.crAjx=function(){
try{
this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
try{
this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e2){
this.xmlhttp=null;
}
}
if(!this.xmlhttp){
if(typeof XMLHttpRequest!="undefined"){
this.xmlhttp=new XMLHttpRequest();
}else{
this.failed=true;
}
}
};
this.setVar=function(_2,_3){
this.vars[_2]=Array(_3,false);
};
this.encVar=function(_4,_5,_6){
if(true==_6){
return Array(encodeURIComponent(_4),encodeURIComponent(_5));
}else{
this.vars[encodeURIComponent(_4)]=Array(encodeURIComponent(_5),true);
}
};
this.processURLString=function(_7,_8){
encoded=encodeURIComponent(this.argumentSeparator);
regexp=new RegExp(this.argumentSeparator+"|"+encoded);
varArray=_7.split(regexp);
for(i=0;i<varArray.length;i++){
urlVars=varArray[i].split("=");
if(true==_8){
this.encVar(urlVars[0],urlVars[1]);
}else{
this.setVar(urlVars[0],urlVars[1]);
}
}
};
this.createURLString=function(_9){
if(this.encodeURIString&&this.URLString.length){
this.processURLString(this.URLString,true);
}
if(_9){
if(this.URLString.length){
this.URLString+=this.argumentSeparator+_9;
}else{
this.URLString=_9;
}
}
this.setVar("rndval",new Date().getTime());
urlstringtemp=new Array();
for(key in this.vars){
if(false==this.vars[key][1]&&true==this.encodeURIString){
encoded=this.encVar(key,this.vars[key][0],true);
delete this.vars[key];
this.vars[encoded[0]]=Array(encoded[1],true);
key=encoded[0];
}
urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0];
}
if(_9){
this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator);
}else{
this.URLString+=urlstringtemp.join(this.argumentSeparator);
}
};
this.runResponse=function(){
eval(this.response);
};
this.runAJAX=function(_a){
if(this.failed){
this.onFail();
}else{
this.createURLString(_a);
if(this.element){
this.elementObj=$(this.element);
}
if(this.xmlhttp){
var _b=this;
if(this.method=="GET"){
totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;
this.xmlhttp.open(this.method,totalurlstring,true);
}else{
this.xmlhttp.open(this.method,this.requestFile,true);
try{
this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
catch(e){
}
}
this.xmlhttp.onreadystatechange=function(){
switch(_b.xmlhttp.readyState){
case 1:
_b.onLoading();
break;
case 2:
_b.onLoaded();
break;
case 3:
_b.onInteractive();
break;
case 4:
_b.response=_b.xmlhttp.responseText;
_b.responseXML=_b.xmlhttp.responseXML;
_b.responseStatus[0]=_b.xmlhttp.status;
_b.responseStatus[1]=_b.xmlhttp.statusText;
if(_b.execute){
_b.runResponse();
}
if(_b.elementObj){
elemNodeName=_b.elementObj.nodeName;
elemNodeName.toLowerCase();
if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){
_b.elementObj.value=_b.response;
}else{
_b.elementObj.innerHTML=_b.response;
}
}
if(_b.responseStatus[0]=="200"){
_b.onCompletion();
}else{
_b.onError();
}
_b.URLString="";
break;
}
};
this.xmlhttp.send(this.URLString);
}
}
};
this.reset();
this.crAjx();
}
function ajax_installScript(_c){
if(!_c){
return;
}
if(window.execScript){
window.execScript(_c);
}else{
if(window.jQuery&&jQuery.browser.safari){
STO(_c,0);
}else{
STO(_c,0);
}
}
}
function $ajax_show(_d,_e,_f,_10,_11){
if(_11=="appear"){
$opacity(_d,0,101,600);
}
if(_11=="highlight"){
$highlight(_d);
}
var _12=$(_d);
_12.innerHTML=DynObj[_e].response;
if(_11=="blind"){
$(_d).style.position="";
$blinddown(_d);
}
if(enableCache){
jsCache[_f]=DynObj[_e].response;
}
DynObj[_e]=false;
ajax_parseJs(_12);
}
function $ajaxreplace(_13,url){
$opacity(_13,100,0,400);
$(_13).style.height="";
scr="$ajaxload('"+_13+"','"+url+"',false,'appear',false)";
STO(scr,400);
}
function $ajaxload(_15,url,options,_17,_18,_19){
if(_18=="appear"){
changeOpac(0,_15);
}
if(_18=="blind"){
var ids=$(_15).style;
ids.overflow="hidden";
ids.display="block";
ids.height="0px";
}
if(_19){
if(enableCache&&jsCache[url]){
if(_18=="appear"){
$opacity(_15,0,101,600);
}
if(_18=="highlight"){
$highlight(_15);
}
$(_15).innerHTML=jsCache[url];
if(_18=="blind"){
$(_15).style.position="";
$blinddown(_15);
}
return;
}
}
var _1b=DynObj.length;
if(_17!=false){
$(_15).innerHTML=_17;
}
DynObj[_1b]=new $ajax();
DynObj[_1b].requestFile=url;
DynObj[_1b].setOptions(options);
DynObj[_1b].onCompletion=function(){
$ajax_show(_15,_1b,url,_17,_18);
if(document.getElementById('navig') && document.getElementById('navig').innerHTML.length>0){$('nav-title').innerHTML=$('navig').innerHTML;$('navig').innerHTML='';}
over();
};
DynObj[_1b].runAJAX();
}
function ajax_parseJs(obj){
var _1d=obj.getElementsByTagName("SCRIPT");
var _1e="";
var _1f="";
for(var no=0;no<_1d.length;no++){
if(_1d[no].src){
var _21=document.getElementsByTagName("head")[0];
var _22=document.createElement("script");
_22.setAttribute("type","text/javascript");
_22.setAttribute("src",_1d[no].src);
}else{
//if(DHTMLSuite.clientInfoObj.isOpera){
//_1f=_1f+_1d[no].text+"\n";
//}else{
_1f=_1f+_1d[no].innerHTML;
//}
}
}
if(_1f){
ajax_installScript(_1f);
}
}

//Copyright "Ali Karimabadi" Email: Akarimabadi@gmail.com
GetLoading=function (){
	return '<div align="center" dir="ltr"><b>در حال انجام درخواست شما لطفا صبر نمائید</b><br><img src="./images/progress.gif" border="0"></div>';
}
includebyfile=function(file) {
	   if (document.createElement && document.getElementsByTagName) {
	     var head = document.getElementsByTagName('head')[0];
	     var script = document.createElement('script');
	     script.setAttribute('type', 'text/javascript');
	     script.setAttribute('src', file);
	     head.appendChild(script);
	   } else {
	     //alert('Your browser can\'t deal with the DOM standard. That means it\'s old. Go fix it!');
	   }
}
LoadPage=function(url,idl){
	if(idl=='center'){
		window.scroll(0,120);
		if(typeof(pageTracker)!='undefined')
		pageTracker._trackPageview(url.replace('AJAXED=1','ajax=1'));
	}
	var pars = '';
	$(idl).innerHTML='<div align="center" dir="rtl" style="font-size:11px">درحال بارگذاري اطلاعات لطفا صبر کنيد...<br><img src="./images/progress.gif" border="0"></div>';
	$ajaxload(idl, url, {method: 'get', parameters: pars,evalScripts:true},false, false, false,false);
}
//Frame Print by: Ali Karimabadi
framePrint=function framePrint(whichFrame,id){
	parent[whichFrame].designMode='on';
	parent[whichFrame].document.body.style.direction='rtl';
	parent[whichFrame].document.body.style.fontSize='11px';
	parent[whichFrame].document.body.style.fontFamily='tahoma';
	parent[whichFrame].document.body.innerHTML=document.getElementById(id).innerHTML;
	parent[whichFrame].focus();
	parent[whichFrame].print();
}
//add to fav
AddToFav=function(url,title){
	if ((navigator.appVersion.indexOf("MSIE") > 0)  && (parseInt(navigator.appVersion) >= 4)) {window.external.AddFavorite(url,title);}
}
a=0;
msg1='امکان استفاده از دکمه سمت راست موقتا غير فعال مي باشد\nبراي بازکردن لينک ها در صفحه جديد \nSHIFT\nرا نگهداريد و روي لينک کليک کنيد\nبراي کپي از کليدهاي \nCtrl+c\nاستفاده نمائيد';
msg2='امکان استفاده از دکمه سمت راست موقتا غير فعال مي باشد';
msg=msg1;
function right(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
		if(msg==msg1){msg=msg2;}else{msg=msg1;}
		if(a==1){}else{
			alert(msg);
			return false;
		}
	}
	return true;
}
disableSelection=function(targetID){
	target=document.getElementById(targetID);
	if (typeof target.onselectstart!="undefined") //IE route
		target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
		target.style.MozUserSelect="none"
	else //All other route (ie: Opera)
		target.onmousedown=function(){return false}
		target.style.cursor = "default"
}
//wrtie smiles code to comment
writeImgTag=function(code,id){
	var cache = $(id).note.value;
	this.code = code;
	$(id).note.value = cache + code;
	$(id).note.focus();
}

//Change font size
//copyright --- http://www.white-hat-web-design.co.uk/articles/js-fontsize.php
//enhanced by "ali karimabadi"
var min=1.0;
var max=2.2;
increaseFontSize=function(id) {
	var p = document.getElementById(id);
	if(p.style.fontSize) {
		var s = parseFloat(p.style.fontSize.replace("em",""));
	} else {
		var s = 1.6;
	}
	if(s<=max) {
		s += 0.2;
	}
	p.style.fontSize = s+"em"
}
decreaseFontSize=function(id) {
	var p = document.getElementById(id);
	if(p.style.fontSize) {
		var s = parseFloat(p.style.fontSize.replace("em",""));
	} else {
		var s = 1.6;
	}
	if(s>=min) {
		s -= 0.2;
	}
	p.style.fontSize = s+"em"
}
str_rep=function(n) {
   var s = "", t = this.toString();
   while (--n >= 0) s += t;
   return s;
} 
String.prototype.rep = str_rep;

/*Ali karimabadi*/
re_arreng=function(model){
	if(typeof(str)=='undefined'){
		str=$('areap').innerHTML;
		str=str.replace(/\r/g,"").replace(/\n\n/g,"\n").replace(/\\t/g,"").replace(/<BR> <BR> <BR> /ig,"<BR>").replace(/&nbsp;/g,"").replace(/<br \/> <br \/>|<br> <br> /ig,"<L>").replace(/\n/g,"<L>").replace(/<BR>+?/ig,"<L>");
	}
	var mySplitResult = str.split("<L>");
	var strR='';
	var tabs="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	var line=0;
	if(model == 0){
		for(i = 0; i < mySplitResult.length; i++){
			if(mySplitResult[i].length>=2)
			strR+=(mySplitResult[i]+"<span style=\"font-size:11px;color:#999999\">"+(++line)+"</span>"+"<br />"); 
		}
	}else if(model==1){
		for(i = 0; i < mySplitResult.length; i++){
			if(mySplitResult[i].length>=2)
			strR+=(tabs.rep(i%3)+' '+ mySplitResult[i]+"<span style=\"font-size:11px;color:#999999\">"+(++line)+"</span>"+"<br />"); 
			if((i+1)%3==0){strR+=('<br>'.rep(1));}
		}
	}else if(model==2){
		for(i = 0; i < mySplitResult.length; i++){
			if(mySplitResult[i].length>=2)
			strR+=(mySplitResult[i]+"<span style=\"font-size:11px;color:#999999\">"+(++line)+"</span>"+"<br />"); 
			if((i+1)%2==0){strR+=('<br>'.rep(1));}
		}	
	}else if(model==3){
		for(i = 0; i < mySplitResult.length; i++){
			if(i%2==0){
				if(mySplitResult[i].length>=2)
				strR+=(mySplitResult[i]+"<span style=\"font-size:11px;color:#999999\">"+(++line)+"</span>"+"<br />"); 
			}else{
				if(mySplitResult[i].length>=2)			
				strR+=(tabs.rep(3)+mySplitResult[i]+"<span style=\"font-size:11px;color:#999999\">"+(++line)+"</span>"+"<br />");
			}
			if((i+1)%2==0){strR+=('<br>'.rep(1));}
		}	
	}else if(model==4){
		for(i = 0; i < mySplitResult.length; i++){
			if(mySplitResult[i].length>=2)		
			strR+=(tabs.rep(i%4)+' '+ mySplitResult[i]+"<span style=\"font-size:11px;color:#999999\">"+(++line)+"</span>"+"<br />");
			if((i+1)%4==0){strR+=('<br>'.rep(1));}
		}
	}
	$('areap').innerHTML=strR;
}
//Change font face
ChangeFontFace=function(id) {
	var myArray = new Array();
	myArray[0] = "arial";
	myArray[1] = "tahoma";
	myArray[2] = "andalus";
	myArray[3] = "IranNastaliq";	
	var j=0;
	var p = document.getElementById(id);
	if(!p.style.fontFamily) {
		p.style.fontFamily="arial";
	}
	for(i=0;i<4;i++){
		if(p.style.fontFamily==myArray[i]){
			if(i<3){j=(i+1);}else{j=0;}
			p.style.fontFamily=myArray[j];
			break;
		}
	}
}
//Change font face
ChangeFontColor=function(id,color) {
	var p = document.getElementById(id);
	p.style.color="#"+color;
	setCookie('Poem_color',color,30,'/','shereno.com',0);
}
//Change font face
ChangeFontBGColor=function(id,color) {
	var p = document.getElementById(id);
	p.style.backgroundColor="#"+color;
	setCookie('Poem_bgcolor',color,30,'/','shereno.com',0);
}
//reply comment
reply_to=function(f,id,n){
	document.getElementById(f).reply.value=id;
	document.getElementById(f).note.value='';
	document.getElementById('post_comment_title').innerHTML='ارسال جواب به  '+n;
	document.getElementById(f).note.focus();	
	//return false;
}
setCookie=function(name, value, expires, path, domain, secure){
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ){expires = expires * 1000 * 60 * 60 * 24;}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +( ( path ) ? ";path=" + path : "" ) +( ( domain ) ? ";domain=" + domain : "" ) +( ( secure ) ? ";secure" : "" );
}
getCookie=function(c_name){
	if (document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}

var langFarsi = true;
var farsikey = [
	0x0020, 0x0021, 0x061B, 0x066B, 0x00A4, 0x066A, 0x060C, 0x06AF,      
	0x0029, 0x0028, 0x002A, 0x002B, 0x0648, 0x002D, 0x002E, 0x002F,      
	0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7,      
	0x06F8, 0x06F9, 0x003A, 0x06A9, 0x003E, 0x003D, 0x003C, 0x061F,      
	0x066C, 0x0624, 0x200C, 0x0698, 0x064A, 0x064D, 0x0625, 0x0623,      
	0x0622, 0x0651, 0x0629, 0x00BB, 0x00AB, 0x0621, 0x004E, 0x005D,      
	0x005B, 0x0652, 0x064B, 0x0626, 0x064F, 0x064E, 0x0056, 0x064C,            
	0x0058, 0x0650, 0x0643, 0x062C, 0x0698, 0x0686, 0x00D7, 0x0640,            
	0x067E, 0x0634, 0x0630, 0x0632, 0x0649, 0x062B, 0x0628, 0x0644,            
	0x0627, 0x0647, 0x062A, 0x0646, 0x0645, 0x0626, 0x062F, 0x062E,            
	0x062D, 0x0636, 0x0642, 0x0633, 0x0641, 0x0639, 0x0631, 0x0635,            
	0x0637, 0x063A, 0x0638, 0x007D, 0x007C, 0x007B, 0x007E            
];            
            
function FKeyDown() {
	if (window.event.shiftKey && window.event.altKey) {
		langFarsi=!langFarsi;
		return false;
	}
	return true;
}

function FKeyPress(e) {
	var event=(e)?e:(window.event)?window.event:null; 
	if(event){ var key=(event.charCode)?event.charCode: ((event.keyCode)?event.keyCode:((event.which)?event.which:0)); 
	   if (key < 0x0020 || key >= 0x00FF)
	      return;
	   if (langFarsi) {
	      var el = event.srcElement;
	      var objRegExp = new RegExp("[A-Za-z\x27\x2C\x3B\x5B\x5C\x5D\x7C]");
	      var validate_key = objRegExp.test(String.fromCharCode(key));
	      if ((validate_key || (key==92)) && (key != 0x200C) && (el.value.lastIndexOf(String.fromCharCode(1609)) == el.value.length - 1) && el.value.length > 0) {
	         el.value = el.value.slice(0, -1);
	         el.value += String.fromCharCode(1610);
	      }
	      if (key == 0x0020 && event.shiftKey)
	         window.event.keyCode = 0x200C;
	      else
	         window.event.keyCode = farsikey[key - 0x0020];
	   }
	}
   return true;
}
