
var sendable;
window.addEvent('domready', function(){
		
	$$('.uniForm').each(function(element) { 			
		element.addEvent('submit', function(e) {
			thisObj=this.getAttribute('id')		  
			sendable=true;		
			$$('#'+thisObj+' .ctrlHolder').each(function(element) { 			
				if(sendable) {
					var first = element.getFirst();					
					tmp=first.innerHTML;	
					
					if(tmp.indexOf("*") > 0)	{					
						var next = first.getNext();						
						var nm = next.getAttribute('id');
						var val = next.getValue();	
						
						if((val=='')||((nm.indexOf("email") > 0) && !isValidEmail(val))){
							$(nm).focus();	
							sendable=false;						
						}	
					}
				}		
			});	
			
			if(!sendable) new Event(e).stop();
         });	
	});		
});

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}			