
var thisMenu = new Object;
var theTimer;

function showMenu(menuName){

if (thisMenu.id != null){
	clearMenu();
}
if (theTimer != null){
clearTimeout(theTimer);
}

theMenu = new Object;
theMenu = eval("document.getElementById('" + menuName + "')");

theMenu.style.visibility = "visible";

}

function loadParent(theUrl){

	if (top.opener != null){
		top.opener.location.href = theUrl;
		opener.focus();
	}else{
		
		popWin(theUrl);
	}
	


}


function preloadImages(){

}


function tost(){

	
	return confirm("By clicking 'OK' and subscribing to The Beat, you acknowledge that content contained in The Beat ~ a travel business newsletter, is protected by copyright, and that it is illegal under U.S. federal law to copy, fax or electronically distribute copyrighted material. This includes email forwarding.","I Agree","I Disagree");
	

}

function tos(){
	
	 
	if (confirm("By clicking 'OK' and subscribing to The Beat, you acknowledge that content contained in The Beat ~ a travel business newsletter, is protected by copyright, and that it is illegal under U.S. federal law to copy, fax or electronically distribute copyrighted material. This includes email forwarding.","I Agree","I Disagree")){
	
	
	return true;
		/*
		emailCatch();	
		*/
		
		
		
	}else{
	
	return false;
	
	}

}


function emailCatch(){

response = 	prompt("Please enter an administrative email address to subscribe under. You will be able to add a total of 10 recipient addresses once you subscribe.");
		
		if (response){
		
		return true;
			
		}else{
			if (response == ""){
				if (confirm("You must enter a recipient email address in order to subscribe to The Beat")){
					
					emailCatch();
				
				}else{
				
				return false;
				
				}
			}

		}


}

function archiveListing(sel)
{
	for (j=0; j<sel.options.length; j++) {
		if (sel.options[j].selected) {
		  window.location.href = "/archives.php?pid=checkuser&index=" + sel.options[j].value;
		  return;
			}
		}
}

/*
function archiveListing(dir){

location.href= "/archives.php?pid=checkuser&index=" + dir;

}
*/

function validateEmail(address,tos){

	if (address.length > 80){
	alert("The email address you entered contains too many characters. Please choose an email address with fewer characters.  Thank You.");
	return false;
	}


pattern = /^[\._'\-\w]+@[_'\-\w]+\.([\._'\-\w]+\.)?([a-z]{2,6})$/i;

result = address.match(pattern);

	if (result){

		if (tos){
		tres = tost();

		return tres;
		}else{
		
		return true;
		
		}
	
	}else{
	
	alert("The email address you entered is NOT valid, please check your entry for errors and try again.");
	return false;
	
	}
}

function checkPasswd(pwd1,pwd2){

	if (pwd1.length < 6){
		alert("Please choose a password that is at least 6 characters long");
		return false;
	}else{
	
		pattern = /^([a-zA-Z0-9_]+)$/i;

		result = pwd1.match(pattern);

		if (!result){
		
			alert("Please use only alphanumeric characters in your password");
			return false;
			
		}else{
		
			if (pwd1 == pwd2){
			
			return true;
			
			}else{
			
			alert("Your password entries did not match.  Please reenter the password and password confirm fields and try again.");
			
			return false;
			
			}
			
		}
		
	}

}


var ie = (document.all) ? true : false;

function txtsize(pixels){


divArray = new Array("newscopy","newsdate","author");
classArray = new Array("contentlink");
elementArray = new Array("h1");


var min=11;
var max=18;
var defaultfont = 14;
var defaultlineheight = 21;
var defaulttitle = 23;
var currentfontsize;


	
   var p = document.getElementsByTagName('A');
   
   //alert (p[0][0].parentNode.parentNode);
   
   /*
   for(i=0;i<p.length;i++) {
   
   if (p[i].indexOf('DIV') != -1){
   
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = defaultfont;
      }
      if(s!=max) {
         s += pixels;
      }
      p[i].style.fontSize = s+"px";
      p[i].style.lineHeight = (s+7)+"px";
      
    }
    
   }
   */
   
   

   

   divs = '';
   
    theDiv = new Object();

   for(i=0;i<divArray.length;i++){
    theDivName = divArray[i];
    
   	theDiv = document.getElementById(theDivName);
   	
      if(theDiv.style.fontSize) {
         var s = parseInt(theDiv.style.fontSize.replace("px",""));
      } else {
         var s = defaultfont;
      }
      currentsize = s;
      if(pixels > 0) {
      	document.getElementById('textminus').src = "/images/bttn-txtminus-1.gif";
      	if (s!=max){
         s += pixels;
         }
		  if(s!=max){
			 document.getElementById('textplus').src = "/images/bttn-txtplus-1.gif";	
		  }else{
			 document.getElementById('textplus').src = "/images/bttn-txtplus-0.gif";
		  }
      }else{
      	document.getElementById('textplus').src = "/images/bttn-txtplus-1.gif";
      	if (s!=min){
         s += pixels;
		}
		  if(s!=min){
			 document.getElementById('textminus').src = "/images/bttn-txtminus-1.gif";	
		  }else{
			 document.getElementById('textminus').src = "/images/bttn-txtminus-0.gif";
		  }

      }
      
      
      theDiv.style.fontSize = s+"px";
      theDiv.style.lineHeight = (s+8)+"px";

   }
  
	
	/*
   for(i=0;i<=classArray.length;i++){
    theClassName = classArray[i];
    setStyleByClass('A',null,'fontSize',document.getElementById('newscopy').style.fontSize);
	setStyleByClass('A',null,'lineHeight',document.getElementById('newscopy').style.lineHeight);
	}
	*/
}



// setStyleByClass: given an element type and a class selector,
// style property and value, apply the style.
// args:
//  t - type of tag to check for (e.g., SPAN)
//  c - class name
//  p - CSS property
//  v - value


function setStyleByClass(t,c,p,v){
	var elements;
	if(t == '*') {
		// '*' not supported by IE/Win 5.5 and below
		elements = (ie) ? document.all : document.getElementsByTagName('*');
	} else {
		elements = document.getElementsByTagName(t);
	}
	for(var i = 0; i < elements.length; i++){
		var node = elements.item(i);
		for(var j = 0; j < node.attributes.length; j++) {
			if(node.attributes.item(j).nodeName == 'class') {
				if(node.attributes.item(j).nodeValue == c) {
					eval('node.style.' + p + " = '" +v + "'");
				}
			}
		}
	}
}

// getStyleByClass: given an element type, a class selector and a property,
// return the value of the property for that element type.
// args:
//  t - element type
//  c - class identifier
//  p - CSS property
function getStyleByClass(t, c, p) {
	// first loop over elements, because if they've been modified they
	// will contain style data more recent than that in the stylesheet
	var elements;
	if(t == '*') {
		// '*' not supported by IE/Win 5.5 and below
		elements = (ie) ? document.all : document.getElementsByTagName('*');
	} else {
		elements = document.getElementsByTagName(t);
	}
	for(var i = 0; i < elements.length; i++){
		var node = elements.item(i);
		for(var j = 0; j < node.attributes.length; j++) {
			if(node.attributes.item(j).nodeName == 'class') {
				if(node.attributes.item(j).nodeValue == c) {
					var theStyle = eval('node.style.' + p);
					if((theStyle != "") && (theStyle != null)) {
						return theStyle;
					}
				}
			}
		}		
	}
	// if we got here it's because we didn't find anything
	// try styleSheets
	var sheets = document.styleSheets;
	if(sheets.length > 0) {
		// loop over each sheet
		for(var x = 0; x < sheets.length; x++) {
			// grab stylesheet rules
			var rules = sheets[x].cssRules;
			if(rules.length > 0) {
				// check each rule
				for(var y = 0; y < rules.length; y++) {
					var z = rules[y].style;
					// selectorText broken in NS 6/Mozilla: see
					// http://bugzilla.mozilla.org/show_bug.cgi?id=51944
					ugly_selectorText_workaround();
					if(allStyleRules) {
						if((allStyleRules[y] == c) ||
						   (allStyleRules[y] == (t + "." + c))) {
							return z[p];
						}			
					} else {
						// use the native selectorText and style stuff
						if(((z[p] != "") && (z[p] != null)) &&
						   ((rules[y].selectorText == c) ||
						    (rules[y].selectorText == (t + "." + c)))) {
							return z[p];
						}
					}
				}
			}
		}
	}

	return null;
}





