
	function trim(value) {
	  return value.replace(/^\s+/g, '').replace(/\s+$/g, '');
	}

	function isEmpty(value) {
		value = trim(value);
		if (value == "")
			return true;
		return false;
	}

	function isEmail(value){
		var re = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;
		value = trim(value);
		if(value.match(re))
			return true;
		return false;
	}

	function toggleLayer(id) {
		style = document.getElementById(id).style;
		style.display = (style.display == "" || style.display == "none") ? "block" : "none";
	}


	function capitalize(element) {
    if (trim(element.value) == "")
      return "";
		pieces = element.value.split(" ");
		str = "";
		for (piece in pieces)
			str = str + " " + pieces[piece][0].toUpperCase() + pieces[piece].slice(1,pieces[piece].length).toLowerCase();
		return trim(str);
	}

	function lowerCase(element) {
		return element.value.toLowerCase();
	}

	function pageScroll(y) {
		if (typeof y == "undefined")
			y = 100;
		window.scrollBy(0,y); // x,y
	}

	function popitup(content) {
		newwindow=window.open('','name','height=400,width=400');
		var tmp = newwindow.document;
		tmp.write(content);
		tmp.close();
	}

  function popupWindow(href, w, h) {
    window.open(href,'','resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width='+w+',height='+h+',status');
    return false;
  }
