/* code from qodo.co.uk */
// create as many regular expressions here as you need:
var digitsOnly = /[1234567890]/g;
var integerOnly = /[0-9\.]/g;
var alphaOnly = /[A-Z]/g;

function restrictCharacters(myfield, e, restrictionType) {
	if (!e) var e = window.event
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	var character = String.fromCharCode(code);

	// if they pressed esc... remove focus from field...
	if (code==27) { this.blur(); return false; }
	
	// ignore if they are press other keys
	// strange because code: 39 is the down key AND ' key...
	// and DEL also equals .
	if (!e.ctrlKey && code!=9 && code!=8 && code!=36 && code!=37 && code!=38 && (code!=39 || (code==39 && character=="'")) && code!=40) {
		if (character.match(restrictionType)) {
			return true;
		} else {
			return false;
		}
		
	}
}
	
	//DHTML function to "toggle" a block element from visible to not
function toggle_visible(obj)
{
	if (document.getElementById(obj).style.display=="none")
	{
		document.getElementById(obj).style.display="";
	} else {
		document.getElementById(obj).style.display="none";
	}
}


// DHTML function to dynamically update content of an HTML element
function change_content(obj, content)
{
	document.getElementById(obj).innerHTML = content;
}

//http://www.regular-expressions.info/email.html
function validate_email(email)
{
	if (email.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i))
	{
		alert("Email Address is Valid");
		return true;
	}
	else
	{
		alert(email + " is not a valid email address");
		return false;
	}
}

//document.body.onload=load();

function load()
{
	 //alert("yo");
	 //if (document.loginform) document.loginform.email.focus();
}




function browse_cat()
{
	//...
	var selectedcat = document.getElementById('browse_cat');

	//console.log(selectedcat.value);

	window.location = selectedcat.value;
	
}
