﻿//public varibale farsi
var KeylangFarsi=true;
// for keypress
function farsikey(myfield,e)
{
var key;
var basestring=' !"#$%،گ)(×+و-./0123456789:ک,=.؟@ِذ}ىُىلآ÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزیثبلاهتنمئدخحضقسفعرصطغظ<|>ّ';
if (window.event)
 key = window.event.keyCode;
else if (e)
 key = e.which;

if (key < 0x0020 || key >= 0x00FF) return true; 
if (KeylangFarsi==true)
{
	if (window.event)
	 window.event.keyCode=basestring.charCodeAt(key-32);
	else if (e)
	 e.which=basestring.charCodeAt(key-32);
}
 return true;
}

// function for keydown
function changelang(objtext1)
{
if (window.event.keyCode==119) 
		KeylangFarsi =(KeylangFarsi==true) ? false : true ;
    if (window.event.altKey && window.event.shiftKey )  
		KeylangFarsi = false ;
	 return true;
}


function IValidForm() {


document.All("sendm").disabled=true;

}
			
function IsValidForm() {

	
if  (document.All("message").value =="") {
alert("ورود متن نظر الزاميست") ;
document.All("message").focus ();
return false;
}
	
if  (document.All("message").value.length >2000 ) 	{
alert("تنها مجاز به ورود دو هزار حرف در متن نظرات هستيد") ;
document.All("message").focus ();
return false;
}
	
if  (document.All("mail").value!="" && IsEmail(document.All("mail").value)==false ) 
{
alert("ايميل را به شکل صحيح وارد کنيد") ;
document.All("mail").focus ();
return false;
}	

document.All("sendm").disabled=true;

} // end 


function IsEmail(str) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    if (! str.match(re)) {
        return (false);
    }
    return(true);
}	

window.status='F8 => تغییر زبان صفحه کلید ' ;
WriteSM();		