var vkb_ArabicEquevilantChar = new Array();
	
	vkb_ArabicEquevilantChar[96] = 1584;
	vkb_ArabicEquevilantChar[47] = 1592;
	vkb_ArabicEquevilantChar[46] = 1586;
	vkb_ArabicEquevilantChar[44] = 1608;
	vkb_ArabicEquevilantChar[109] = 1577;
	vkb_ArabicEquevilantChar[110] = 1609;
	vkb_ArabicEquevilantChar[98] = 1575;
	vkb_ArabicEquevilantChar[118] = 1585;
	vkb_ArabicEquevilantChar[99] = 1572;
	vkb_ArabicEquevilantChar[120] = 1569;
	vkb_ArabicEquevilantChar[122] = 1574;
	vkb_ArabicEquevilantChar[39] = 1591;
	vkb_ArabicEquevilantChar[59] = 1603;
	vkb_ArabicEquevilantChar[108] = 1605;
	vkb_ArabicEquevilantChar[107] = 1606;
	vkb_ArabicEquevilantChar[106] = 1578;
	vkb_ArabicEquevilantChar[104] = 1575;
	vkb_ArabicEquevilantChar[103] = 1604;
	vkb_ArabicEquevilantChar[102] = 1576;
	vkb_ArabicEquevilantChar[100] = 1610;
	vkb_ArabicEquevilantChar[115] = 1587;
	vkb_ArabicEquevilantChar[97] = 1588;
	vkb_ArabicEquevilantChar[93] = 1583;
	vkb_ArabicEquevilantChar[91] = 1580;
	vkb_ArabicEquevilantChar[112] = 1581;
	vkb_ArabicEquevilantChar[111] = 1582;
	vkb_ArabicEquevilantChar[105] = 1607;
	vkb_ArabicEquevilantChar[117] = 1593;
	vkb_ArabicEquevilantChar[121] = 1594;
	vkb_ArabicEquevilantChar[116] = 1601;
	vkb_ArabicEquevilantChar[114] = 1602;
	vkb_ArabicEquevilantChar[101] = 1579;
	vkb_ArabicEquevilantChar[119] = 1589;
	vkb_ArabicEquevilantChar[113] = 1590;

	vkb_ArabicEquevilantChar[80] = 1563;
	vkb_ArabicEquevilantChar[76] = 47;
	vkb_ArabicEquevilantChar[75] = 1548;
	vkb_ArabicEquevilantChar[74] = 1600;
	vkb_ArabicEquevilantChar[72] = 1571;
	vkb_ArabicEquevilantChar[71] = 1571;
	vkb_ArabicEquevilantChar[63] = 1567;
	vkb_ArabicEquevilantChar[62] = 46;
	vkb_ArabicEquevilantChar[60] = 44;
	vkb_ArabicEquevilantChar[78] = 1570;
	vkb_ArabicEquevilantChar[66] = 1570;

	vkb_ArabicEquevilantChar[81]=1614;
	vkb_ArabicEquevilantChar[87]=1611;
	vkb_ArabicEquevilantChar[88]=1618;
	vkb_ArabicEquevilantChar[69]=1615;
	vkb_ArabicEquevilantChar[82]=1612;
	vkb_ArabicEquevilantChar[67]=1616;
	vkb_ArabicEquevilantChar[86]=1613;
	vkb_ArabicEquevilantChar[84]=1617;
	
var vkbFlag = false; // when the keyBad is hidden the functionality 
					 // of the VKB should be OFF.
					 
var SpicalCh = new Array(5);
	SpicalCh[0] = 71 //"G";
	SpicalCh[1] = 66 //"B";
	SpicalCh[2] = 98 //"b";
	SpicalCh[3] = 32 //"space";
	
function isSpicalCh(keyValue){
	for (var j=0; j < 5; j++)
	{
		if( keyValue == SpicalCh[j] ) 
			return SpicalCh[j];
	}
	return 0;
}

function TwoChars(kCode){
	var strChar = "" ;
	strChar = String.fromCharCode(vkb_ArabicEquevilantChar[103]); 
	strChar += String.fromCharCode(vkb_ArabicEquevilantChar[kCode]);
	return strChar;
}

function vkbBtn_onclick(page) {
	var pw = (window.screen.width/2) - 387
	var ph = (window.screen.height/2)

	window.open(page, "VKB","left="+pw+",top="+ph+",width=492,height=182,noresizable")
	/*if (Dom.getElm('vkbKeypad').style.visibility == 'hidden')
	{
		Dom.getElm('vkbKeypad').style.visibility = 'visible';
		vkbFlag = true;
	}
	else
	{
		Dom.getElm('vkbKeypad').style.visibility = 'hidden' ;
		vkbFlag = false;
	}*/
}
	
//	when using mouse to input text: ---------------------------------------------------
	function ByMouse(KeyValue, BoxObj){
		var kValue = new String(KeyValue);
		var kCode = kValue.charCodeAt(0);
		
		if(kValue == "del" ) 
		{
			var box_value = BoxObj.value;
			box_value = box_value.substr(0, box_value.length-1);
			BoxObj.value = box_value;
			return;
		}
		else if( kValue == "space" )
		{
			var box_value = BoxObj.value;
			box_value += " ";
			BoxObj.value = box_value;
			return;
		}		
		else if ( !isNaN(parseInt(kValue)) )
		{
			BoxObj.value += kValue 
			return;
		}
		else if (isSpicalCh(kCode))
		{
			BoxObj.value += TwoChars(kCode);
			return;
		}
		else
		{
			for(var i=0; i < vkb_ArabicEquevilantChar.length ; i++)
			{
				if (i == kCode)
					{
						BoxObj.value += String.fromCharCode(vkb_ArabicEquevilantChar[kCode]); 
						return;
					}
			}
		}
	}
	
//	when using keyboard to input text: ------------------------------------------------	
function ByKeyBoard(keyValue, BoxObj) 
{
	//alert("By Keyboard");
	var kCode;
	var num;
	//BoxObj.focus(); // return focuse to search box.
	kCode = isSpicalCh(keyValue);
	if (!kCode )
	{
		for (var i=0; i< 128; i++)
		{
			if (i == keyValue)
			{
				num = vkb_ArabicEquevilantChar[i];
				event.returnValue = false; // to delete the original key value;
				break;
			}
		}
		BoxObj.value += String.fromCharCode(num);
	}
	else { 
		//alert("Spical Cahr " + kCode );
		if (kCode != 32){
				BoxObj.value += TwoChars(kCode);
				event.returnValue = false; // to delete the original key value;
			}
	}
}

//	this function called when inputting by VKB: ---------------------------------------
	function KeyStrok(KeyValue, inputSource, BoxObj){
		/*
			inputSource: 0 - keyboard
						 1 - mouse
		*/
		//alert(BoxObj)
		BoxObj.focus(); // return focuse to search box. ///Alaa' Q Removed the focus action
		BoxObj.style.textAlign = 'right'
		if (vkbFlag)
		{
			if (inputSource == 0 )
				ByKeyBoard(KeyValue, BoxObj);
			else
				ByMouse(KeyValue, BoxObj);
			window.focus();
		}
	}