<!--
 /**************************************************************\
 * 					Redge Webdesign CMS							*
 * 					scripts/standard.js							*
 * 																*
 * This file created on 15-sep-2007 by Romke van der Meulen		*
 * Copyright (c) 2007 Redge Webdesign - redge.online@gmail.com	*
 * www.redge.nl													*
 \**************************************************************/

 /******************************************************\
 *						Standard script					*
 * Includes some handy functions, such as automatically	*
 * emptying input boxes on focus.						*
 \******************************************************/

window.addEvent('domready', function(){
	$$('input').each(function(el){
		if(el.getProperty('type') == 'text'){
			el.addEvent("focus", function(e) {
				if(el.value == el.defaultValue){
					el.value = "";
				}
			});
			el.addEvent("blur", function(e) {
				if(el.value == ""){
					el.value = el.defaultValue;
				}
			});
		}
		if(el.getProperty('id') == 'email'){
			el.addEvent("keyup", function(e){
				if(el.getProperty("value") == ""){
					el.removeClass("good").removeClass("bad");
				}
				else{
					if(el.getProperty("value").test('^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$')){
						el.removeClass("bad").addClass("good");
					}
					else{
						el.removeClass("good").addClass("bad");
					}
				}
			});
		}
	});
 });

  /**
  * Simple function for simulating normal link behavior: loads specified URL
  *
  * @param string url URL to follow
  **/
 function go(url){
 	window.location = url;
 }

//-->

