

function popIt(theFile,wName,windowW,windowH,scrolling){


//alert(theFile + ', ' +wName + ', ' + windowW + ', ' + windowH + ', ' + scrolling);


	popLeft = 50;
    popTop = 50;
    
   
	
    if (wName == null)
    {
        wName = 'pop';
    }
    if (scrolling == null){
    scrolling = "auto";
    }
    

    var popWindow = window.open(theFile,'pricewin','width='+windowW+',height='+windowH+',top='+popTop+',left='+popLeft+',scrollbars='+scrolling+',statusbar=no,toolbar=no,resizable=yes');
	popWindow.focus();
	
}



function loadParent(theUrl){

	if (top.opener != null){
		top.opener.location.href = theUrl;
		opener.focus();
	}else{
		
		popWin(theUrl);
	}
	
}


function preloadImages(){

}

fLoaded = false;


function loadF(showbox){
f1off = new Image();
f1on = new Image();
f2off = new Image();
f2on = new Image();
f1off.src = "/images/bttn-email-article-0.gif";
f1on.src = "/images/bttn-email-article-1.gif";
f2off.src = "/images/bttn-print-friendly-0.gif";
f2on.src = "/images/bttn-print-friendly-1.gif";
fLoaded = true;

if (showbox){
emailBox();
fon(1);
}


}

boxOn = false;

function emailBox(){

boxOn = true;

boxleft = document.getElementById('mailbox').offsetLeft;
boxtop = document.getElementById('mailbox').offsetTop;
boxtop += 22;

document.getElementById('mailform').style.left =  boxleft + "px";
document.getElementById('mailform').style.top =  boxtop + "px";
}


function emailBoxIssue(mode){

if (mode == 1){
boxleft = document.getElementById('mailbox').offsetLeft;
boxtop = document.getElementById('mailbox').offsetTop;
boxleft += 175;
boxtop += 95;
document.getElementById('mailform').style.left =  boxleft + "px";
document.getElementById('mailform').style.top =  boxtop + "px";
}else if (mode == 2){
boxleft = document.getElementById('issuebutton').offsetLeft;
boxleft += 199;
boxtop = document.getElementById('issuebutton').offsetTop;
boxtop -= 60;
document.getElementById('mailform').style.left =  boxleft + "px";
document.getElementById('mailform').style.top =  boxtop + "px";
}

}

function imail(boxvalue){
	if (boxvalue){
	emailBoxIssue(1);
	}
}


function closemail(theBttn){
boxOn = false;
if (theBttn == 'i'){
ioff(1);
}else{
foff(1);
}
document.getElementById('mailform').style.left =  "0px";
document.getElementById('mailform').style.top =  "-300px";
}



i1off = new Image();
i1on = new Image();
i1off.src = "/images/bttn-email-issue-0.gif";
i1on.src = "/images/bttn-email-issue-1.gif";

function ion(i) {
		imgTag = "i" + i;
		document.getElementById(imgTag).src = eval(imgTag + "on.src");
		return;
}
function ioff(i) {
		imgTag = "i" + i;
		document.getElementById(imgTag).src = eval(imgTag + "off.src");
		return;
}


function fon(i) {
		
		if(fLoaded){
		imgTag = "f" + i;
		document.getElementById(imgTag).src = eval(imgTag + "on.src");
		return;
		}
		
}

function foff(i) {

	if(fLoaded){
		if (i != 1){
		imgTag = "f" + i;
		document.getElementById(imgTag).src = eval(imgTag + "off.src");
		return;	
		}else{
			if (!boxOn){
			imgTag = "f" + i;
			document.getElementById(imgTag).src = eval(imgTag + "off.src");
			return;	
			}
		}
	}
			
}



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 jump2issue(sel)
{
	for (j=0; j<sel.options.length; j++) {
		if (sel.options[j].selected) {
		  window.location.href = "/show-issue.php?isid=" + sel.options[j].value;
		  return;
			}
		}
}

/*
function archiveListing(dir){

location.href= "/archives.php?pid=checkuser&index=" + dir;

}
*/


function validateSubEmail(address){

	if (address.length > 50){
		alert("The email address you entered contains too many characters. Please choose a sending email address with fewer characters.  Thank You.");
		return false;
	}

pattern = /^[\._'\-\w]+@[_'\-\w]+\.([\._'\-\w]+\.)?([a-z]{2,6})$/i;

result = address.match(pattern);

	if (result){
		procMssg();
		return true;
	}else{
		alert("The email address you entered appears to be INVALID. Please check your entry for errors and try again.");
		return false;
	}
	
}


function validateEmail(address,whomail){

	if (address.length > 50){
		if (!whomail){
		alert("The sender's email address contains too many characters. Please choose a sending email address with fewer characters.  Thank You.");
		}else{
		alert("One of the email addresses you are sending to contains too many characters. Please choose a recipient email address with fewer characters.  Thank You.");
		}
		return false;
	}


pattern = /^[\._'\-\w]+@[_'\-\w]+\.([\._'\-\w]+\.)?([a-z]{2,6})$/i;

result = address.match(pattern);

	if (result){

		return true;

	}else{
	
		if (!whomail){
		alert("The sender's email address appears to be INVALID. Please check your entry for errors and try again.");
		}else{
		alert("One or more of the recipient email addresses appears to be INVALID. Please check your entries 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;
			
			}
			
		}
		
	}

	

}

lastSlog = 1;

function sloggle(slogId){

newSlog = new Object;
oldSlog = new Object;

newSlog = eval("document.getElementById('slog"+slogId+"')");
oldSlog = eval("document.getElementById('slog"+lastSlog+"')");

oldSlog.style.display = "none";
newSlog.style.display = "block";

lastSlog = slogId;

}


function setResultsString(theResultString){

	if(theResultString){
		document.getElementById('resultstringdiv').innerHTML = theResultString;
	}
	
}

function mssg(message,destinationUrl){

alert(message);

location.href = destinationUrl;

}

badcharsArray1 = new Array('!','@','`','~','#','$','%','^','&','*','(',')','+','=',':',';','"','?','/','\\','{','}','[',']',',','<','>');
badcharsArray2 = new Array('@','`','~','#','$','%','^','&','*','(',')','+','=',';','/','\\','{','}','[',']','<','>');

ok = true;

function validateForm(theForm){

	
	if (validateEmail(theForm.frommail.value,0)){
	
		emailArray = new Array();
		emailArray = theForm.tomail.value.split(',');
				
		
		if (emailArray.length > 5){
			alert("You have specified more than 5 recipients for this issue.  Please enter a maximum of 5 recipients.  Thank you.");
			ok = false;
		}else{
		
			for (e = 0; e < emailArray.length; e++){
				
				if (!validateEmail(emailArray[e],1)){				
					ok = false;
				}
			}

			
		}
		
	}else{
	
	ok = false;
	}
	
	if (ok){
	
		if (noBadChars(theForm.comments.value,badcharsArray2)){
		
			return true;
			
		}else{
		
			alert("The comments you entered contain characters that are not permitted in this form. Please use alphanumeric characters and basic punctuation only.");
			return false;
			
		}
	
	}else{
	
		ok = true;
	
		return false;

	}


}


function noBadChars(theString,theArray){
	
	if (theString != ''){
		
		for (s = 0; s < theArray.length; s++){
			
			if(theString.indexOf(theArray[s]) != -1){				
	
				return false;
			}
			
		}
		
		return true;
		
	}else{
		return true;
	}

}


function procMssg(){

alert('Note: Complimentary subscriptions to the printed version of Procurement.travel are limited to the U.S., Canada, and U.S. possessions. The publisher reserves the right to limit the number of free subscriptions, and will only accept applications which meet the qualification criteria for the publication.');

}


function getObj(theName)
{
  if (document.getElementById)
  {
        this.obj = document.getElementById(theName);
        this.style = document.getElementById(theName).style;
        //alert('getElement');
  }
  else if (document.all)
  {
        this.obj = document.all[theName];
        this.style = document.all[theName].style;
        //alert('docAll');
  }
  else if (document.layers)
  {
        this.obj = document.layers[theName];
        this.style = document.layers[theName];
        //alert('Layers');
  }
}



var clipTop = 0;
var clipLeft = 0;
var clipRight;
var clipWidth;
var clipBottom = 22;
var topper;
var lefter = 0;
var lyrwidth = 700;
var time,amount,theTime,theHeight,DHTML;
var amount = 10;
var theTime = 100;
var DHTML;

function init()
{

	/*
	if (document.all){
	document.all['ticker'].style.left = 0;
	}

	DHTML = (document.getElementById || document.all || document.layers);
	if (!DHTML) return;
	var x = new getObj('tickeritem');
	var xw = new getObj('ticker');
	
	//alert(xw.obj.offsetWidth);
	
	
	clipWidth = xw.obj.offsetWidth - 140;
	
	if (document.all){
	clipWidth += 140;
	}
	
	clipWidth = clipWidth == 0 ? 100 : clipWidth;
	clipRight = clipWidth;
	
	
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		var clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0px)';
		x.style.clip = clipstring;
		
		//alert(x.style.clip);
		//alert(clipWidth);
	}


//tickercode = '';

//tickercode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="2400" height="22" id="blogticker5b" align="middle">' +
//'<param name="allowScriptAccess" value="always" />' +
//'<param name="movie" value=http://www.promedia.travel/flash/blogticker5.swf?areawidth=' + clipWidth + '" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.promedia.travel/flash/blogticker5.swf?areawidth=' + clipWidth + '" loop="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="2400" height="22" name="blogticker5b" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
//'<\/object>';
	
tickerCode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="2400" height="22" id="blogticker5b" align="middle">' +
'<param name="allowScriptAccess" value="always" />' +
'<param name="movie" value="http://www.promedia.travel/flash/blogticker5b.swf?areawidth=' + clipWidth + '" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.promedia.travel/flash/blogticker5b.swf?areawidth=' + clipWidth + '" loop="false" quality="high" wmode="opaque" bgcolor="#ffffff" width="2400" height="22" name="blogticker5b" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
'<\/object>';

		x.obj.width = '1000px';
		x.obj.innerHTML = tickerCode;
		
		*/
	
	loadSponsor();
	
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


var thisMenu = new Object;
var theTimer;

function showmenu(pDiv,tDiv,getTop,offsetX,offsetY){


//alert('mouse over');

if (theTimer != null){
clearTimeout(theTimer);
}

theTargetDiv = document.getElementById(tDiv);

thePosDivObj = new Object();
thePosDivObj = document.getElementById(pDiv);

divArray = findPos(thePosDivObj);


if (!offsetX){
theTargetDiv.style.left = divArray[0] + offsetX + "px";
}else{
theTargetDiv.style.left = divArray[0] + "px";
}

if (getTop){

if (!offsetY){
theTargetDiv.style.top = divArray[1] + "px";
}else{
theTargetDiv.style.top = divArray[1] + offsetY + "px";
}

}
//theDLmenu.style.top = menuArray[1] + "px";
//alert(theDLmenu.offsetLeft);


theTargetDiv.style.visibility = "visible";


}

function hidemenu(tDiv){

thisDiv = tDiv;

theTimer = setTimeout("clearmenu(thisDiv)",500);

}

function clearmenu(tDiv){

theDiv = document.getElementById(tDiv);
theDiv.style.left = "-200px";
theDiv.style.top = "125px";
theDiv.style.visibility = "hidden";

}

function openDialogue(){
document.getElementById('placer').style.visibility = 'visible';
document.getElementById('overlay').style.visibility = 'visible';
}

function closeDialogue(ifid,returnlink){
if (returnlink){
document.location.href=returnlink;
}
parent.document.getElementById('placer').style.visibility = 'hidden';
parent.document.getElementById('overlay').style.visibility = 'hidden';
}




var ie = (document.all) ? true : false;


var min=11;
var max=18;
var defaultFontSize = 12;
var defaultlineheight = 18;
var currentFontSize;


function txtsize(pixels,mod){

if (!mod){
mod = '';
}

//divArray = new Array("newscopy","newsdate","content");
classArray = new Array("blogitem","content");
//elementArray = new Array("h1");


	/*
   var p = document.getElementsByTagName('h1');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = defaulttitle;
      }
      if(s!=max) {
         s += pixels;
      }
      p[i].style.fontSize = s+"px";
   }
   */
   
   if (!currentFontSize){
   
   currentFontSize = defaultFontSize;
   
   }
   
      if(pixels > 0) {
      	document.getElementById('textminus').src = "/images/bttn-txtminus" + mod + "-1.gif";
      	if (currentFontSize!=max){
         currentFontSize += pixels;
         }
		  if(currentFontSize!=max){
			 document.getElementById('textplus').src = "/images/bttn-txtplus" + mod + "-1.gif";	
		  }else{
			 document.getElementById('textplus').src = "/images/bttn-txtplus" + mod + "-0.gif";
		  }
      }else{
      	document.getElementById('textplus').src = "/images/bttn-txtplus" + mod + "-1.gif";
      	if (currentFontSize!=min){
         currentFontSize += pixels;
		}
		  if(currentFontSize!=min){
			 document.getElementById('textminus').src = "/images/bttn-txtminus" + mod + "-1.gif";	
		  }else{
			 document.getElementById('textminus').src = "/images/bttn-txtminus" + mod + "-0.gif";
		  }

      }

	  currentFontSizeValue = currentFontSize;
	  
	  currentLineheightValue = currentFontSizeValue + 7;
	  
	  currentFontSizeValue += "px";
	  currentLineheightValue += "px";
	  
	  //document.getElementById('fsvalue').innerHTML = currentFontSizeValue;

      for(i=0;i<classArray.length;i++){
      
      className = classArray[i];
	 
	  	  
      setStyleByClass('DIV', className, 'fontSize', currentFontSizeValue);
      setStyleByClass('DIV', className, 'lineHeight', currentLineheightValue);  
      
      }
      
	
}



// 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 + "'");
				}
			}
		}
	}
}



