//--------------------------------------------------------------------

	// filename: validatr.js



	// 10/Mar/2009 Oh! another Strange Disenvoweling! And another validating lib for JS! Ha-ha!

	//--------------------------------------------------------------------



	var show_debug = false;



	//====================================================================

	// Shortcuts



	function go(url) {



		document.location.href = url;



	} 



	function Validar(){

		$("centro").getElements("form[target!=PagSeguro]").addEvent("submit",function(){

			var theform=this;

			var thename=this.name.split("form_")[1]
			
			new Request({

				url:thename+".ajax.php",

				onComplete: function(responseraw){
					response=JSON.decode(responseraw.trim());
					if(response!=null){
						//theform.getElements("label").each(function(el){el.set("class","")})
						$$("label.problema").set("class","")
						$$("div.problema").destroy();
						$each(response, function(value,key){
							
							//if ($defined(theform.getElement("*[for="+key+"]"))){
							if ($defined(theform.getElement("*[name="+key+"]"))){
								campao=theform.getElement("*[name="+key+"]");
								if (!$defined(campao.getParent("div").getPrevious("div")) || campao.getParent("div").getPrevious("div").className!="problema"){
									var dv=new Element("div", {id:"warning_"+thename, "class":"problema"}).adopt(new Element("strong").set("html","Problemas nestes campos : "))
									unl=new Element("ul").adopt(new Element("li").set("html", value))
									dv.adopt(unl)
									dv.inject(campao.getParent("div"),"before")
								} else {
									campao.getParent("div").getPrevious("div").getFirst("ul").adopt(new Element("li").set("html",value))
								}
								if (campao.getPrevious("label")!=null)
									campao.getPrevious("label").set("class","problema")
								else
									theform.getElements("label").each(function(el){el.set("class","problema")})
							} else {
								var dv=new Element("div", {id:"warning_"+thename, "class":"problema"}).adopt(new Element("strong").set("html","Problemas nestes campos : "))
								unl=new Element("ul").adopt(new Element("li").set("html", value))
								dv.adopt(unl)
								dv.inject(theform.getParent("div"),"before")
								theform.getElements("label").each(function(el){el.set("class","problema")})
							}
						})

					} else { theform.submit()}

					return false;

				}

			}).post(this);

			return false

		})

	}



	function validateAndSubmit(form_name, validator_name) {

		

	}

