function select_set_value (object, value) {
	if (!object.length && object.value==value) object.selected=true;
	for (var i=0; i<object.length; i++) {
		if (object[i].value==value) {
			object[i].selected=true;
			break } } }

function radio_set_value (object, value) {
	if (!object.length && object.value==value) object.checked=true;
	for (var i=0; i<object.length; i++) {
		if (object[i].value==value) {
			object[i].checked=true;
			break;
		}
	}
}

function checkbox_set_value (object, value) {
	if (!value) object.checked=true;
	if (!object.length && object.value==value) object.checked=true;
	for (var i=0; i<object.length; i++) {
		if (object[i].value==value) {
			object[i].checked=true;
		}
	}
}

function checkbox_disabled (object, disabled) {
	if (!value) object.disabled=disabled;
	if (!object.length && object.value==value) object.disabled=disabled;
	for (var i=0; i<object.length; i++) {
		object[i].disabled=disabled;
	}
}

function resizeElement(id, w, h) {
	document.getElementById(id).style.width=w;
	document.getElementById(id).style.height=h;
}

function window_pop_up (location, name, width, height) {

	winPop = window.open(location, name, 'width=' + width + ', height=' + height + ', toolbar=0, resizable=0, status=0');

	winPop.focus();

}

function setCookie(name, value, expire) {
          document.cookie = name + "=" + escape(value)
          + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function getCookie(Name) {
          var search = Name + "="
          if (document.cookie.length > 0) { // if there are any cookies
                    offset = document.cookie.indexOf(search)
                    if (offset != -1) { // if cookie exists
                              offset += search.length
                              // set index of beginning of value
                              end = document.cookie.indexOf(";", offset)
                              // set index of end of cookie value
                              if (end == -1)
                                        end = document.cookie.length
                              return unescape(document.cookie.substring(offset, end))
                    }
          }
}

function jump_select( select ) {
    if (select.options[select.selectedIndex].value != '') { 
        window.location = select.options[select.selectedIndex].value;
    }
}

function toggleItem(id)
{
    itm = document.getElementById(id);

    if(!itm)
    {
        return false;
    }

    if(itm.style.display == 'none')
        itm.style.display = '';
    else
        itm.style.display = 'none';
    
    return false;
}

function changeTab(anchor){
    
    var tabbox = anchor;
    var target;

    while(tabbox != null && (tabbox.className == null || tabbox.className.indexOf("tabbox") == -1)){
        tabbox = tabbox.parentNode;

        if(tabbox.className.indexOf("tabname") != -1)
        {
            target = tabbox.parentNode;
        }
    }
    if(tabbox == null || target == null){
        return false;
    }
                
    
    var tag;
    for(var i = 0; i < tabbox.childNodes.length; i++){
        tag = tabbox.childNodes[i];
        
        if(tag.nodeName.toLowerCase() == "div" && tag.className != null && tag.className.indexOf("selected") > -1){
            tag.className = tag.className.replace("selected", "");
            break;
        }
    }
    
    if(target != null){
        target.className = (target.className || "") +" selected";
    }
    
    return false;
}

function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
        node = document;
    if ( tag == null )
        tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}

function include_dom() {
    var args = Array.prototype.slice.apply(arguments);
    var script_filename = args[0];

    if( args.length > 1 ) {
        include_queue_add.apply( null, args );
    }
	
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
	js.setAttribute('language', 'javascript');
	js.setAttribute('type', 'text/javascript');
	js.setAttribute('src', script_filename);


    js.onload = function() { // Firefox
        var script = included_files[include_queue_find(script_filename)];
        script.loaded = true;
        include_queue_run( script_filename );
    }

    js.onreadystatechange = function () { // IE
        if ( (js.readyState == 'complete') || (js.readyState == 'loaded')) {
            var script = included_files[include_queue_find(script_filename)];
            script.loaded = true;
            include_queue_run( script_filename );
        }
    }

    if( /webkit/.test(navigator.userAgent.toLowerCase()) ) {
        var safariTimer = setInterval( function() {
            if ( document.readyState == "loaded" || document.readyState == "complete" ) {
				
                // If either one are found, remove the timer
                clearInterval( safariTimer );
                safariTimer = null;
				
                // and execute any waiting functions
                var script = included_files[include_queue_find(script_filename)];
                script.loaded = true;
                include_queue_run( script_filename );
            } 
        }, 10 );
    }

    html_doc.appendChild(js);


    return false;
}

function include_once() {
    var args = Array.prototype.slice.apply(arguments);
    var script_filename = args[0];
    var script = included_files[include_queue_find(script_filename)];

    if( ! script ) {
        var script = new Object;
        script.filename = script_filename;
        script.queue = new Array();
        script.loaded = false;

        included_files[included_files.length] = script;
        include_queue_add.apply(null,args);
        include_dom(script_filename);
    }
    else {
        if( script.loaded ) {
            args[1].apply( null, args.slice(2) );
        }
        else {
            include_queue_add.apply(null,args);
        }
    }

}

var included_files = new Array();

function include_queue_add() {
    var args = Array.prototype.slice.apply(arguments);
    var script_filename = args[0];

    if( args.length ) {

        var script = included_files[include_queue_find(script_filename)];

        var funcs = script.queue;

        funcs.push( args.slice(1) );
    }

}
    
function include_queue_run(script_filename) {

    var script = included_files[include_queue_find(script_filename)];

    var funcs = script.queue;

    while( funcs.length ) {
        var func_call;
        func_call = funcs.pop(); // Funcs is an array of arrays, func_pointer followed by arguments for each entry
        var func = func_call[0];
        var args = func_call.slice(1);

        func.apply( null, func_call.slice(1) )
    }

}

function include_queue_find( script_filename ) {
    for (var i = 0; i < included_files.length; i++) {
        if (included_files[i].filename == script_filename) {
            return i;
        }
    }
    return false;
}

function unique(a) {
    tmp = new Array(0);
    for(i=0;i<a.length;i++){
        if(!contains(tmp, a[i])){
            tmp.length+=1;
            tmp[tmp.length-1]=a[i];
        }
    }
    return tmp;
}

function contains(a, e) {
    for(j=0;j<a.length;j++)if(a[j]==e)return true;
    return false;
}

function flash_adv (movie, width, height, align, name, id, quality, wmode, bgcolor, loop){
	flash(movie, width, height, window.location.protocol + '//www.macromedia.com/go/getflashplayer', align, name, id, quality, wmode, bgcolor, loop);
}

if(!flash_bar_created) var flash_bar_created = false;

function create_get_flash_bar(){
    include_once('/js/swfobject.js',
        function () {
			var so = new SWFObject(undefined, undefined, undefined, undefined, 8);
			
			if((flash_bar_created!=true) && !so.installedVer.versionIsValid(so.getAttribute('version'))){
				var body = document.getElementsByTagName("body")[0];
				var div = document.createElement('div');
				div.style.backgroundColor = '#FFFFE1';
				div.style.position = 'absolute';
				div.style.zIndex = '999';
				div.style.top = '0px';
				div.style.left = '0px';
				div.style.width = body.clientWidth;
				div.style.borderBottomStyle = 'ridge';
				div.style.fontFamily = 'Tahoma, sans-serif';
				div.style.color = "#000000";
				div.style.fontSize = '9pt';
				if ( window.location.protocol == 'http:' ) {
				div.innerHTML = '<a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="" border="0" align="left" style="padding: 10px"></a>' +
								'<div style="padding: 10px;"> This website requires the latest <a href="http://www.adobe.com/go/getflashplayer">Adobe Flash Player</a>.</div>';
				}
				if ( window.location.protocol == 'https:' ) {
				div.innerHTML = '<a href="https://www.adobe.com/go/getflashplayer"><img src="https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="" border="0" align="left" style="padding: 10px"></a>' +
								'<div style="padding: 10px;"> This website requires the latest <a href="https://www.adobe.com/go/getflashplayer"">Adobe Flash Player</a>.</div>';
				}
				body.insertBefore( div, body.firstChild );
				flash_bar_created = true
			}
		}
	);
}

if(!flash_inc) var flash_inc = 0;

function flash(movie, width, height, pluginspage, align, name, id, quality, wmode, bgcolor, loop, classname){
    flash_inc = flash_inc + 1;
    var span_id = 'flash_' + flash_inc;
    document.write('<span align="center" id="' + span_id + '" style="visibility:hidden" width="' + width + '" height:"' + height + '"></span>');
	
    include_once('/js/swfobject.js',
        function () {
            var span = document.getElementById(span_id);
            span.style.visibility = 'visible';
            var so = new SWFObject(movie, span_id, width, height, '8');
			if(pluginspage) so.addParam("pluginspage", pluginspage);
			if(align) so.addParam("align", align);
			if(name) so.addParam("name", name);
			if(id) so.addParam("id", id);
			if(quality) so.addParam("quality", quality);
			if(wmode){
				so.addParam("wmode", wmode);
			}else{
				so.addParam("wmode", "transparent");
			}
			if(bgcolor) so.addParam("bgcolor", bgcolor);
			if(loop) so.addParam("loop", loop);
			if(classname) so.addParam("classname", classname);
			so.write(span_id);
			
			create_get_flash_bar()
		}
	);
}

document.write('<img style="visibility:hidden; position:absolute;" onerror="javascript:create_get_flash_bar();" />');
document.write('<script src="/js/create_get_flash_bar.js"></script>');

function clearAuth() {
try{
  var agt=navigator.userAgent.toLowerCase();
  if (agt.indexOf("msie") != -1) {
    // IE clear HTTP Authentication
    document.execCommand("ClearAuthenticationCache");
  } 
  else {
    var xmlhttp = createXMLObject();
    xmlhttp.open("GET","#",true,"logout","");
    xmlhttp.send("");
    xmlhttp.abort();
  }
} catch(e) {
// There was an error
}
}

function createXMLObject() {
    try {
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        }
        // code for IE
        else if (window.ActiveXObject) {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    } catch (e) {
        xmlhttp=false
    }
    return xmlhttp;
}

function logout(url) {
	clearAuth();
	window.location=url;
}
//------------------------------------------------------------------------------------
<!--
	// This file contains the data validation JavaScript functions
	// It is included in the HTML pages with forms that need these
	// data validation routines.


// DEFINE VARIABLES

// whitespace characters
var whitespace = " \t\n\r";



/****************************************************************/

// PURPOSE:  Check to see if the string passed in is a valid time.
//	A valid time is defined as a string which is postfixed with either
//  "PM" or "AM".  Next it checks to see if there is a colon in the
//  string.  If there is, it makes sure that at least one digit preceeds
//  it and two proceed it.

	function IsTime(strTime)
	{
		var strTestTime = new String(strTime);
		strTestTime.toUpperCase();

		var bolTime = false;

		if (strTestTime.indexOf("PM",1) != -1 || strTestTime.indexOf("AM",1))
			bolTime = true;

		if (bolTime && strTestTime.indexOf(":",0) == 0)
			bolTime = false;

		var nColonPlace = strTestTime.indexOf(":",1);
		if (bolTime && ((parseInt(nColonPlace) + 5) < (strTestTime.length - 1) || (parseInt(nColonPlace) + 4) > (strTestTime.length - 1)))
			bolTime = false;


		return bolTime;
	}

/****************************************************************/

function replaceAll (s, fromStr, toStr)
{
	var new_s = s;
	for (i = 0; i < 100 && new_s.indexOf (fromStr) != -1; i++)
	{
		new_s = new_s.replace (fromStr, toStr);
	}
	return new_s;
}

/****************************************************************/

/* PURPOSE:  Since we are using the single tick mark as the
	string delimiter to construct our SQL queries, a string with
	a tick mark in it will cause a SQL error.  Therefore we replace
	all "'" with "''", which eliminates the possibility of a SQL error.
*/

function sqlSafe (s)
{
	var new_s = s;
	new_s = replaceAll (new_s, "'", "|");
	new_s = replaceAll (new_s, "|", "''");
	new_s = replaceAll (new_s, "\"", "|");
	new_s = replaceAll (new_s, "|", "''");
	return new_s;
}

/****************************************************************/

function makeSafe (i)
{
	i.value = sqlSafe (i.value);
}

/****************************************************************/

// Check whether string s is empty.

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

/****************************************************************/

// Returns true if string s is empty or 
// whitespace characters only.

function isWhitespace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
	// Check that current character isn't whitespace.
	var c = s.charAt(i);

	if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

/****************************************************************/

// isEmail (STRING s [, BOOLEAN emptyOK])
// 
// Email address must be of form a@b.c ... in other words:
// * there must be at least one character before the @
// * there must be at least one character before and after the .
// * the characters @ and . are both required
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function isEmail (s)
{   if (isEmpty(s)) 
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);
   
    // is s whitespace?
    if (isWhitespace(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))


    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}
function isPhone(s)
{
  var phoneNum = new String(s);
   
  var regExpObj = /\d\d\d-\d\d\d-\d\d\d\d/;
   
  if(regExpObj.exec(phoneNum) == null)
  {
    return false;
  }
  else
  {
    return true;
  }
}

function isDate(s)
{
  var datenum = new String(s);
   
  var regExpObj = /\d\d\/\d\d\/\d\d\d\d/;
   
  if(regExpObj.exec(datenum) == null)
  {
    return false;
  }
  else
  {
    return true;
  }
}



function validatecontact()
{
	if(isEmpty(document.TheForm.FirstName.value))
	{
		alert("Please fill out required field: First Name");
		document.TheForm.FirstName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.LastName.value))
	{
		alert("Please fill out the required field: Last Name");
		document.TheForm.LastName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.EmailFrom.value))
	{
		alert("Please fill out required field: Email");
		document.TheForm.EmailFrom.focus();
		return false;
	}
	return true;
}

function validatemailinglist()
{
	if(isEmpty(document.TheForm.FirstName.value))
	{
		alert("Please fill out required field: First Name");
		document.TheForm.FirstName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.LastName.value))
	{
		alert("Please fill out the required field: Last Name");
		document.TheForm.LastName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.EmailFrom.value))
	{
		alert("Please fill out required field: Email");
		document.TheForm.EmailFrom.focus();
		return false;
	}
	if(isEmpty(document.TheForm.Birthday.value))
	{
		alert("Please fill out required field: Birthday in format MM/DD/YYYY");
		document.TheForm.Birthday.focus();
		return false;
	}
	if(!isDate(document.TheForm.Birthday.value))
	{
		alert("Please fill out required field: Birthday in format MM/DD/YYYY");
		document.TheForm.Birthday.focus();
		return false;
	}
}
function validatepcjoin()
{
	if(isEmpty(document.TheForm.FirstName.value))
	{
		alert("Please fill out required field: First Name");
		document.TheForm.FirstName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.LastName.value))
	{
		alert("Please fill out the required field: Last Name");
		document.TheForm.LastName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.Address.value))
	{
		alert("Please fill out required field: Address");
		document.TheForm.Address.focus();
		return false;
	}
	if(isEmpty(document.TheForm.City.value))
	{
		alert("Please fill out required field: City");
		document.TheForm.City.focus();
		return false;
	}
	if(isEmpty(document.TheForm.State.value))
	{
		alert("Please fill out required field: State");
		document.TheForm.State.focus();
		return false;
	}
	if(isEmpty(document.TheForm.Zip.value))
	{
		alert("Please fill out required field: Zip");
		document.TheForm.Zip.focus();
		return false;
	}
	if(isEmpty(document.TheForm.Phone.value))
	{
		alert("Please fill out required field: Phone (###-###-####)");
		document.TheForm.Phone.focus();
		return false;
	}
	if(!isPhone(document.TheForm.Phone.value))
	{
		alert("Please fill out the required field: Phone (###-###-####)");
		document.TheForm.Phone.focus();
		return false;
	}
	if(!isEmpty(document.TheForm.Fax.value))
	{
		if(!isPhone(document.TheForm.Fax.value))
		{
			alert("Please fill out field Fax in format (###-###-####)");
			document.TheForm.Fax.focus();
			return false;
		}
	}
	if(isEmpty(document.TheForm.Birthday.value))
	{
		alert("Please fill out required field: Birthday");
		document.TheForm.Birthday.focus();
		return false;
	}
	if(!isDate(document.TheForm.Birthday.value))
	{
		alert("Please fill out required field: Birthday (MM-DD-YYYY)");
		document.TheForm.Birthday.focus();
		return false;
	}
	if(!isEmpty(document.TheForm.SecondBirthday.value))
	{
		if(!isDate(document.TheForm.SecondBirthday.value))
		{
			alert("Please fill out field Second Birthday with format (MM-DD-YYYY)");
			document.TheForm.SecondBirthday.focus();
			return false;
		}
	}
	if(!isEmpty(document.TheForm.Anniversary.value))
	{
		if(!isDate(document.TheForm.Anniversary.value))
		{
			alert("Please fill out field Anniversary with format (MM-DD-YYYY)");
			document.TheForm.Anniversary.focus();
			return false;
		}
	}
	if(isEmpty(document.TheForm.EmailFrom.value))
	{
		alert("Please fill out required field: Email");
		document.TheForm.EmailFrom.focus();
		return false;
	}

	return true;
}

function validategroup()
{
	if(isEmpty(document.TheForm.FirstName.value))
	{
		alert("Please fill out required field: First Name");
		document.TheForm.FirstName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.LastName.value))
	{
		alert("Please fill out the required field: Last Name");
		document.TheForm.LastName.focus();
		return false;
	}
	if(isEmpty(document.TheForm.EmailFrom.value))
	{
		alert("Please fill out required field: Email");
		document.TheForm.EmailFrom.focus();
		return false;
	}
	return true;
}
// -->
