//  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 !="/images/spacer.gif"){
	document.write (htmlOut);
	}else{
		if(other.length)
		{
			document.write (other);
		}
	}
}

var albumItunes = '<img src="/images/badgeitunes.gif" alt="iTunes" title="get album from iTunes" border="0" />';
function createLink(str, html, itunesHtml,after)
{
	if(!itunesHtml)itunesHtml = '<img src="/images/itunes.gif" alt="iTunes" title="get from iTunes" border="0" />';
	//alert(itunesHtml);
	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';
	document.write(icon);
}

function makeMailTo(name, domain, linkText)
{

	if(!name || !domain)return false;
	if (!linkText) linkText = name+'@'+domain;
	document.write('<a href="mailto:'+name+'@'+domain+'">'+linkText+'</a>');
}



var faqEntries = new Array();

function toggle(obj, t) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none'|| t== 'hide') {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
	if(t == 'show')el.style.display = 'block';
}

function toggleAll(t)
{
	var num = faqEntries.length;
	for (var i = 0; i < num; i ++)
	{
	toggle(faqEntries[i],t);
	}
}

function rowHover(id , overClass) 
{
	if(!overClass)overClass = 'over';
	var table = document.getElementById(id);
	if(!table)return;
    var rows = table.getElementsByTagName("tr");
    for (i=0; i < rows.length; i++) {
	    rows[i].onmouseover = function() { this.className=overClass };
        rows[i].onmouseout = function() { this.className='' };
    }
}


function popImage(popimg){
	windowHandle = window.open('','pop','scrollbars=no,resizable=yes,width=420,height=420');
	var tmp = windowHandle.document;
	tmp.write('<html><head><title>image</title>\n');
	tmp.write('<scr'+'ipt language="javas'+'cript">\n'); 
    tmp.write('var picUrl = "'+popimg+'"; \n');
    tmp.write('var NS = (navigator.appName=="Netscape")?true:false; \n');
    tmp.write('function FitPic() { \n');
    tmp.write('   iWidth = (NS)?window.innerWidth:document.body.clientWidth; \n');
    tmp.write('   iHeight = (NS)?window.innerHeight:document.body.clientHeight; \n');
    tmp.write('   iWidth = (document.images[0].width - iWidth)+30; \n');
    tmp.write('   iHeight = (document.images[0].height - iHeight) + 50; \n');
    tmp.write('   window.resizeBy(iWidth, iHeight); \n');
    tmp.write('   self.focus(); \n');
    tmp.write(' }; \n');
    tmp.write('</scr'+'ipt>\n'); 
	tmp.write('</head><body leftmargin="5" topmargin="5" marginwidth="5" marginheight="5" style="background:#000 url(images/bg_site_leather.jpg);margin:0;padding:5;color:#fff;text-align:center;" onload="FitPic();" onblur="window.close();">');
	tmp.write('<div><img src="'+popimg+'" border="0"></div>');
	tmp.write('<button onclick="self.close();" style="margin:4px;">close</button>');
	tmp.write('</body></html>');
	tmp.close();

}
window.onload = setupThumbs;
function setupThumbs(){
	hoverBandDTvVids('videoList');
	window.name = "main";
	var pagelinks=document.getElementsByTagName("a")
	for (var i=0; i<pagelinks.length; i++){ 
		if (pagelinks[i].className == "thumb" ){
			pagelinks[i].onclick=function(){
				popImage(this);
				return false;
			}
		}
	}
}


function hoverBandDTvVids(id , color) 
{
	if(!color)color = '#faf7ea';
	var container = document.getElementById(id);
	if(!container)return;
    var rows = container.getElementsByTagName("div");
    for (i=0; i < rows.length; i++) {
			var e = rows[i];
			var as = e.getElementsByTagName("a");
			var l = as[0].href;
			e.onclick = function(){document.location = l;}
			e.onmouseover = function() { this.style.backgroundColor = "#444444";};
	        e.onmouseout = function() { this.style.backgroundColor = ""; };
	
    }
}

function rowHighLight(id , overClass) 
{
	if(!overClass)overClass = 'over';
	var table = document.getElementById(id);
	if(!table)return;
    var rows = table.getElementsByTagName("tr");
    for (i=0; i < rows.length; i++) {	
			rows[i].onmouseover = function() { this.className=overClass };
			rows[i].onmouseout = function() { this.className='' };
		}
  
}