
var state = 'none';
function showhide(divname) {
	if (state == 'none') state = 'block';
	// else state = 'none';
	if (document.all) eval("document.all." + divname + ".style.display = state");
	if (document.layers) document.layers[divname].display = state;
	if (document.getElementById && !document.all) 
		document.getElementById(divname).style.display = state;
}
function nosticky(divname) {
	if (state == 'block') state = 'none';
	if (document.all) eval("document.all." + divname + ".style.display = state");
	if (document.layers) document.layers[divname].display = state;
	if (document.getElementById && !document.all) 
		document.getElementById(divname).style.display = state;
}
function getList(field)
{
    var location = field.options[field.options.selectedIndex].value;
	var sources = document.forms['thickbox_form'].elements['referral'];
    if (sources)
	{
        var cnt = 0;
        sources.options.length = 0;

		switch (location) {

		case '1':

            sources.options[sources.options.length] = new Option('Select:','',true,true);
			//sources.options[sources.options.length] = new Option("Referred by a Friend","Referral");
        cnt++;
			<?php GetAllRes("raleigh"); ?>
			break;

        case '2':

            sources.options[sources.options.length] = new Option('Select:','',true,true);
			// sources.options[sources.options.length] = new Option("Referred by a Friend","Referral");
        cnt++;
			<?php GetAllRes("dallas"); ?>
			break;

		default:
            break;
        }
    }
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/*  E-MAIL VALIDATION FUNCTION
Every email is made up for 5 parts:

   1. A combination of letters, numbers, periods, hyphens, plus signs, and/or underscores
   2. The at symbol @
   3. A combination of letters, numbers, hyphens, and/or periods
   4. A period
   5. The top level domain (com, net, org, us, gov, ...)

Valid Examples:

    * bobby.jo@filltank.net
    * jack+jill@hill.com
    * the-stand@steven.king.com

Invalid Examples:

    * @deleted.net - no characters before the @
    * free!dom@bravehe.art - invalid character !
    * shoes@need_shining.com - underscores are not allowed in the domain name

The regular expression to check for all of this is a little overkill and beyond the scope of this tutorial to explain thoroughly. However, test it out and you'll see that it gets the job done.

*/
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}
