Event.observe(window,"load",init,false);Validation=Class.create();Validation.prototype={initialize:function(){var _1=document.getElementsByTagName("form");this.form=_1[0];var _2=this.form.getElementsByTagName("input");var _3=false;var i=0;do{if(_2[i].type!="hidden"){_3=true;_2[i].focus();}i++;}while(!_3);Event.observe(this.form,"submit",this.onSubmit.bind(this),false);},onSubmit:function(ev){if(!this.validate()){this.pageMarkupErrors();Event.stop(ev);}},validate:function(){var _6=true;var _7=this.form.getElementsByTagName("input");var _8=this.form.getElementsByTagName("textarea");for(var i=0;i<_7.length;i++){if(_7[i].type=="text"||_7[i].type=="password"){Element.removeClassName(_7[i],"validate");var _a=_7[i].className;var _b=$(_7[i].name+"-label");var _c=true;if(_a=="anything"){if(_7[i].value==null||_7[i].value.length==0){_6=false;_c=false;}}else{if(_a="email"){var _d=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(!_d.test(_7[i].value)){_6=false;_c=false;}}}if(_c){this.inputMarkupErrors(_7[i],true);this.labelMarkupErrors(_b,true);}else{this.inputMarkupErrors(_7[i],false);this.labelMarkupErrors(_b,false);}}}for(var i=0;i<_8.length;i++){Element.removeClassName(_8[i],"validate");var _f=_7[i].className;if(_f=="anything"){var _10=$(_8[i].name+"-label");if(_8[i].value==null||_8[i].value.length==0){this.inputMarkupErrors(_8[i],false);this.labelMarkupErrors(_10,false);_6=false;}else{this.inputMarkupErrors(_8[i],true);this.labelMarkupErrors(_10,true);}}}return _6;},inputMarkupErrors:function(obj,_12){if(_12){obj.style.border="1px solid #008000";}else{obj.style.border="1px solid #ff0000";}},labelMarkupErrors:function(obj,_14){if(_14){obj.style.color="#008000";}else{obj.style.color="#ff0000";}},pageMarkupErrors:function(){var _15=new fx.Opacity($("warning"),{duration:150});_15.hide();try{$("status-icon").src="http://www.intellistrand.com/media/exclamation.gif";$("status-text").innerHTML="There is an error with the fields marked in red. Please check the entries and try again.";}catch(err){new Insertion.Top("warning","<img src=\"http://www.intellistrand.com/media/exclamation.gif\" width=\"45\" height=\"39\" id=\"status-icon\" alt=\"Questions?\" /><p id=\"status-text\">There is an error with the fields marked in red. Please check the entries and try again.</p><div class=\"clear spacer\"></div>");}_15.toggle();}};function init(){new Validation();}