﻿//  <!--   Copyright © 2001-2003 Mehrdad Omidvari   -->
//  <!--   27-Apr-03 -->

	var keyboardType = 0;
	
	/* D= hD, I=aI, Y=yI, A=aU, U=A, i=i-tanha, w=yD */

	fu = new Array(90);

	fu[0] = 0x60c;
	fu[1] = 45;
	fu[2] = 46;
	fu[3] = 47;
	fu[4] = 0x06f0;
	fu[5] = 0x06f1;
	fu[6] = 0x06f2;
	fu[7] = 0x06f3;
	fu[8] = 0x06f4;
	fu[9] = 0x06f5;
	fu[10] = 0x06f6;
	fu[11] = 0x06f7;
	fu[12] = 0x06f8;
	fu[13] = 0x06f9;
	fu[14] = 58;
	fu[15] = 0x061b;
	fu[16] = 0x003c;
	fu[17] = 0x003d;
	fu[18] = 0x003e;
	fu[18] = 0x003e;
	fu[19] = 0x061f;
	fu[20] = 64;

	/* A-Z */
	fu[21] = 0x0622;
	fu[22] = 0x200c;
	fu[23] = 0x0635;
	fu[24] = 0x0629;
	fu[25] = 0x0650;
	fu[26] = 0x200c;
	fu[27] = 0x0686;
	fu[28] = 0x062d;
	fu[29] = 0x0623;
	fu[30] = 0x0698;
	fu[31] = 0x062e;
	fu[32] = 0x0671;
	fu[33] = 0x064d;
	fu[34] = 0x064b;
	fu[35] = 0x064f;
	fu[36] = 0x0625;
	fu[37] = 0x063a;
	fu[38] = 0x063a;
	fu[39] = 0x0634;
	fu[40] = 0x0637;
	fu[41] = 0x064e;
	fu[42] = 0x064c;
	fu[43] = 0x0651;
	fu[44] = 0x0638;
	fu[45] = 0x0626;
	fu[46] = 0x0630;

	fu[47] = 91;
	fu[48] = 92;
	fu[49] = 93;
	fu[50] = 94;
	fu[51] = 95;
	fu[52] = 96;

	/* a-z */
	fu[53] = 0x0627;
	fu[54] = 0x0628;
	fu[55] = 0x062b;
	fu[56] = 0x062f;
	fu[57] = 0x0639;
	fu[58] = 0x0641;
	fu[59] = 0x06af;
	fu[60] = 0x0647;
	fu[61] = 0x0621;
	fu[62] = 0x062c;
	fu[63] = 0x06a9;
	fu[64] = 0x0644;
	fu[65] = 0x0645;
	fu[66] = 0x0646;
	fu[67] = 0x0652;
	fu[68] = 0x067e;
	fu[69] = 0x0642;
	fu[70] = 0x0631;
	fu[71] = 0x0633;
	fu[72] = 0x062a;
	fu[73] = 0x0624;
	fu[74] = 0x0648;
	fu[75] = 0x064a;
	fu[76] = 0x0636;
	fu[77] = 0x06cc;
	fu[78] = 0x0632;

	fu[79] = 123;
	fu[80] = 124;
	fu[81] = 125;
	fu[82] = 126;
	fu[83] = 127;


function nKey(myfield,e)
{

	var key;
	if (keyboardType == 1) return true;

	if (window.event)
   		key = window.event.keyCode;
	else if (e)
		key = e.which;

	if ( key > 43 && key < 128 )
	{

		fu_key = fu[key-44];

		if ( key == 124 )
			fu_key = 8204;

		if (window.event)
		{
			window.event.keyCode =	fu_key;
		}
		else if (e)
		{
   			e.which = fu_key;
		}

   	}
	return true;
}

function changeKey ( doc, k )
{
	keyboardType = k;
}

function sDoc ( form)
{
	dWin = window.open ('', 'newWin',  'scrollbars=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes');
	dWin.document.open ();
	dWin.document.write ( "<html dir=rtl><head><META content=\"text/html; charset=utf-8\" http-equiv=Content-Type><META content=fa http-equiv=Content-Language> <title> Page1 </title></head><body>" );
	dWin.document.write ( "<div style=\"font-family: Arial; color=#0000ff; font-size: 14pt\" >" );
	st = new String ( form.fta.value );
	re = /\r/g;
	str = st.replace ( re, "<br>\r" );
	dWin.document.write (str );
	dWin.document.write ( "</div></body></html>" );
	dWin.document.close();

}

function searchG ( form)
{
	str = new String ( form.ftf.value );
	
	dWin = window.open ('http://www.google.com/search?hl=fa&ie=UTF-8&oe=UTF-8&btnG=Google+Search&q=' + str, 
		'newWin', 'scrollbars=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes');
	
	dWin.document.close();

}

function showTime1()
{

  function two_digit(value)
  {
    var s = value + '';

    if (s.length == 1)
      return('0' + s);
    else
        return(s);
  }

  var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
  var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
  var now = new Date();
  var day = now.getDay();
  var today = now.getDate();
  var month = now.getMonth();
  var year = now.getFullYear();

  var dateStamp = days[day] + ' ' + two_digit(today) + ', ' + months[month] + ' ' + year;

  document.write('<span class="timestyle1">' + dateStamp + '</span>');
  return (true);

}

