<!--

/*#######################################################
#														#
#			TRIM SPACES FROM SIDES OF STRING			#
#														#
#######################################################*/

function trim(strText) {
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}


/*#######################################################
#														#
#				TRIM LINE BREAKS FROM STRING			#
#														#
#######################################################*/

function stripCR(str) {
var returnStr = replace(replace(str,'\r','*'),'\n','');
return returnStr;
}


/*#######################################################
#														#
# 				STANDARD REPLACE FUNCTION				#
#														#
#######################################################*/


function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}


/*#######################################################
#														#
#  FUNCTION TO KEEP SITE FROM BEING DISPLAYED IN FRAMES	#
#														#
#######################################################*/

function killFrames(){
if (parent.frames.length > 0) { parent.location.href = location.href; }
}

/*#######################################################
#														#
#  						 MOUSEOVERS						#
#														#
#######################################################*/

function hilite(oldi,newi){ document.images[oldi].src = newi; }



/*#######################################################
#														#
#				EMAIL VALIDATION FUNCTION				#
#														#
#######################################################*/


/* EMAIL VALIDATION */
function isEmail(obj,msg)
{
var testing = true;
var formField = obj.value;
var strLength = formField.length;
var ii = 1;
	if (formField.length <= '5') { testing = false; }
	else {	
	for (i = 0; i < formField.length; i++)
		{
        if (formField.indexOf(" ") != -1) { testing = false; }
		}
    while ((ii < strLength) && (formField.charAt(ii) != "@")) { ii++; }
    if ((ii >= strLength) || (formField.charAt(ii) != "@")) { testing = false; }
    else { ii += 2; }
    while ((ii < strLength) && (formField.charAt(ii) != ".")) { ii++; }
    if ((ii >= strLength - 2) || (formField.charAt(ii) != ".")) { testing = false; }
}
	if (testing == true) { return true; }
	else {
		if(testing == false) {
		alert(msg);
		obj.focus();
		return false;
		}
	}
}



/*#######################################################
#														#
#			GRAY TEMPORARY FORM TEXT FUNCTIONS			#
#														#
#######################################################*/

function clear_txt(obj,txt){
	if(obj.value==txt){
		obj.style.color = "#000000";
		obj.value="";
		obj.focus();
		return true;
	} else {
		obj.select();
		return false;
	}
}

function set_txt(obj,txt){
	if(obj.value==""){
		obj.style.color = "#a9a9a9";
		obj.value=txt;
		return true;
	} else { return false; }
}

function set_sel(obj){
	if(obj.value==""){
		obj.style.color = "#a9a9a9";
		return true;
	} else {
		obj.style.color = "#000000";
		return true;
	}
		
}


/*#######################################################
#														#
#		FUNCTIONS TO CLEAR TEMPORARY GRAY TEXT			#
#		 FROM NETWORK MEMBER REGISTRATION FORM			#
#														#
#######################################################*/

function clear_one(obj,txt){
	if(obj.value==txt){ obj.value=""; }
}

// SET FORM ITEMS TO BLANK ON SUCCESSFUL SUBMIT
function clear_all(frm){
	clear_one(frm.company,"< Company >");
	clear_one(frm.fname,"< First Name >");
	clear_one(frm.lname,"< Last Name >");
	clear_one(frm.addr1,"< Line 1 >");
	clear_one(frm.addr2,"< Line 2 >");
	clear_one(frm.city,"< City >");
	if(frm.state.value!=""&&frm.state.value=="< ST >"){
		clear_one(frm.state,"< ST >");
	}
	clear_one(frm.zip,"< Zip >");
	clear_one(frm.phone,"< Phone >");
	clear_one(frm.ext,"< Ext >");
	clear_one(frm.email,"< Email >");
	clear_one(frm.web,"< Web Site >");
}


/*#######################################################
#														#
#		VALIDATE NETWORK MEMBER REGISTRATION FORM		#
#														#
#######################################################*/

function validate_member(frm) {
	return(isBlank(frm.company,"Please enter your company name.",chr(60)+chr(32)+"Company"+chr(32)+chr(62)) &&
			isEmail(frm.email,"Please enter a valid email address.") &&
			isChecked(frm,frm.checkbox_list.value,"Please select at least one membership category."));
}
	
/*#######################################################
#														#
# FUNCTION ALLOWS ONLY CERTAIN CHARACTERS IN FORM FIELD	#
#														#
#######################################################*/

/* ALLOW ONLY CERTAIN CHARACTERS */
function limChars(obj,chars,exception){
	str=obj.value;
	if(obj.value!=exception){
		for(var i=0, output='', valid=chars; i<str.length; i++){
			if(valid.indexOf(str.charAt(i)) != -1){ output += str.charAt(i); }
		}
		return output;
	} else { return false; }
}


/*#######################################################
#														#
#  FUNCTION WILL CHECK / UNCHECK A CHECKBOX FORM ITEM	#
#														#
#######################################################*/

function check_it(obj){
	if(obj.checked==false){ obj.checked=true; }
	else if(obj.checked==true){ obj.checked=false; }
	else { return false; }
}


/*#######################################################
#														#
#		CHECK IF ONE OF MANY FORM ITEMS IS CHECKED		#
#														#
#######################################################*/

function isChecked(frm,item_list,msg){
	var list=item_list.split(",");
	var check=false;
	var item="";
	for(i=0;i<list.length;i++){
		item=eval("document."+frm.name+"."+list[i]+".checked");
		if(item==true){ check = true; }
	}
	if(check==false){
		alert(msg);
		return false;
	} else { return true; }
}


/*#######################################################
#														#
#				CHECK IF FORM FIELD IS BLANK			#
#														#
#######################################################*/

// WILL ALSO CHECK IF IT AN ALTERNATE VALUE TOO
// LEAVE alt BLANK IF NOT NEEDED
function isBlank(obj,msg,exception) {
	if(obj.value==""||obj.value==exception){
		obj.select();
		alert(msg);
		obj.select();
		return false;
	} else { return true; }
}


/*#######################################################
#														#
#		FUNCITONS TO TRANSLATE ASCII CHARACTERS			#
#														#
#######################################################*/

function asc(String){ return String.charCodeAt(0); }

function chr(AsciiNum){ return String.fromCharCode(AsciiNum); }


/*#######################################################
#														#
#						POPUP CODE						#
#														#
#######################################################*/

/* OFFSET POSITION FOR POPUP TEXT */
Xoffset= 20;    
Yoffset= -14;

/* REQUIRED BROWSER DETECTION VARAIBLES FOR POPUP TEXT */
var old,skn,iex=(document.all),yyy=-1000;
var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;


function set_popup(){
	if (ns4){ skn=document.popup_text; }
	else if(ns6){ skn=document.getElementById("popup_text").style; }
	else if(ie4){ skn=document.all.popup_text.style; }
	if(ns4){ document.captureEvents(Event.MOUSEMOVE); }
	else{
		skn.visibility="visible";
		skn.display="none";
	}
	
	/* TRACK MOUSE POSITION FOR POPUP TEXT*/
	document.onmousemove=get_mouse;
}

function popup(msg){
var content='<nobr><img src=\"'+img_path+'adobe_icon_big.gif\" width=\"43\" height=\"44\" vspace=/"0/" hspace=/"0/" alt=\"\" border=\"0\" id=/"adobe_big/"><div id="popup_box">'+msg+'</div></nobr>';
yyy=Yoffset;
 if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
 if(ns6){document.getElementById("popup_text").innerHTML=content;skn.display=''}
 if(ie4){document.all("popup_text").innerHTML=content;skn.display=''}
}

function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}

function popout(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
skn.display="none"
}


/*#######################################################
#														#
#					ROTATING ADS CODE					#
#														#
#######################################################*/

function set_link(place,ad_url){
	document.getElementById(place).href=ad_url;
	if(ad_url!="javascript: return false;"){
		document.getElementById(place).target="_blank";
	} else {
		document.getElementById(place).target="_top";
	}
}

/* AD ROTATION FUNCTION */
function rotate_ad(place,interval) {
	if(typeof( window['ad_list'])!="undefined"){
		/* SET DEFAULT AD ROTATION INTERVAL */
		if(typeof( window['interval'])=="undefined"){ interval = 13; }
		if(typeof( window['ad_index'])=="undefined"){ ad_index = ad_list.length-1; }
		if(ad_index<ad_list.length-1){ ad_index++; }
		else { ad_index=0; }
		var new_ad = ad_list[ad_index][0];
		document[place].src = new_ad;
		if(ad_list[ad_index][1]!=""){
			set_link(place+"_url","http://"+ad_list[ad_index][1]);
		} else {
			set_link(place+"_url","javascript: return false;");
		}
		var recur_call = "rotate_ad('"+place+"',"+interval+")";
		setTimeout(recur_call, interval*1000);
	}
}

// -->

