function resetForm(form){
	var form = document.getElementById(form);
	form.reset();
}

function FromVaditor(formID){
	this.form = document.getElementById(formID);
	this.fields = [];
	this.add = function (field,vaditorFunction,message,otherFileds){
		this.fields[this.fields.length]={
			filed : field,
			vaditor : vaditorFunction,
			message : message,
			otherFiled :otherFileds
		}
	}
	this.validate = function (){
			for(var i = 0 ;i < this.fields.length;i++){
				var ch = this.fields[i];
				if(!ch.vaditor(this.form[ch.filed],this.form[ch.otherFiled])){
					alert(ch.message);
					if(this.form[ch.filed].focus){
						this.form[ch.filed].focus();
					}
					return false;
				}
			}
			return true;
		}
		
	this.multreq =function(f){
		if(!f)return false;
		for(var i =0; i<f.length;i++){
			if(f[i].checked){
				return true;
			}
		}
		return false;
	}
		
	this.req =function(f){
		return checkRequired(f.value);
	}
		
	this.url=function(f){
		if(checkRequired(f.value)){
			return checkUrl(f.value);
		}
		return true;
	}
	
	this.email=function(f){
		if(checkRequired(f.value)){
			return checkEmail(f.value);
		}
		return true;
	}
	
	this.telphone=function(f){
		if(checkRequired(f.value)){
			//return checkPhone(f.value);
			return checkInt(f.value);
		}
		return true;
	}
	
	this.integer =function(f){
		if(checkRequired(f.value)){
			return checkInt(f.value);
		}
		return true;
	}
	
	this.great = function(f1,f2){
		if(checkRequired(f1.value) && checkRequired(f2.value)){
			if(f1.value<f2.value){
				return false;
			}
		}
		return true;
	}
	
	this.image = function(f1){
		if(checkRequired(f1.value) ){
			if(checkImgType(f1.value)){
				return false;
			}
		}
		return true;
	}
	
}