﻿function validate() {
  if( document.getElementById('txtname').value =='' ){
			alert('نام خود را وارد نمایید ');
			document.getElementById('txtname').focus();
			return false;  
 }
 
 if( document.getElementById('txtfamily').value=='' ){
			alert('نام خانوادگی خود را وارد نمایید ');
			document.getElementById('txtfamily').focus();
		return false;  
 }
 if( document.getElementById('dr3').value=='0' ){
			alert(' تاریخ تولد خود را وارد نمایید');
			document.getElementById('dr3').focus();
		return false;  
 }
  if( document.getElementById('drcon').value=='0' ){
			alert(' کشور محل تولد خود را وارد نمایید');
			document.getElementById('drcon').focus();
		return false;  
 }
  if( document.getElementById('txtphone').value =='' ){
			alert('شماره تلفن را وارد نماييد ');
			document.getElementById('txtphone').focus();
			return false;  
 }
 if( document.getElementById('txtmail').value =='' ){
			alert('آدرس ایمیل خود را وارد کنید ');
			document.getElementById('txtmail').focus();
			return false;  
 }
  if( document.getElementById('txtmail').value.indexOf('@')<=0  ){
			alert('آدرس ایمیل خود را صحیح وارد کنید'+'\n'+'Name @ site.com !');
			document.getElementById('txtmail').focus();
			return false;  
 } 
  if( document.getElementById('drspe').value =='انتخاب نمایید'  ){
			alert('لطفا یکی از انجمنهای تخصصی را انتخاب نمایید');
			document.getElementById('drspe').focus();
			return false;  
 } 
  
   if( document.getElementById('txtskill').value=='' ){
			alert(' تخصص خود را کامل وارد نمایید');
			document.getElementById('txtskill').focus();
		return false;  
 }
 if( document.getElementById('txtuserid').value=='' ){
			alert(' نام کاربری خود وارد نمایید');
			document.getElementById('txtuserid').focus();
		return false;  
 }
   if(  document.getElementById('txtuserid').value.length<6 ){
			alert('نام کاربری را حداقل 6 کاراکترانتخاب نماببد');
			document.getElementById('txtuserid').focus();
			return false;  
 } 
  if( document.getElementById('txtpass').value =='' ){
			alert('رمز عبور را وارد نمایید ');
			document.getElementById('txtpass').focus();
			return false;  
 } 
   if(  document.getElementById('txtpass').value.length<6 ){
			alert('رمز عبور را حداقل 6 کاراکترانتخاب نماببد');
			document.getElementById('txtpass').focus();
			return false;  
 } 
 if( document.getElementById('txtcon').value != document.getElementById('txtpass').value ){
			alert('رمز عبور مجدد را صحیح وارد نمایید ');
			document.getElementById('txtcon').focus();
			return false;  
 }
 
 return; 
}

function validateeng() {
  if( document.getElementById('txtname').value =='' ){
			alert('Enter your name ');
			document.getElementById('txtname').focus();
			return false;  
 }
 
 if( document.getElementById('txtfamily').value=='' ){
			alert('Enter your family name ');
			document.getElementById('txtfamily').focus();
		return false;  
 }
 if( document.getElementById('dr3').value=='0' ){
			alert(' Enter your date of birth');
			document.getElementById('dr3').focus();
		return false;  
 }
  if( document.getElementById('drcon').value=='0' ){
			alert(' Enter your place of bitrh');
			document.getElementById('drcon').focus();
		return false;  
 }
  if( document.getElementById('txtphone').value =='' ){
			alert('Enter your phone number ');
			document.getElementById('txtphone').focus();
			return false;  
 }
 if( document.getElementById('txtmail').value =='' ){
			alert('Enter your Email Address ');
			document.getElementById('txtmail').focus();
			return false;  
 }
  if( document.getElementById('txtmail').value.indexOf('@')<=0  ){
			alert('Enter your Email Address Correctly'+'\n'+'Name @ site.com !');
			document.getElementById('txtmail').focus();
			return false;  
 } 
  if( document.getElementById('drspe').value =='انتخاب نمایید'  ){
			alert('Choose Education Group');
			document.getElementById('drspe').focus();
			return false;  
 } 
  
   if( document.getElementById('txtskill').value=='' ){
			alert(' Enter your Skills');
			document.getElementById('txtskill').focus();
		return false;  
 }
 if( document.getElementById('txtuserid').value=='' ){
			alert(' Enter your username');
			document.getElementById('txtuserid').focus();
		return false;  
 }
   if(  document.getElementById('txtuserid').value.length<6 ){
			alert('Username must be 6 character at least');
			document.getElementById('txtuserid').focus();
			return false;  
 } 
  if( document.getElementById('txtpass').value =='' ){
			alert('Enter your Password ');
			document.getElementById('txtpass').focus();
			return false;  
 } 
   if(  document.getElementById('txtpass').value.length<6 ){
			alert('Password must be 6 character at least');
			document.getElementById('txtpass').focus();
			return false;  
 } 
 if( document.getElementById('txtcon').value != document.getElementById('txtpass').value ){
			alert('Enter your confirm password correctly ');
			document.getElementById('txtcon').focus();
			return false;  
 }
 
 return; 
}
//------------------------------farsi saz------------------------------------//
var farsi=true;
function led(o){
 if (farsi==true)
 {
  o.src=f.src;
  }
  else
  {
  o.src=e.src;
  }
}
//---------------------------------------------------------------

var farsikey = [
   0x0020, 0x0021, 0x061B, 0x066B, 0x00A4, 0x066A, 0x060C, 0x06AF,
   0x0029, 0x0028, 0x002A, 0x002B, 0x0648, 0x002D, 0x002E, 0x002F,
   0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
   0x0038, 0x0039, 0x003A, 0x0643, 0x003E, 0x003D, 0x003C, 0x061F,
   0x066C, 0x0624, 0x200C, 0x0698, 0x0649, 0x064D, 0x0625, 0x0623,
   0x0622, 0x0651, 0x0629, 0x00BB, 0x00AB, 0x0621, 0x004E, 0x005D,
   0x005B, 0x0652, 0x064B, 0x0626, 0x064F, 0x064E, 0x0056, 0x064C,
   0x0058, 0x0650, 0x0643, 0x062C, 0x005C, 0x0686, 0x00D7, 0x0640,
   0x200D, 0x0634, 0x0630, 0x0632, 0x064A, 0x062B, 0x0628, 0x0644,
   0x0627, 0x0647, 0x062A, 0x0646, 0x0645, 0x067E, 0x062F, 0x062E,
   0x062D, 0x0636, 0x0642, 0x0633, 0x0641, 0x0639, 0x0631, 0x0635,
   0x0637, 0x063A, 0x0638, 0x007D, 0x007C, 0x007B, 0x007E ];

function submitenter(myfield,e)
{

var key;
if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;

if (key>=128)
{
 alert("Please Disable Your System Farsi Language -> Press [Alt+Shift] \nPlease Used [Scroll Lock]");
 myfield.focus();
 return false;
}

if(!farsi) return true;

if (key>31)
if (key<128)
{

     if (key == 0x0020 && window.event.shiftKey) // Shift-space -> ZWNJ
       window.event.keyCode = 0x200C;
     else
       window.event.keyCode = farsikey[key - 0x0020];
     if (farsikey[key - 0x0020] == 92) {
        window.event.keyCode = 0x0698;
     }
     if (farsikey[key - 0x0020] == 8205) {
        window.event.keyCode = 0x067E;
     }

}

 return true;
}
//-------------------------------------------------------------
function only_en(myfield,e)
{
var key;
if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
if ( (key>=97 && key<=122)|| (key>=48 && key<=57 ) || (key>=65 && key<=90) ||  key==45 || key==95 )
{
	return true;
}
else
{
  if ( key > 127 ) 
  {
    alert('Press Alt+Shift');
  }
   return false;  	
 }  
}


function validatesrch() {
  
  if( document.getElementById('txtonvan').value=='' ){
			alert(' عنوان مورد نظر خود را وارد نمایید');
			document.getElementById('txtonvan').focus();
		return false;  
 }
  if( document.getElementById('txtsum').value=='' ){
			alert(' متن مورد نظر خود را وارد نمایید');
			document.getElementById('txtsum').focus();
		return false;  
 }
    
 return; 
}

function validatedoc() {
  
  if( document.getElementById('txtonvan').value=='' ){
			alert(' عنوان مورد نظر خود را وارد نمایید');
			document.getElementById('txtonvan').focus();
		return false;  
 }
  if( document.getElementById('txttext').value=='' ){
			alert(' متن مورد نظر خود را وارد نمایید');
			document.getElementById('txttext').focus();
		return false;  
 }
 if( document.getElementById('txtsource').value=='' ){
			alert(' منبع مورد نظر خود را وارد نمایید');
			document.getElementById('txtsource').focus();
		return false;  
 }
    
 return; 
}


function validatebook() {
  
  if( document.getElementById('textbox1').value=='' ){
			alert(' عنوان مورد نظر خود را وارد نمایید');
			document.getElementById('textbox1').focus();
		return false;  
 }
   if( document.getElementById('textbox3').value =='' ){
			alert('آدرس ایمیل خود را وارد کنید ');
			document.getElementById('textbox3').focus();
			return false;  
 }
  if( document.getElementById('textbox3').value.indexOf('@')<=0  ){
			alert('آدرس ایمیل خود را صحیح وارد کنید'+'\n'+'Name @ site.com !');
			document.getElementById('textbox3').focus();
			return false;  
 } 
    
 return; 
}











			
						












