//  pass the url  and  optionally a width, height, and window name
function spawnWindow(url,name,w,h){
	if(w == undefined) w = 320;
	if(h == undefined) h = 240;
	if(name == undefined) name = "popWindow";
	var newWindow = window.open(url,name,"toolbar=0,scrollbars=1,resizable=1,width="+w+",height="+h+"\"");
	
 }
 
 function ifExists(val, htmlOut, other){
	if (typeof other=='undefined') other = "";
	
	if (val.length && val != "false" && val !="/echotools/images/spacer.gif"){
	document.write (htmlOut);
	}else{
		if(other.length)
		{
			document.write (other);
		}
	}
}
 
		
		function createLink(str, html, after)
		{
			var itunesHtml = '<img src="/images/itunes.gif" alt="iTunes" title="get from iTunes" border="0" />';
			var l;
			if (str.length)
			{
				if (!str.match("http://"))
				{
					l = 'http://'+str;
				}else{
					l = str;
				}
				
				if(str.match('phobos.apple.com')){
					document.write('<a href="'+l+'" target="_blank">'+itunesHtml+'</a>');
				}else{
					document.write('<a href="'+l+'" target="_blank">'+html+'</a>');
				}
					
					if(after)document.write(after);
			}
		}


function vipTickets(val){
	
	var icon;
	if(val == 'active') icon = '<a href="?content=tickets_policy">GET TICKETS &raquo;</a>';
	if(val == 'inactive') icon = '';
	if(val == 'closed') icon = 'Vip Tix Closed';
}
		
		
// SPAM PROTECTED MAIL TO LINK
//
//	usage	makeMailTo('~email_name~', '~domain~', 'Send Email');		
//   name = first part of email domain = part after @  linkText = text to show for mail to link          


function makeMailTo(name, domain, linkText)

{

	if(!name || !domain)return false;
	if (!linkText) linkText = name+'@'+domain;
	document.write('<a href="mailto:'+name+'@'+domain+'">'+linkText+'</a>');
}

// INLINE SPAM PROTECTED EMAIL
/*
<script type="text/javascript">
	name = "NAME";
	domain = "DOMAIN.COM";
	document.write('<a href="mailto:'+name+'@'+domain+'">'+name+'@'+domain+'</a>');
</script>
*/

function toggle(obj) {
	var el;
	if(typeof(obj) == 'string'){
		el = document.getElementById(obj);
	}else{
		el = obj;
	}
		//var icon = document.getElementById(obj+'_icon');
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
		//icon.src = collapsed_icon_path;
	}else {
		el.style.display = 'block';
		//icon.src = expanded_icon_path;
	}
}

function zebra(id , overClass) {
	var el = document.getElementById(id);
	if(!el)return;
	var rows = el.getElementsByTagName("tr");
	for (i=0; i < rows.length; i++) {
		if(i % 2 == 0) {
			rows[i].bgColor = "#303030";
		}
	}
}

function rowHover(id , overClass) 
{
	var n = 0;
	if(!overClass)overClass = 'over';
	var table = document.getElementById(id);
	if(!table)return;
    var rows = table.getElementsByTagName("tr");
    for (i=0; i < rows.length; i++) {
		//alert(rows[i].className);
		if (rows[i].className == 'tourentry') {
			n++;
			if(n % 2 == 0) 
			{
				rows[i].bgColor = "#8ca0ac";
			}
		}
      //  rows[i].onmouseover = function() { this.className=overClass };
      //  rows[i].onmouseout = function() { this.className='' };
    }
}