﻿// JavaScript Document
var newObj,indexOfnewObj,inputs;
function init() {
  var inputs=document.getElementsByTagName("input");
  var textAreas=document.getElementsByTagName("textarea");
  //-----------------------\/\/\/\/\/
  //--------------------------------------^^^^
  for (var i=0; i < textAreas.length; i++) {
	textAreas[i].onkeypress=farsikey;
	textAreas[i].onkeydown=changelang;
	textAreas[i].onfocus=function() {
	  	this.className='TextBoxFieldOver';
		
	}
	textAreas[i].onblur=function() {
	  	this.className='TextBoxField';
	}
  }
  //WinUp \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/  
  var Links=document.getElementsByTagName("a");
  for (var i=0; i < Links.length; i++) {

	
	if (Links[i].className.match("WinUP")) {
	  Links[i].onfocus=function() {
	  	this.className='WinUPover';
        return false;
      }
      Links[i].onclick=function() {
		parent.document.WinUPform.titleWin.value=this.title;
		parent.document.WinUPform.idWin.value=this.id;
		parent.document.WinUPform.urlWin.value=this.href;
		parent.document.WinUPform.actionWin.focus();
		  
	  	//this.className='WinUP';
		//alert("1");
		//winArray[++indexDhtmWin]=dhtmlwindow.open(this.winid, "iframe", this.href, this.title, "width=700px,height=420px,left=150px,top=10px,resize=1,scrolling=0", "recal");
		return false;
	  }

      Links[i].onblur=function() {
	  	this.className='WinUP';
	  }
	  Links[i].onmouseover=function() {
	  	this.className='WinUPover';
        return false;
      }
      Links[i].onmouseout=function() {
	  	this.className='WinUP';
	  }
	}
  //WinUp ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^	
	if (Links[i].className.match("Button_B")) {
		Links[i].className='Button_B';
	  Links[i].onfocus=function() {
	  	this.className='Button_O';
        return false;
      }
	  Links[i].onmousedown=function() {
	  	this.className='Button_D';
        return false;
      }
	  
      Links[i].onblur=function() {
	  	this.className='Button_B';
	  }
	  Links[i].onmouseover=function() {
	  	this.className='Button_O';
        return false;
      }
      Links[i].onmouseout=function() {
	  	this.className='Button_B';
	  }
      Links[i].onmouseup=function() {
	  	this.className='Button_B';
	  }
	  
	}
  }

  for (var i=0; i < inputs.length; i++) {
	
	if (inputs[i].type.match("submit")||inputs[i].type.match("reset")||inputs[i].type.match("button")) {
		inputs[i].className='Button_B';
	  inputs[i].onfocus=function() {
	  	this.className='Button_O';
        return false;
      }
	  inputs[i].onmousedown=function() {
	  	this.className='Button_D';
        return false;
      }
	  
      inputs[i].onblur=function() {
	  	this.className='Button_B';
	  }
	  inputs[i].onmouseover=function() {
	  	this.className='Button_O';
        return false;
      }
      inputs[i].onmouseout=function() {
	  	this.className='Button_B';
	  }
      inputs[i].onmouseup=function() {
	  	this.className='Button_U';
	  }
	  
	}
	
	if (inputs[i].className.match("TextBoxField")||inputs[i].className.match("showAlert")) {
	  inputs[i].onfocus=function() {
	  	this.className='TextBoxFieldOver';
		//alert(this.value);
        return false;
      }
	  inputs[i].onkeypress=farsikey;
	  //newObj=inputs[i+1];
	  //indexOfnewObj=i;
	  inputs[i].onkeydown=changelang;
	  //inputs[i].onkeyup=alert("124");
      inputs[i].onblur=function() {
	  	this.className='TextBoxField';
		if(this.id.substring(0,7)=='numeral'){
			//if(this.value=="")alert("لطفا این فیلد را خالی رها نکنید");
			
		}
	  }
	}
	if (inputs[i].className.match("TextBoxEn")) {
	  inputs[i].onfocus=function() {
	  	this.className='TextBoxOverEn';
		//alert(this.value);
        return false;
      }
      inputs[i].onblur=function() {
	  	this.className='TextBoxEn';
		if(this.id.substring(0,7)=='numeral'){
			if(this.value=="")alert("لطفا این فیلد را خالی رها نکنید");
			
		}
	  }
	}
  }
}
document.onkeydown=function(evt){ 
						changelang(evt?evt.keyCode:event.keyCode);
					}
function Edit(id){
	document.formI.username.value=id;
	document.formI.submit();
}
function CheckForm(){
	if(document.form1.username.value==""){
		alert('نام کاربری را وارد نکرده اید.');
		document.form1.username.focus();
		return false;
	}
	if(document.form1.password.value==""){
		alert('کلمه عبور را وارد نکرده اید.');
		document.form1.password.focus();
		return false;
	}
	return;	
}
window.onload=init;
