function getSubCategories(id, sc_id){
	url = '/dropdown.js.php?id='+id+'&sc_id='+sc_id;
	addScript(url);
}

function removeAllOptions(selectbox){  
	var i;  
	for(i=selectbox.options.length-1;i>=0;i--){
		selectbox.remove(i);  
	}
}  
  
function addOption(selectbox, value, text ){  
	var optn = document.createElement("OPTION");  
	optn.text = text;  
	optn.value = value;  
	  
	selectbox.options.add(optn);
} 

function removeAllOptions(selectbox){
	var i;
	for(i=selectbox.options.length-1;i>=0;i--){
		selectbox.remove(i);
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function validatePwd(field) {
	var invalid = " "; // Invalid character is a space
	var valid = "0123456789"; // Invalid character is a space
	var minLength = 8; // Minimum length

	// check for minimum length
	if (field.value.length < minLength) {
		alert('Your password must be at least ' + minLength + ' characters long.');
		return false;
	}
	// check for spaces
	if (field.value.indexOf(invalid) > -1) {
		alert("Your password must not contain spaces.");
		return false;
	}
	if (!(field.value.search(/[0-9]+/) > -1)) {
		alert("Your password must contain at least one number.");
		return false;
	}
	return true;
}
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function validateNewsletter(f){
	if (f.name.value == '') {
		alert("Please enter your Name.");
		return false;
	}
	if (isValidEmail(f.email.value) == false) {
		alert("Please enter a valid Email address.");
		return false;
	}
	return true;
}
function addScript(url){
	var sc = document.createElement("script");
	sc.src = url;
	document.getElementsByTagName('head')[0].appendChild(sc);
}

function minimise(span_name) {
	eval("document.getElementById('"+span_name+"').style.display = 'none';");
	eval("document.getElementById('"+span_name+"').style.visibility = 'hidden';");
}

function maximise(span_name) {
	eval("document.getElementById('"+span_name+"').style.display = 'block';");
	eval("document.getElementById('"+span_name+"').style.visibility = 'visible';");
}