﻿function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function keypress__(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;
}

function keypr_ess(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;
}


function keypress(myfield,e)
{
var key;
var ss;

ss=
' '+
'-'+
'-'+
'-'+
'-'+
'-'+
String.fromCharCode(1548)+
String.fromCharCode(1711)+
String.fromCharCode(41)+
String.fromCharCode(40)+
'-'+
'-'+
String.fromCharCode(1608)+
'-'+
'-'+
String.fromCharCode(8260)+
String.fromCharCode(1776)+
String.fromCharCode(1777)+
String.fromCharCode(1778)+
String.fromCharCode(1779)+
String.fromCharCode(1780)+
String.fromCharCode(1781)+
String.fromCharCode(1782)+
String.fromCharCode(1783)+
String.fromCharCode(1784)+
String.fromCharCode(1785)+
'-'+
String.fromCharCode(1705)+
'-'+
'-'+
'-'+
String.fromCharCode(1567)+
'-'+
String.fromCharCode(1616)+
String.fromCharCode(1584)+
'-'+
String.fromCharCode(1609)+
String.fromCharCode(1615)+
String.fromCharCode(1609)+
String.fromCharCode(1604)+
String.fromCharCode(1570)+
'-'+
String.fromCharCode(1600)+
String.fromCharCode(1548)+
'-'+
'-'+
String.fromCharCode(1583)+
'-'+
String.fromCharCode(1563)+
String.fromCharCode(1614)+
String.fromCharCode(1569)+
String.fromCharCode(1613)+
String.fromCharCode(1601)+
'-'+
'-'+
String.fromCharCode(1611)+
String.fromCharCode(1618)+
String.fromCharCode(1573)+
'-'+
String.fromCharCode(1580)+
String.fromCharCode(1688)+
String.fromCharCode(1670)+
'-'+
'-'+
String.fromCharCode(1662)+
String.fromCharCode(1588)+
String.fromCharCode(1584)+
String.fromCharCode(1586)+
String.fromCharCode(1610)+
String.fromCharCode(1579)+
String.fromCharCode(1576)+
String.fromCharCode(1604)+
String.fromCharCode(1575)+
String.fromCharCode(1607)+
String.fromCharCode(1578)+
String.fromCharCode(1606)+
String.fromCharCode(1605)+
String.fromCharCode(1574)+
String.fromCharCode(1583)+
String.fromCharCode(1582)+
String.fromCharCode(1581)+
String.fromCharCode(1590)+
String.fromCharCode(1602)+
String.fromCharCode(1587)+
String.fromCharCode(1601)+
String.fromCharCode(1593)+
String.fromCharCode(1585)+
String.fromCharCode(1589)+
String.fromCharCode(1591)+
String.fromCharCode(1594)+
String.fromCharCode(1592)+
'-'+
'-'+
'-'+
'-'+
String.fromCharCode(1617)


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=ss.charCodeAt(key-32);
       }
      else if (e)
        e.which=ss.charCodeAt(key-32);
     }
   return true;
}



function getcodes()
{
 var x='';
  x='/exe/citycode.pgm'+String.fromCharCode(63)+'pro='+MM_findObj('cmbProvince').value+String.fromCharCode(38);
 location.href=encode(x);
}

function changelglpro()
{
var x='';
x = '/exe/lglfrm04.pgm' + String.fromCharCode(63)+'pro='+MM_findObj('cmbPro').value+String.fromCharCode(38);
location.href= encode(x);
}

function changeindpro()
{
var x='';
x = '/exe/indfrm02.pgm' + String.fromCharCode(63)+'pro='+MM_findObj('cmbPro').value+String.fromCharCode(38);
location.href= encode(x);
}

function encode(x)
{
 var s='';
for(i=0; i< x.length; i++){
 switch(x.charAt(i)){
  case 'ا': s += 'a'; break;
  case 'ب': s += 'b'; break;
  case 'پ': s += 'c'; break;
  case 'ت': s += 'd'; break;
  case 'ث': s += 'e'; break;
  case 'ج': s += 'f'; break;
  case 'ح': s += 'g'; break;
  case 'خ': s += 'h'; break;
  case 'چ': s += 'i'; break;
  case 'د': s += 'j'; break;
  case 'ذ': s += 'k'; break;
  case 'ر': s += 'l'; break;
  case 'ز': s += 'm'; break;
  case 'س': s += 'n'; break;
  case 'ش': s += 'o'; break;
  case 'ص': s += 'p'; break;
  case 'ض': s += 'q'; break;
  case 'ط': s += 'r'; break;
  case 'ظ': s += 's'; break;
  case 'ع': s += 't'; break;
  case 'غ': s += 'u'; break;
  case 'ف': s += 'v'; break;
  case 'ق': s += 'w'; break;
  case 'ک': s += 'x'; break;
  case 'گ': s += 'y'; break;
  case 'ل': s += 'z'; break;
  case 'م': s += 'A'; break;
  case 'ن': s += 'B'; break;
  case 'ه': s += 'C'; break;
  case 'و': s += 'D'; break;
  case 'ي': s += 'E'; break;
  case 'ژ': s += 'F'; break;
  case 'آ': s += 'G'; break;
  case 'ئ': s += 'H'; break;
  case 'ك': s += 'I'; break;
  case 'ی': s += 'E'; break;
  case ' ': s += ''; break;
  default: s += x.charAt(i);		
}
}
 return s;
}

function sendinddata()
{ 
 var x='';
 x='/exe/indseane13.pgm'+String.fromCharCode(63)+
'city='+ MM_findObj('cmbCity').value+String.fromCharCode(38) +
'name='+ MM_findObj('Name').value+String.fromCharCode(38) + 'lname='+         
MM_findObj('LName').value+String.fromCharCode(38) + 'adr='+ 
MM_findObj('Address').value+String.fromCharCode(38);
x=encode(x);
location.href=x;
}         

function sendlgldata()
{
 var x='';
 x='/exe/lglseane28.pgm'+String.fromCharCode(63)+'city='+MM_findObj('cmbCity').value+String.fromCharCode(38)+
'grp='+MM_findObj('cmbGroupCode').value+String.fromCharCode(38)+'titl='+MM_findObj('titl').value+String.fromCharCode(38)+'sctn='+MM_findObj('sctn').value+String.fromCharCode(38)
 +'act='+MM_findObj('act').value+String.fromCharCode(38)
 +'cls='+MM_findObj('cmbcls').value+String.fromCharCode(38);
 x= encode(x);
 location.href=x;
}


function fetchdata(id){                                                        
 var x='';                                                                     
 location.href=location.href+'rowno='+id+ String.fromCharCode(38);} 

function lglquery(grp,cls, act, sctn, titl){
var x='';
if (cls!='') {
x= '/exe/lglseane29.pgm'+String.fromCharCode(63)+'city=021'+String.fromCharCode(38)+
'grp='+grp+String.fromCharCode(38)+'titl='+titl+String.fromCharCode(38)+'sctn='+sctn+String.fromCharCode(38)
 +'act='+act+String.fromCharCode(38)
 +'cls='+cls+String.fromCharCode(38);
 x= encode(x);}
else {
x= '/exe/lglseane29.pgm'+String.fromCharCode(63)+'city=021'+String.fromCharCode(38)+
'grp='+grp+String.fromCharCode(38)+'titl='+titl+String.fromCharCode(38)+'sctn='+sctn+String.fromCharCode(38)
 +'act='+act+String.fromCharCode(38)
 +'cls='+'X'+String.fromCharCode(38);
 x= encode(x);
};
 location.href=x;
}
