var active = null;
var browser=navigator.appName;
var currentTime;

var merchUrl = null;
var forumUrl = null;
var objectPlaying = null;
var oXMLHttp = null;
var oXMLHttpClick = null;
var oXMLHttpRelease = null;
var oXMLHttpTour = null;
var oXMLHttpFlashNav = null;

var jumboLoaded = false;

var horzBackgrounds = new Array();

var horzBackgroundCount = 16;

var monthArray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

var agent = navigator.userAgent.toLowerCase(); 
var isMac = (agent.indexOf("mac") != -1) ? true : false;
var isMSIE = (navigator.appVersion.indexOf("MSIE")!=-1) ? true : false;

var browserName = "";

var historyXML = new Object;

var ua = navigator.userAgent.toLowerCase();

if ( ua.indexOf( "opera" ) != -1 )
{
	browserName = "opera";
} else if ( ua.indexOf( "msie" ) != -1 )
{
	browserName = "msie";
} else if ( ua.indexOf( "safari" ) != -1 )
{
	browserName = "safari";
} else if ( ua.indexOf( "mozilla" ) != -1 )
{
	if ( ua.indexOf( "firefox" ) != -1 )
	{
		browserName = "firefox";
	} else {
		browserName = "mozilla";
	}
}

var paneDifference = 0;

function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");
    
    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}

function tableRollover(obj) {
	document.getElementById(obj).style.backgroundColor='#db0038';
}

function tableRollout(obj) {
	document.getElementById(obj).style.backgroundColor='transparent';
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[ i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[ i];}}
} 

var canSwap = "true";

function scrollToTop()
{
	scroll(0);
}

function printImage(imageUrl, width, height, max) {


	imageWidth = parseInt(width * (max/width));
	imageHeight = parseInt(height * (max/width));


	leftDif = parseInt((max - imageWidth) / 2);
	topDif = parseInt((max - imageHeight) / 2);

	image = "<img src=\""+imageUrl+"\" width=\""+imageWidth+"\" height=\""+imageHeight+"\" border=\"0\" align=\"top\">"; 
	
	return image;

}

function addslashes(str) {

	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function stripslashes(str) {
	var thisStr = "";
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}

window.onload=function(){


}

function toCamelCase(s) {
	for (var exp = /-([a-z])/; exp.test(s); s=s.replace(exp, RegExp.$1.toUpperCase())) {
	}
	return s;
}

function loadFlashNav()
{

	var so = new SWFObject("main.swf", "resizer", "100%", "100%", "9");
	so.addParam("scale", "noscale");
	so.addVariable("xmlFile", "xml/links_"+ territory +".xml");
	so.write("flashNav");
	
	windowResize();
}


function GetXMLHttpObject()
{
      oXMLHttp = null;

      try
      {
            oXMLHttp = new ActiveXObject("MSXML2.XMLHTTP");
      }
      catch (E)
      {
            try
            {
                  oXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E)
            {
              oXMLHttp = null;
            }
      }

      if ((oXMLHttp == null) && (typeof(XMLHttpRequest) != 'undefined'))
      {
            oXMLHttp = new XMLHttpRequest();
      }

      return oXMLHttp;
}


function loadDates()
{
	
	if(oXMLHttp)
	{
		oXMLHttp.abort();
	}

	if (window.XMLHttpRequest)
	{
	 	 oXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
	  	oXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	var url="../xml/history.xml";

	oXMLHttp.onreadystatechange = function()
	    {
		  if (oXMLHttp.readyState == 4)
		  {
			if (oXMLHttp.status==200)
			{	
				historyXML = oXMLHttp.responseXML;
				placeTimeline();
				loadDate(0);
			}
			else
			{
				alert("Problem retrieving XML data");
			}
		  }
	    }
	
	oXMLHttp.open("GET", url, true);
	
	oXMLHttp.send(null);
}



function loadDate(id)
{

	html = "<table width=\"930\" cellspacing=\"0\" cellpadding=\"0\">";
	var articles = historyXML.getElementsByTagName("Item");

	html += "<tr valign=\"top\" align=\"left\">";
	html += "<td>";

	var imageTD = 0;
	var gallery = articles[id].getElementsByTagName("Photo");;
	if(gallery.length  > 0)
	{
		imageTD = 310;
		html += "<table width=\"310\" cellspacing=\"0\" cellspadding=\"0\">";

		for(y = 0; y < gallery.length; y++)
		{
			imageUrl = "../"+ gallery[y].attributes.getNamedItem("Url").value;
			imageWidth = gallery[y].attributes.getNamedItem("Width").value;
			imageHeight = gallery[y].attributes.getNamedItem("Height").value;
			max = 300;

			html += "<tr valign=\"top\" align=\"left\">";
			html += "<td style=\"padding: 0px 0px 10px 0px\">" + printImage(imageUrl, imageWidth, imageHeight, max) +"</td>";
			html += "</tr>";
		}

		html += "</table>";
	}
	html += "</td>";
	var tempValue = articles[id].getElementsByTagName("Title")[0];
	var title = tempValue.childNodes[0].nodeValue;

	var dateArray = articles[id].attributes.getNamedItem("Date").value.split('-');

	var thisMonth = monthArray[dateArray[1] - 1];

	var thisYear  = dateArray[0];

	var thisDay = dateArray[2];

	var date = thisMonth + " " + thisDay +", "+thisYear;

	var tempValue = articles[id].getElementsByTagName("Body")[0].firstChild;
	if(tempValue != null)
	{
		var text = tempValue.data;
	} else {
		var text ="";
	}

	html += "<td><table width=\""+ (930 - imageTD) +"\" cellspacing=\"0\" cellpadding=\"0\">";
	html += "<tr valign=\"top\" align=\"left\">";
	html += "<td><span id=\"headline2\">"+ title +"</span><br /><span id=\"headline3\">"+ date +"</span></td></tr>";
	html += "<tr valign=\"top\" align=\"left\">";
	html += "<td><span id=\"content\">"+text +"</span></td></tr>";
	html += "</table></td></tr>";
	html += "<tr colspan=\"2\"><td height=\"20\"/></tr>";

	
	html += "</table>";
	
	document.getElementById('historyContent').innerHTML = html;

}


function capitalize(obj) {
        val = obj;
        newVal = '';
        val = val.split(' ');
        for(var c=0; c < val.length; c++) {
                newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' ';
        }
        return newVal;
}


function dumpDivs(thisSection)
{
	document.getElementById('content').display = "block";
	document.getElementById('secondaryDiv').display = "block";
	document.getElementById('tertiaryDiv').display = "block";
	document.getElementById('content').innerHTML = "";
	if (thisSection != "tours" || thisSection != "video")
	{
		document.getElementById('secondaryDiv').innerHTML = "";
	}
	if (thisSection != "photos")
	{
		document.getElementById('tertiaryDiv').innerHTML = "";
	}

}
//
function getStyle(el, style) {
	if (!document.getElementById) {
		return;
	}
	var value = el.style[toCamelCase(style)];
	if (!value) {
		if (document.defaultView) {
			value = document.defaultView.getComputedStyle(el, "").getPropertyValue(style);
		} else if (el.currentStyle) {
			value = el.currentStyle[toCamelCase(style)];
		}
	}
	return value;
}

function getElement(id){	
	if (!document.getElementById){
	 return;
	}
	//
	if (document.getElementById){
		// this is the way the standards work
		var el = document.getElementById(id);
	}else if (document.all){
		// this is the way old msie versions work
		var  el = document.all[id];
	}else if (document.layers){
		// this is the way nn4 works
		var el = document.layers[id];
	}
	return el;
}

toggleDisplay=function(el){
	el.style.display = el.style.display ? "" : "block";
}

replaceAnchors=function(){
	if (document.getElementById) {
		var atags = document.getElementsByTagName("A");
		for (var i = 0; i<atags.length; i++) {
			var ca = atags[i];
			var index=ca.href.indexOf("#");
			var hash=ca.href.substring(index+1);
			if (index>-1 &&	hash.length>0) {
				ca.link=hash;
				ca.onclick = function() {	
					var b = getElement('content');
					b.scrollTop = getElement(this.link).offsetTop;
					return false;
				};
			}
		}
	}
}


function placeFLVPlayer(videoUrl, videoType)
{
	videoUrl = videoUrl.replace(/&/, "%26");
	var flashVars = "videoUrl="+videoUrl+"&autoplay=true";
	switch(videoType)
	{
		case "Official":
			switch(browserName)
			{

				case "msie" :

					html = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"100%\" height=\"100%\" id=\"resizer\" align=\"middle\">";
					html += "<param name=\"allowScriptAccess\" value=\"always\" />";
					html += "<param name=\"allowFullScreen\" value=\"false\" />";
					html += "<param name=\"wmode\" value=\"transparent\" />";
					html += "<param name=\"movie\" value=\"flash/videoPlayer.swf?"+flashVars+"\" />";
					html += "<param name=\"quality\" value=\"high\" />";
					html += "<param name=\"bgcolor\" value=\"#ffffff\" />";
					html += "<embed src=\"flash/videoPlayer.swf\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"100%\" flashvars=\"" +flashVars+ "\"  id=\"resizer\" name=\"resizer\" align=\"middle\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
					html += "</object>";
					document.getElementById('flashNav').innerHTML = html;
					break;

				default:

					var so = new SWFObject("flash/videoPlayer.swf", "resizer", "100%", "100%", "9");
					so.addParam("scale", "default");
					//so.addParam("FlashVars", flashVars);
					so.addVariable("videoUrl", videoUrl);
					so.addVariable("autoplay", true);
					so.addParam("wmode", "transparent");
					so.write("flashNav");
					break;
			}
			break;
			
		case "YouTube":

			var so = new SWFObject("http://www.youtube.com/v/"+ videoUrl.substr(31)+"&autoplay=1", "resizer", "100%", "100%", "9");
			so.addParam("scale", "default");
			so.addParam("bgcolor", "#000000");
			so.addParam("wmode", "transparent");
			so.write("flashNav");
			break;
	}
	
	windowResize();	
	
	if (divDirections["up"] == "true")
	{
		closeHorz();
	}
	
	document.getElementById('flashNav').innerHTML += "<div style=\"position: absolute; left: 10px; top:10px;\"><a href=\"#\" onclick=\"loadFlashNav(); return false;\"><img src=\"images/close_button_orange.gif\" width=\"33\" height=\"33\" border=\"0\"></a></div>";

}


function placePlayer(sDivId, previewUrl, iteration)
{
      var oXMLHttp = GetXMLHttpObject();

	  var url="../php/placePreviewPlayer.php";
	  url=url+"?previewUrl="+previewUrl;
	  url=url+"&iteration="+iteration;
	  url=url+"&browser="+browser;

      oXMLHttp.open("GET", url, true);

      oXMLHttp.onreadystatechange = function()
            {
                  if (oXMLHttp.readyState == 4)
                  {	
                        document.getElementById(sDivId).innerHTML = oXMLHttp.responseText;
                  }
            }

      oXMLHttp.send(null);
}

function placePodcastPlayer(sDivId, previewUrl, iteration)
{
      var oXMLHttp = GetXMLHttpObject();

	  var url="../php/placePodcastPlayer.php";
	  url=url+"?previewUrl="+previewUrl;
	  url=url+"&iteration="+iteration;
	  url=url+"&browser="+browser;

      oXMLHttp.open("GET", url, true);

      oXMLHttp.onreadystatechange = function()
            {
                  if (oXMLHttp.readyState == 4)
                  {	
                        document.getElementById(sDivId).innerHTML = oXMLHttp.responseText;
                  }
            }

      oXMLHttp.send(null);
}

function placePodcastPlayerHome(sDivId, previewUrl)
{

      var oXMLHttp = GetXMLHttpObject();

	  var url="php/placePodcastPlayerHome.php";
	  url=url+"?previewUrl="+previewUrl;
	  url=url+"&browser="+browser;

      oXMLHttp.open("GET", url, true);

      oXMLHttp.onreadystatechange = function()
            {
                  if (oXMLHttp.readyState == 4)
                  {	
                        document.getElementById(sDivId).innerHTML = oXMLHttp.responseText;
                  }
            }

      oXMLHttp.send(null);
}
/*
function placeRadio()
{
      var oXMLHttp = GetXMLHttpObject();

	  var url="../php/placeRadio.php";
	  url=url+"?browser="+browser;

      oXMLHttp.open("GET", url, true);

      oXMLHttp.onreadystatechange = function()
            {
                  if (oXMLHttp.readyState == 4)
                  {	
                        document.getElementById("radio").innerHTML = oXMLHttp.responseText;
                  }
            }

      oXMLHttp.send(null);
}
*/
function changeVal(id)
{
	val = "";
	document.getElementById(id).value = val;
}



switchContent=function(id){	

	//turn off last active
	if(active){
		document.images[oldSection].src = items[oldSection].off.src;
		toggleDisplay(active);
	}
	
	switch(id)
	{
		case "news":
			
			id = "news"+territory;	
			active=getElement(id);
			toggleDisplay(active);
			section = oldSection = "news";
			document.images[section].src = items[section].on.src;
			break;

		case "contest":

			id = "contest"+territory;	
			active=getElement(id);
			toggleDisplay(active);
			section = oldSection = "contest";
			document.images[section].src = items[section].on.src;
			break;

		default:

			active=getElement(id);
			toggleDisplay(active);
			section = oldSection = id;
			document.images[section].src = items[section].on.src;
			break
	}
	
	//var img=(getElement('headerimg'))
	//img.src="images/header-"+id+".jpg"

	//trackEvent(window.location.host, "/"+id+".ajaxPage", id, '');
	
	var contentDiv = getElement('content');
	contentDiv.scrollTop = 0;
}

//
function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i = 0; i<vars.length; i++) {
		var pair = vars[i].split("=");
		if (pair[0] == variable) {
			return pair[1];
		}
	}
}

function startScrollingDetector(){
	setInterval("scrollingDetector()", 250);
	setBg();
}

function scrollingDetector(){
/*
	if (navigator.appName == "Microsoft Internet Explorer")
	{
		scrollValue = document.body.scrollTop;
	} else {
		scrollValue = window.pageYOffset;
	}
*/	
	scrollValue = document.getElementById('contentDiv').scrollTop;
	moveDiv();
}

function toggleAlphaNav(state){
	el = document.getElementById('footerAlphaNav');
	
	if(state == "hide")
	{
	 	el.style.display = "";
	} else {
		el.style.display = "block";
	}
}

function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

function getScreenSize()
{
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
		screenWidth = window.innerWidth;
		screenHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
		screenWidth = document.documentElement.clientWidth;
		screenHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
		screenWidth = document.body.clientWidth;
		screenHeight = document.body.clientHeight;
	}

	arrayPageSize = new Array(screenWidth,screenHeight)
	return arrayPageSize;
}

function moveDiv() {

	pageSize = getPageSize();

	thisY = 0;
	var pageScroll;
/*
	if (self.pageYOffset) {
		pageScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		pageScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		pageScroll = document.body.scrollTop;
	}
*/
	pageScroll = document.getElementById('contentDiv').scrollTop;

	widthDif = 70;
	divDiff = document.getElementById('featureDiv').offsetHeight;
	if(isMSIE){
		otherdif = 0;
	} else {
		otherdif = 120;
	}
	
	document.getElementById('featureDiv').style.display = "block";
	document.getElementById('featureDiv').style.top = pageSize[3] + pageScroll - divDiff - otherdif +"px";
	document.getElementById('featureDiv').style.left = pageSize[0] / 2 + widthDif +"px";

}

var smallScreen = false;

var pageSize = new Array();

function setStage()
{

	//document.getElementById('carouselContainer').style.display = 'block';

	pageSize = getScreenSize();
	randomNum = Math.floor((6-1)*Math.random()) + 1;

	if(pageSize[1] < 500) 
	{
		document.getElementById('contentDiv').style.height = (380) +"px";
	} else {
		document.getElementById('contentDiv').style.height = (pageSize[1]-105) +"px";
	}

	if(pageSize[0] < 1200)
	{
		bgDim = 1200;
		difference = pageSize[0] / bgDim;
		bgHeight = 800 * difference;
		
	} else if (pageSize[0] < 1100) {
	
		bgDim = 1650;
		difference = pageSize[0] / bgDim;
		bgHeight = 1100 * difference;
		
	} else {
		
		bgDim = 2100;
		difference = pageSize[0] / bgDim;
		bgHeight = 1400 * difference;
		
	}
	
	var contentHeight = document.getElementById('contentDiv').offsetHeight;
	
	if(jumboLoaded == true)
	{
		img = jumboObj[currentFeat].imageUrl;
		contentTitle = jumboObj[currentFeat].title;
		contentText = jumboObj[currentFeat].featureText;	
		document.getElementById('backgroundDiv').innerHTML = "<img src=\"" + img +"\" width=\""+ pageSize[0]+"\" height=\""+ bgHeight +"\" />";
		document.getElementById('backgroundDiv').style.width = bgDim +"px";
		document.getElementById('backgroundDiv').style.top = ((pageSize[1] - 50) / 2) - (bgHeight / 2) +"px";
		//document.getElementById('backgroundDiv').style.left = (pageSize[0] / 2) - (bgDim / 2) +"px";
		document.getElementById('carouselContainer').style.display = "block";
		document.getElementById('carouselContainer').style.top = (contentHeight-145) +"px";
		if(browserName == "msie" && getIEVersionNumber() < 8)
		{
			document.getElementById('carouselContainer').style.left = (pageSize[0] / 2) - (document.getElementById('carouselContainer').offsetWidth / 2) +"px";
		} else {

			document.getElementById('carouselContainer').style.left = (pageSize[0] / 2) - (700 / 2) +"px";
		}

		document.getElementById('carouselContent').innerHTML = '<span id="contentBoxTitle">' + contentTitle +'</span><br/><div id="contentTextHolder"><span id="contentBoxText">'+ contentText+'</span></div>';
		document.getElementById('carouselContent').style.top = (pageSize[1] / 2) - (document.getElementById('carouselContent').offsetHeight / 2) - 70 +"px";
		document.getElementById('carouselContent').style.left = (pageSize[0] - 225) +"px";
	}
	
	//document.getElementById('twitterDiv').style.width = (pageSize[0]-75) +"px";
	
	document.getElementById('header').style.width = (pageSize[0]) +"px";
	document.getElementById('footer').style.width = (pageSize[0]) +"px";
	document.getElementById('twitterDiv').style.width = (pageSize[0]) - 95+"px";
	
	placeSecondary();
	placeTertiary();
	placeQuaternary();

}

function placeSecondary()
{
	var contentHeight = document.getElementById('contentDiv').offsetHeight;
	var secondaryContent = document.getElementById('secondaryContainer');

	secondaryContent.style.top = (contentHeight / 2) - (370 / 2) + "px";
	secondaryContent.style.left = (pageSize[0] / 2) - (973 / 2) +"px";
}

function placeTertiary()
{
	var headerHeight = document.getElementById('header').offsetHeight;
	var contentHeight = document.getElementById('contentDiv').offsetHeight;
	var tertiaryContent = document.getElementById('tertiaryContainer');

	if(browserName == "msie" && getIEVersionNumber() < 8)
	{
		//alert(pageSize[0]);
		//document.getElementById('coverFlow').style.left = (pageSize[0] / 2) - (document.getElementById('coverFlow').offsetWidth / 2) +"px";
	} 
	
	tertiaryContent.style.height = contentHeight +"px";
	tertiaryContent.style.top = headerHeight + "px";
	tertiaryContent.style.left = "0px";

}

function placeQuaternary()
{
	var headerHeight = document.getElementById('header').offsetHeight;
	var contentHeight = document.getElementById('contentDiv').offsetHeight;
	var quaternaryContent = document.getElementById('quaternaryContainer');

	if(browserName == "msie" && getIEVersionNumber() < 8)
	{
		//alert(pageSize[0]);
		//document.getElementById('coverFlow').style.left = (pageSize[0] / 2) - (document.getElementById('coverFlow').offsetWidth / 2) +"px";
	} 
	
	quaternaryContent.style.height = contentHeight +"px";
	quaternaryContent.style.top = headerHeight + "px";
	quaternaryContent.style.left = "0px";

}

function launch(url, name, width, height, options)
	{
	if (!name)
		{
		name = "window_" + Math.floor(1000 * Math.random());
		}
	
	if (!width)
		{
		width = screen.availWidth;
		}
		
	if (!height)
		{
		height = screen.availHeight;
		}
	
	if (!options)
		{
		options = "menubar=1,toolbar=1,location=1,directories=1,status=1,scrollbars=1,resizable=1";
		}
	
	width	= Math.min(width, screen.availWidth);
	height	= Math.min(height, screen.availHeight);
	var x	= Math.max(0, 0.5 * (screen.availWidth - width));
	var y	= Math.max(0, 0.5 * (screen.availHeight - height));

	var config = "";
	config += "left=" + x + ",top=" + y + ",";
	config += "screenX=" + x + ",screenY=" + y + ",";
	config += "width=" + width + ",height=" + height;
	config += "," + options;

	var win = window.open(url, name, config);
	if (win && window.focus)
		{
		win.focus();
		}
	}
	
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}


// Twitter feed

var oXMLHttpTwitter;

function GetTwitterXMLHttpObject()
{
     oXMLHttpTwitter = null;

      try
      {
            oXMLHttpTwitter = new ActiveXObject("MSXML2.XMLHTTP");
      }
      catch (E)
      {
            try
            {
                  oXMLHttpTwitter = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E)
            {
              oXMLHttpTwitter = null;
            }
    }

      if ((oXMLHttpTwitter == null) && (typeof(XMLHttpRequest) != 'undefined'))
      {
            oXMLHttpTwitter = new XMLHttpRequest();
      }

      return oXMLHttpTwitter;
}


var tweetObj = new Object;

function loadTwitter()
{

	if(oXMLHttpTwitter)
	{
		oXMLHttpTwitter.abort();
	}

	oXMLHttpTwitter = GetTwitterXMLHttpObject();

	var url = "php/twitter.php";

	oXMLHttpTwitter.open("POST", url, true);

	oXMLHttpTwitter.onreadystatechange = function()
	    {
		  if (oXMLHttpTwitter.readyState == 4)
		  {
			var JSONObject = new Object;

			var response = oXMLHttpTwitter.responseText;

			//alert(response);
			JSONObject = JSON.parse(response);

			tweetObj = JSONObject.Tweets;

			loadTweets();
		  }
	    }

	oXMLHttpTwitter.send(null);

}

var tweetCount = 0;



function loadTweets()
{

	var totalTweets = tweetObj.length;

	var twitterList = "<ul id=\"ticker01\">\n";

	for(count = 0; count < totalTweets; count++)
	{
		twitterList += '<li><span id="twitter">'+tweetObj[count].title + ' - Posted: '+ tweetObj[count].date +'</span></li>\n';
	}
	
	twitterList += "</ul>";
	
	document.getElementById('twitterDiv').innerHTML = twitterList;

	jQuery(function(){
		document.getElementById('twitterDiv').style.display ="block";
		jQuery("ul#ticker01").liScroll({travelocity: 0.05});
		//$("#twitterDiv").fadeIn(3000, function(){});
	});

}

// Jumbotron feed

var oXMLHttpJumbotron;

function GetJumbotronXMLHttpObject()
{
     oXMLHttpJumbotron = null;

      try
      {
            oXMLHttpJumbotron = new ActiveXObject("MSXML2.XMLHTTP");
      }
      catch (E)
      {
            try
            {
                  oXMLHttpJumbotron = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E)
            {
              oXMLHttpJumbotron = null;
            }
    }

      if ((oXMLHttpJumbotron == null) && (typeof(XMLHttpRequest) != 'undefined'))
      {
            oXMLHttpJumbotron = new XMLHttpRequest();
      }

      return oXMLHttpJumbotron;
}


var jumboObj = new Object;

var currentFeat = 0;

function loadJumbotron()
{

	if(oXMLHttpJumbotron)
	{
		oXMLHttpJumbotron.abort();
	}

	oXMLHttpJumbotron = GetJumbotronXMLHttpObject();

	var url = "php/getJumbotronInfo.php";

	oXMLHttpJumbotron.open("POST", url, true);

	oXMLHttpJumbotron.onreadystatechange = function()
	    {
		  if (oXMLHttpJumbotron.readyState == 4)
		  {
			var JSONObject = new Object;

			var response = oXMLHttpJumbotron.responseText;

			//alert(response);
			JSONObject = JSON.parse(response);

			jumboObj = JSONObject.JumboTron;
			
			jumboLoaded = true;
			
			setStage();
		  }
	    }

	oXMLHttpJumbotron.send(null);

}

function loadFeature(featId)
{
	currentFeat = featId;
	setStage();
}

function backHome()
{
	var homeBuild ="";
	homeBuild += '<div id="nav">';
	homeBuild += '<span id="mainNav"><a href="Javascript:void(0);">What\'s New</a><br/>';
	homeBuild += '<a href="Javascript:void(0);">Artists</a><br/>';
	homeBuild += '<a href="Javascript:void(0);">Events</a><br/></span>';
	homeBuild += '</div>';
	homeBuild += '<div id="carouselContainer">';
	homeBuild += '<div id="carousel" class="stepcarousel">';
	homeBuild += '<div class="belt"></div>';
	homeBuild += '</div>';
	homeBuild += '<p id="carousel-paginate" style="width: 700px; text-align:center">';
	homeBuild += '<img src="images/opencircle.png" data-over="images/graycircle.png" data-select="images/closedcircle.png" data-moveby="1" />';
	homeBuild += '</p>';
	homeBuild += '</div>';
	homeBuild += '<div id="carouselContent"></div>';
	homeBuild += '<div id="overlay" class="initiallyHidden"></div>';
	homeBuild += '</div>';
	
	document.getElementById('contentDiv').innerHTML = homebuild;
	loadJumbotron();
}

function whatsNew(contentType)
{
	//document.getElementById('overlay').style.display = 'block';
	jQuery("#overlay").fadeIn(3000, function() { getContent(); });
}

function abortAjaxCall()
{
	document.getElementById("loadingDivMain").style.display = "none"; 
	if(oXMLHttpContent)
	{
		oXMLHttpContent.abort();
	}
}

function closeAll()
{
	//alert(''+ document.getElementById('secondaryContainer').style.display +'');
	if(document.getElementById('secondaryContainer').style.display == "block") closeSecondary();
	if(document.getElementById('tertiaryContainer').style.display == "block") closeTertiary();
	if(document.getElementById('quaternaryContainer').style.display == "block") closeQuaternary();
}

function closeSecondary()
{
	document.title = "Columbia Records | Music Moving Forward";
	jQuery("#secondaryContainer").fadeOut(200, function() { jQuery("#overlay").fadeOut(200); } );
	abortAjaxCall();
}

function closeTertiary()
{
	document.title = "Columbia Records | Music Moving Forward";
	jQuery("#tertiaryContainer").fadeOut(200, function() { jQuery("#overlay").fadeOut(200); } );
	abortAjaxCall();
}

function closeQuaternary()
{
	document.title = "Columbia Records | Music Moving Forward";
	jQuery("#quaternaryContainer").fadeOut(200, function() { jQuery("#overlay").fadeOut(200); } );
	abortAjaxCall();
}


var oXMLHttpContent;

function GetContentXMLHttpObject()
{
     oXMLHttpContent = null;

      try
      {
            oXMLHttpContent = new ActiveXObject("MSXML2.XMLHTTP");
      }
      catch (E)
      {
            try
            {
                  oXMLHttpContent = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E)
            {
              oXMLHttpContent = null;
            }
    }

      if ((oXMLHttpContent == null) && (typeof(XMLHttpRequest) != 'undefined'))
      {
            oXMLHttpContent = new XMLHttpRequest();
      }

      return oXMLHttpContent;
}


var contentObj = new Object;

var artistObj = new Object;

var currentFeat = 0;

function getContent(contentType, p1)
{
	if(contentType == undefined) contentType = "news";
	
	switch(contentType)
	{
		case "artist":

			if(artistObj.length != undefined)
			{

				if(p1 != null)
				{
					loadArtist(p1);
				} else {

					loadArtistPane();
				}
				return;
			} else { 
				document.getElementById("loadingDivMain").style.display = "block"; 
				document.getElementById('overlay').onclick =  function () { closeTertiary(); };
			}
			break;
			
		case "about":
			loadAbout();
			document.getElementById('overlay').onclick =  function () { closeQuaternary(); };
			return;
			
		case "default":
			
			document.getElementById("loadingDivMain").style.display = "block"; 
			break;
	}

	if(oXMLHttpContent)
	{
		oXMLHttpContent.abort();
	}

	oXMLHttpContent = GetContentXMLHttpObject();

	var url = "php/getContent.php?contentType="+ contentType;
	
	oXMLHttpContent.open("POST", url, true);

	oXMLHttpContent.onreadystatechange = function()
	    {
		  if (oXMLHttpContent.readyState == 4)
		  {
		  	
		  	document.getElementById("loadingDivMain").style.display = "none";
		  	
			var JSONObject = new Object;

			var response = oXMLHttpContent.responseText;

			JSONObject = JSON.parse(response);

			switch(contentType)
			{
				case "news":
				case "viral":
				case "5questions":
				
					contentObj = JSONObject.Content;
					loadWhatsNewPane(contentType);
					break;
				
				case "artist":
					
					artistObj = JSONObject.Content;
					if(p1 != null)
					{
						loadArtist(p1);
					} else {
					
						loadArtistPane();
					}
					break;
					
				case "events":
					
					contentObj = JSONObject.Content;
					loadEventsPane(p1);
					break;
					
				case "press":
					
					contentObj = JSONObject.Content;
					loadPress();
					break;
					
				case "bigred":
									
					contentObj = JSONObject.Content;
					loadBigRed();
					break;
				
			}
		  }				
	    }

	oXMLHttpContent.send(null);

}



var currentSecondaryNav = "";

function setColor(id)
{
	if(currentSecondaryNav != "") currentSecondaryNav.style.color = "#ffffff";
	currentSecondaryNav = document.getElementById(id);
	currentSecondaryNav.style.color = "#dd0038";
}
	
function loadWhatsNewPane(contentType)
{

	getElement('secondary_1').style.width = "230px";
	getElement('secondary_2').style.width = "670px";
	
	var html_1 = '<span id="secondaryContentText"><a id="newsHeadline" href="Javascript:void(0);" onclick="setColor(\'newsHeadline\'); jQuery(\'#secondary_2\').fadeOut(\'slow\', function() { loadNewsHeadlines(); });">Latest Headlines</a><br/>';
	html_1 += '<img src="images/hr.jpg" width="230" height="1" style="padding: 10px 0px 10px 0px"/><br/><a id="viralVideo" href="Javascript:void(0);" onclick="setColor(\'viralVideo\'); jQuery(\'#secondary_2\').fadeOut(\'slow\', function(){ loadViralVideo(); });">Viral Video Of The Week</a>';
	html_1 += '<img src="images/hr.jpg" width="230" height="1" style="padding: 10px 0px 10px 0px"/><br/><a id="5Questions" href="Javascript:void(0);" onclick="setColor(\'5Questions\'); jQuery(\'#secondary_2\').fadeOut(\'slow\', function(){ load5Questions(); });">5 Questions</a></span>';
	
	document.getElementById('secondary_1').innerHTML = html_1;
	
	switch(contentType)
	{
		case "viral":
			loadViralVideo();	  
			break;
			
		case "news":
			if(prelimItemId != null)
			{
				loadNewsHeadlines(prelimItemId);
				prelimItemId = null;
			} else {
				loadNewsHeadlines();
			}
			break;
		
		case "5questions":
			load5Questions();
			break;
	}
	
	jQuery("#secondaryContainer").fadeIn(500, function(){ document.getElementById('overlay').onclick =  function () { closeSecondary(); }; });

}

function loadViralVideo()
{
	setColor('viralVideo');
	document.title = "Columbia Records | "+ contentObj[0].viral[0].itemTitle;
	
	var html = '<span id="contentTextTitle">'+ contentObj[0].viral[0].itemTitle +'</span><br/><span id="contentText">'+ contentObj[0].viral[0].itemBody +'</span>';
	document.getElementById('secondary_2').innerHTML = html;
	jQuery("#secondary_2").fadeIn(500);
}

function swapsharediv(sharetype, id)
{
	var sharecode = "";
	var sharecodeholder = sharetype +"_"+ id;
	var sharer = sharetype +"_sharer_"+ id;
	
	var itemLink = "http://www.columbiarecords.com/whatsnew/"+ id;
	switch(sharetype)
	{
		case "fb":
			sharecode ='<iframe src="http://www.facebook.com/plugins/like.php?href='+ itemLink +'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px"></iframe>';
			break;
			
		case "twitter":
			sharecode = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+ encodeURIComponent(itemLink)  +'&via=ColumbiaRecords&count=horizontal&text='+ news.itemTitle +'" style="width:130px; height:20px;"></iframe>';
			break;
	}
		
		
	document.getElementById(sharecodeholder).innerHTML = sharecode;
	document.getElementById(sharer).style.display = "none";
}
	
function loadNewsHeadlines(itemId)
{

	setColor('newsHeadline');
	var html ="";

	if(itemId != undefined)
	{

		for(var article in contentObj[1].news)
		{
			if(contentObj[1].news[article].itemId == itemId)
			{
				news = contentObj[1].news[article];
				var itemLink = "http://www.columbiarecords.com/whatsnew/"+ itemId;
				
				document.title = "Columbia Records | What's New - "+news.itemTitle;
				
				var shareText = '<div style="float:left"><iframe src="http://www.facebook.com/plugins/like.php?href='+ encodeURIComponent(itemLink) +'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px"></iframe></div>';
				shareText += '<div style="float:left"><iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+ encodeURIComponent(itemLink)  +'&via=ColumbiaRecords&count=horizontal&text='+ news.itemTitle +'" style="width:130px; height:50px;"></iframe></div>';
			
				if(news.headerImage.length == undefined)
				{
					headerImage = '<img src="'+ news.headerImage.url +'" style="border: 1px solid #ffffff" width="'+ news.headerImage.width +'" height="'+ news.headerImage.height +'" />';
				} else { 
					headerImage = '<img src="'+ news.artistImage +'" style="border: 1px solid #ffffff" width="250" height="138" />';
				}

				if(news.itemLinkText != "" || news.itemLink == "")
				{
					html += '<table width="640" cellspacing="0" cellpadding="5"><tr valign="top" align="left"><td width="250"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ headerImage +'</a><br/>'+ shareText +'</td><td width="430"><span id="contentHeadlineText"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ news.itemDate +' - ' + news.artistName +'</a></span><br/><span id="contentHeadlineTitle"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ news.itemTitle +'</a></span></td></tr></table>';
				} else {
					html += '<table width="640" cellspacing="0" cellpadding="5"><tr valign="top" align="left"><td width="250"><a href="' + news.itemLink + '" target="_blank">'+ headerImage +'</a><br/>'+ shareText +'</td><td width="430"><span id="contentHeadlineText"><a href="' + news.itemLink + '" target="_blank">'+ news.itemDate +' - ' + news.artistName +'</a></span><br/><span id="contentHeadlineTitle"><a href="' + news.itemLink + '" target="_blank">'+ news.itemTitle +'</a></span></td></tr></table><br/><br/>';
				}
			
				html += '<div style="float:right"><span id="contentText"><a href="javascript:void(0);" onclick="loadNewsHeadlines();">Click here for more news</a></span></div>';
				break;
			}
	
		}
	} else {
		
		document.title = "Columbia Records | What's New";
		
		for(var article in contentObj[1].news)
		{
			news = contentObj[1].news[article];

			var shareText = '<div id="fb_sharer_'+ news.itemId +'" style="float:left"><a href="Javascript:swapsharediv(\'fb\', '+ news.itemId +');"><img src="images/facebook_share.png" border="0" /><a></div><div id="fb_'+ news.itemId +'" style="float:left"></div>';
			shareText += '<div id="twitter_sharer_'+ news.itemId +'" style="float:left"><a href="Javascript:swapsharediv(\'twitter\', '+ news.itemId +');"><img src="images/twitter_share.png" border="0" /><a></div><div id="twitter_'+ news.itemId +'" style="float:left"></div>';

			if(news.headerImage.length == undefined)
			{
				headerImage = '<img src="'+ news.headerImage.url +'" style="border: 1px solid #ffffff" width="'+ news.headerImage.width +'" height="'+ news.headerImage.height +'" />';
			} else { 
				headerImage = '<img src="'+ news.artistImage +'" style="border: 1px solid #ffffff" width="250" height="138" />';
			}

			if(news.itemLinkText != "" || news.itemLink == "")
			{
				html += '<table width="640" cellspacing="0" cellpadding="5"><tr valign="top" align="left"><td width="250"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ headerImage +'</a><br/>'+ shareText +'</td><td width="430"><span id="contentHeadlineText"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ news.itemDate +' - ' + news.artistName +'</a></span><br/><span id="contentHeadlineTitle"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ news.itemTitle +'</a></span></td></tr></table><br/><br/>';
			} else {
				html += '<table width="640" cellspacing="0" cellpadding="5"><tr valign="top" align="left"><td width="250"><a href="' + news.itemLink + '" target="_blank">'+ headerImage +'</a><br/>'+ shareText +'</td><td width="430"><span id="contentHeadlineText"><a href="' + news.itemLink + '" target="_blank">'+ news.itemDate +' - ' + news.artistName +'</a></span><br/><span id="contentHeadlineTitle"><a href="' + news.itemLink + '" target="_blank">'+ news.itemTitle +'</a></span></td></tr></table><br/><br/>';
			}
			
		}	
	}

	document.getElementById('secondary_2').innerHTML = html;
	jQuery("#secondary_2").fadeIn(500);
}

function resetWhatsNew()
{ }

function load5Questions()
{
	setColor('5Questions');
	document.title = "Columbia Records | "+ contentObj[2].questions[0].itemTitle;
	var html = '<span id="contentTextTitle">'+ contentObj[2].questions[0].itemTitle +'</span><br/><span id="contentText">'+ contentObj[2].questions[0].itemBody +'</span>';
	document.getElementById('secondary_2').innerHTML = html;
	jQuery("#secondary_2").fadeIn(500);
}

function loadPress()
{
	getElement('secondary_1').style.width = "400px";
	getElement('secondary_2').style.width = "525px";
	
	var html = '<span id="secondaryContentText"><a id="pressPhotos" href="Javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(\'slow\', function() { loadPressPhotos(); });">Photos</a></span><br/><br/>';
	
	var artCount = 0;
	
	var pressHtml = "";
	for(var article in contentObj[1].press)
	{
		press = contentObj[1].press[article];
		pressHtml += '<div style="float: left; width: 100%; margin: 0px 0px 15px 3px"><span id="contentText"><font color="#999999">'+ press.itemDate +'</font></span><br/><span id="contentTextTitle"><a href="javascript:void(0);"  onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadPressHeadlines('+ article +') }); return false;">'+ press.itemTitle +'</a></span></div>';
		artCount++;
	}
	
	pressHtml += '<div style="float: left; width: 100%; margin: 0px 0px 15px 3px"><span id="contentText"><font color="#999999"><a href="http://columbiarecordsnews.tumblr.com/archive" target="_blank">Click here for archived press articles</a></font></span></div>';

	
	if(artCount > 0)
	{
		html += '<span id="secondaryContentText">Press Articles<br/></span>';
		html += pressHtml;
		
		document.getElementById('secondary_1').innerHTML = html;
	} 
	
	document.getElementById('secondary_1').innerHTML = html;

	if(calledTitle != null)
	{
		loadCalledPressHeadline();
	} else {
		loadPressPhotos();
	}
	jQuery("#secondaryContainer").fadeIn(500, function(){ document.getElementById('overlay').onclick =  function () { closeSecondary(); }; });
}

function loadPressPhotos()
{

	var html ="";
	
	document.title = "Columbia Records | Press Photos";
	
	for(var article in contentObj[0].galleries)
	{
		gallery = contentObj[0].galleries[article];		
		html += '<span id="contentTextTitle">'+ gallery.galleryTitle +'</span>';
		if(gallery.galleryTitle != "") html += '<br/><span id="contentText">'+ gallery.galleryDesc +'</span>';
		
		html += '<div style="float: left; width: auto; margin: 10px 0px 20px 0px;">';

		for(var image in gallery.images)
		{
			var thisPic = gallery.images[image];
			html += '<div style="float: left; width: 115px; height: 115px; overflow-x: hidden; overflow-y: hidden; margin: 3px; border: 1px #333333 solid">';
			html += '<a class="grouped_elements" title="'+ thisPic.caption +'" rel="group'+ gallery.galleryId +'" href="'+ thisPic.url +'"><img src="php/imagePush.php?img=../'+ thisPic.url +'&max=115" width="115" height="115" border="0" style="margin: 0px 0px 0px 0px; float: left; display: inline"></a>';
			html += '</div>';
		}
		
		html += '</div><div id="clearfix"></div>';
	}


	document.getElementById('secondary_2').innerHTML = html;
	jQuery("#secondary_2").fadeIn(500, function () { 
							jQuery("a.grouped_elements").fancybox({ 
								'transitionIn'	:	'elastic',
								'transitionOut'	:	'elastic',
								'speedIn'	:200, 
								'speedOut'	:200, 
								'titlePosition' : 'inside' 
								}); 
							});
}

function loadCalledPressHeadline()
{

	var html ="";
	
	html = '<span id="contentTextTitle">'+ calledTitle +'</span><br/><br/><span id="contentText">'+ calledContent +'</span><br/><br/>';
	html += '<div style="float:left"><iframe src="http://www.facebook.com/plugins/like.php?href='+ encodeURIComponent(calledUrl) +'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px"></iframe></div>';
	html += '<div style="float:left"><iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+ encodeURIComponent(calledUrl)  +'&via=ColumbiaRecords&count=horizontal&text='+ calledTitle +'" style="width:130px; height:20px;"></iframe></div>';
			

	document.getElementById('secondary_2').innerHTML = html;
	jQuery("#secondary_2").fadeIn(500);
	calledTitle = calledContent = calledUrl = null;
}

function loadPressHeadlines(itemId)
{

	var html ="";
	
	document.title = "Columbia Records | Press";
	
	for(var article in contentObj[1].press)
	{
		if(article == parseInt(itemId))
		{
			press = contentObj[1].press[article];
			
			document.title = "Columbia Records | Press - "+ press.itemTitle;
			
			var itemLink = "http://www.columbiarecords.com/press/"+ press.itemId;
			
			html = '<span id="contentTextTitle">'+ press.itemTitle +'</span><br/><br/><span id="contentText">'+ press.itemBody +'</span><br/><br/>';
			html += '<div style="float:left"><iframe src="http://www.facebook.com/plugins/like.php?href='+ encodeURIComponent(itemLink) +'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px"></iframe></div>';
			html += '<div style="float:left"><iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+ encodeURIComponent(itemLink)  +'&via=ColumbiaRecords&count=horizontal&text='+ press.itemTitle +'" style="width:130px; height:20px;"></iframe></div>';
			break;
		}

	}


	document.getElementById('secondary_2').innerHTML = html;
	jQuery("#secondary_2").fadeIn(500);
}

function loadBigRed()
{

	var itemId = 0;
	
	if(prelimItemId != null)
	{
		itemId = prelimItemId;
		prelimItemId = null;
	} 

	getElement('secondary_1').style.width = "210px";
	getElement('secondary_2').style.width = "700px";
	
	var html_1 = '<span id="contentTextTitle">Columbia Records<br/>Big Red Program</span><br/><br/>';
	html_1 += '<span id="contentText">The Big Red Program is a unique eight (8) week paid summer internship program dedicated to exploring digital initiatives and developing possible future talent for Columbia Records. Participants are grouped into teams, assigned a mentor from Columbia Records, and given a project to execute in support of developing artists and digital strategies. All selected participants will work out of the Columbia Records offices in New York City or Los Angeles from June 6, 2011 - July 29, 2011.</span>';
	
	document.getElementById('secondary_1').innerHTML = html_1;

	for(var article in contentObj[0].bigred)
	{
		if(contentObj[0].bigred[article].itemId == itemId)
		{
			news = contentObj[0].bigred[article];
			var itemLink = "http://www.columbiarecords.com/bigred/"+ itemId;

			document.title = "Columbia Records | Big Red - "+news.itemTitle;

			var shareText = '<div style="float:left"><iframe src="http://www.facebook.com/plugins/like.php?href='+ encodeURIComponent(itemLink) +'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px"></iframe></div>';
			shareText += '<div style="float:left"><iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+ encodeURIComponent(itemLink)  +'&via=ColumbiaRecords&count=horizontal&text='+ news.itemTitle +'" style="width:130px; height:50px;"></iframe></div>';

			if(news.headerImage.length == undefined)
			{
				headerImage = '<img src="'+ news.headerImage.url +'" style="border: 1px solid #ffffff" width="'+ news.headerImage.width +'" height="'+ news.headerImage.height +'" />';
			} else { 
				headerImage = '<img src="'+ news.artistImage +'" style="border: 1px solid #ffffff" width="250" height="138" />';
			}

			if(news.itemLinkText != "" || news.itemLink == "")
			{
				html += '<table width="640" cellspacing="0" cellpadding="5"><tr valign="top" align="left"><td width="250"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ headerImage +'</a><br/>'+ shareText +'</td><td width="430"><span id="contentHeadlineText"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ news.itemDate +' - ' + news.artistName +'</a></span><br/><span id="contentHeadlineTitle"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadNewsHeadlines('+ news.itemId +'); })">'+ news.itemTitle +'</a></span></td></tr></table>';
			} else {
				html += '<table width="640" cellspacing="0" cellpadding="5"><tr valign="top" align="left"><td width="250"><a href="' + news.itemLink + '" target="_blank">'+ headerImage +'</a><br/>'+ shareText +'</td><td width="430"><span id="contentHeadlineText"><a href="' + news.itemLink + '" target="_blank">'+ news.itemDate +' - ' + news.artistName +'</a></span><br/><span id="contentHeadlineTitle"><a href="' + news.itemLink + '" target="_blank">'+ news.itemTitle +'</a></span></td></tr></table><br/><br/>';
			}

			html += '<div style="float:right"><span id="contentText"><a href="javascript:void(0);" onclick="loadNewsHeadlines();">Click here for more Big Red news</a></span></div>';
			break;
		} else {
	
			news = contentObj[0].bigred[article];
			var itemLink = "http://www.columbiarecords.com/bigred/"+ itemId;

			document.title = "Columbia Records | Big Red";

			var shareText = '<div style="float:left"><iframe src="http://www.facebook.com/plugins/like.php?href='+ encodeURIComponent(itemLink) +'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=dark" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px"></iframe></div>';
			shareText += '<div style="float:left"><iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?url='+ encodeURIComponent(itemLink)  +'&via=ColumbiaRecords&count=horizontal&text='+ news.itemTitle +'" style="width:130px; height:50px;"></iframe></div>';

			var headerImage = "";
			if(news.headerImage.length == undefined)
			{
				headerImage = '<img src="'+ news.headerImage.url +'" style="border: 1px solid #ffffff" width="'+ news.headerImage.width +'" height="'+ news.headerImage.height +'" /><br/>';
			} 

			//html ='<div>'+ headerImage +'<span id="contentHeadlineText"><span id="contentHeadlineTitle">'+ news.itemTitle +'</a></span><br/>';
			html = '<div><span id="contentText">'+ news.itemBody +'</span></div>';
		}

	}
	
	document.getElementById('secondary_2').innerHTML = html;
		
		
	jQuery("#secondary_2").fadeIn(500);
	jQuery("#secondaryContainer").fadeIn(500, function(){ document.getElementById('overlay').onclick =  function () { closeSecondary(); }; });
		
}
		
function loadBigRedOld()
{

	getElement('secondary_1').style.width = "230px";
	getElement('secondary_2').style.width = "670px";
	
	var html_1 = '<span id="contentTextTitle">Columbia Records<br/>Big Red Program</span><br/>';
	html_1 += '<span id="contentText">This is some decription about the Big Red Progam. This is some decription about the Big Red Progam. This is some decription about the Big Red Progam. This is some decription about the Big Red Progam.</span>';
	
	document.getElementById('secondary_1').innerHTML = html_1;

	var html = "";
	
	switch(browserName)
	{
		case "ipad2":
		case "safari2":

			html+= '<video width="658" height="370" id="videoPlayer" controls>';
			html+= '</video>';
			
			break;

		default:
			html += '<object id="flashObj" width="658" height="370" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"><param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&isUI=1" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="@videoPlayer=775136432001&playerID=774780894001&playerKey=AQ~~,AAAACoDEbrE~,SpENPjUFEzJKunQGfBLDElQ4Huky3djG&domain=embed&dynamicStreaming=true" /><param name="base" value="http://admin.brightcove.com" /><param name="seamlesstabbing" value="false" /><param name="allowFullScreen" value="true" /><param name="swLiveConnect" value="true" /><param name="allowScriptAccess" value="always" /><embed src="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&isUI=1" bgcolor="#FFFFFF" flashVars="@videoPlayer=775136432001&playerID=774780894001&playerKey=AQ~~,AAAACoDEbrE~,SpENPjUFEzJKunQGfBLDElQ4Huky3djG&domain=embed&dynamicStreaming=true" base="http://admin.brightcove.com" name="flashObj" width="658" height="370" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>';
			break;
				
	}
	
	document.getElementById('secondary_2').innerHTML = html;
	
	
	//jQuery("#secondary_2").fadeIn(500);
	jQuery("#secondaryContainer").fadeIn(500, function(){ });

	switch(browserName)
	{
		case "ipad2":
		case "safari2":	
		
			var videoAjax = document.getElementsByTagName("video")[0];
			
			videoAjax.src = video.mp4;

			videoAjax.type = "video/mp4";

			videoAjax.load();
			break;
	
	}

}
function loadArtistPane()
{
	document.getElementById('overlay').onclick =  function () { closeSecondary(); };
	
	html = '<table width="100%" cellspacing="0" cellpadding="0" style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><tr valign="top" align="left"><td><span id="header28">ARTIST NEWS</span><td><tr></table>';
	getElement('secondary_1').style.width = "415px";
	getElement('secondary_2').style.width = "500px";


	for(var article in artistObj[0].news)
	{
		news = artistObj[0].news[article];
		
		html += '<table width="100%" cellspacing="0" cellpadding="5" style="padding: 5px 0px 0px 0px; border-bottom: 1px solid #333333"><tr valign="top" align="left"><td width="155"><a href="' + news.itemLink + '" target="_blank"><img src="'+ news.artistImage +'" style="border: 1px solid #ffffff" width="150" height="83" /></a></td><td width="390"><!-- <span id="artistHeadlineText"><a href="href="' + news.itemLink + '" target="_blank">'+ news.itemDate +' - ' + news.artistName +'</a></span><br/> --><span id="artistHeadlineText"><a href="' + news.itemLink + '" target="_blank">'+ news.itemTitle +'</a></span></td></tr></table>';
	}		
	document.getElementById('secondary_1').innerHTML = html;
	

	html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><span id="header28">ARTISTS BY GENRE</span></td></tr>';
	html += '<tr><td height="5" /></tr>';
	html += '<tr valign="top" align="left"><td><div id="genreDiv">';
	

	
	html += '</div></td></tr></table>';
	
	html += '<div id="genreaz"><table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><span id="header28">ARTISTS A-Z</span> <span id="genreListing"><A href="javascript:void(0);" onclick="loadArtistListing();">Click here for the master list</a></span><td><tr></table></div>';  	
	
	document.getElementById('secondary_2').innerHTML = html;
	
	loadGenres();
	
	document.getElementById('secondary_2').style.display = "block";
	jQuery("#secondaryContainer").fadeIn(500, function(){ document.getElementById('overlay').onclick =  function () { closeSecondary(); }; });

}

function loadGenre(genreNum)
{
	var genre = artistObj[1].genres[genreNum];
	
	html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px;"><span id="header24">'+ genre.genre.toUpperCase() +'</span><div style="position: absolute; top: 50px; left:864px;"><a href="javascript:void(0);" onclick="jQuery(\'#genreDiv\').fadeOut(500, function() { loadGenres(); });"><img src="images/genre_back.jpg" border="0" width="96" height="16" /></a></div></td></tr>';
	html += '<tr valign="top" align="left"><td>';
	html += '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td><table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td><table cellspacing="0" cellpadding="2">';
		
	
	for(var art in genre.artists)
	{
		
		html += '<tr valign="top" align="left"><td><span id="genreListing"><a href="Javascript:void(0);" onclick="jQuery(\'#secondaryContainer\').fadeOut(500, function(){loadArtistListing('+ genre.artists[art].id +', '+ genreNum +'); });">' + genre.artists[art].artistName +'</a></span></td></tr>';
		
		if(art > 0 && (art % 9 == 0)) html += '</table></td><td><table width="100%" cellspacing="0" cellpadding="2"><tr valign="top" align="left">';
	}
	
	html += '</table></td></tr></table></td></tr></table></td></tr></table>';
	
	document.getElementById('genreDiv').innerHTML = html;
	
	jQuery('#genreDiv').fadeIn(500);
	
}

function loadGenres()
{
	var html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td width="30%"><table cellspacing="0" cellpadding="2">';
	
	var it = 0;
	
	dividend = Math.ceil(artistObj[1].genres.length / 3);
	
	for(var gn in artistObj[1].genres)
	{
		var genre = artistObj[1].genres[gn].genre;
		
		html += '<tr valign="top" align="left"><td><span id="genreListing"><a href="Javascript:void(0);" onclick="loadArtistListing(null, '+ gn +');">' + genre +'</a></span></td></tr>';
		
		if(it > 0 && ((it + 1) % dividend == 0)) html += '</table></td><td width="5%"><img src="images/hr.jpg" width="1" height="187" /></td><td width="30%"><table width="100%" cellspacing="0" cellpadding="2"><tr valign="top" align="left">';
		
		it++;
	}
	
	html += '</table></td></tr></table>';
	
	document.getElementById('genreDiv').innerHTML = html;
	
	document.getElementById('genreDiv').style.height = "auto";
	jQuery('#genreDiv').fadeIn(500);
	
}

function reloadGenres()
{
	html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><span id="header28">ARTISTS BY GENRE</span></td></tr>';
	html += '<tr><td height="5" /></tr>';
	html += '<tr valign="top" align="left"><td><div id="genreDiv">';
	

	
	html += '</div></td></tr></table>';
	
	html += '<div id="genreaz"><table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><span id="header28">ARTISTS A-Z</span> <span id="genreListing"><A href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadAllArtists(); })">Click here for the master list</a></span><td><tr></table></div>';  	
	
	document.getElementById('secondary_2').innerHTML = html;
	
	loadGenres();
	
	jQuery('#secondary_2').fadeIn(500);
}

function loadAllArtists()
{


	html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><span id="header28">ARTISTS A-Z</span><div style="position: absolute; top:20px; left:865px;"><a href="javascript:void(0);" onclick="jQuery(\'#genreDiv\').fadeOut(500, function() { reloadGenres(); });"><img src="images/genre_back.jpg" border="0" width="96" height="16" /></a></div></td></tr>';
	html += '<tr><td height="5" /></tr>';
	html += '<tr valign="top" align="left"><td><div id="genreDiv">';
	

	
	html += '</div></td></tr></table>';
		
	document.getElementById('secondary_2').innerHTML = html;
	
	loadArtists();
	
	document.getElementById('secondary_2').style.display = "block";
	jQuery("#secondary_2").fadeIn(500, function(){});

}

function loadArtists()
{
	var html = '<table width="480" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td><table cellspacing="0" cellpadding="2">';
	
	var it = 0;
	
	for(var a in artistObj[2].artists)
	{
		var artist = artistObj[2].artists[a];
		
		html += '<tr valign="top" align="left"><td><span id="genreListing"><a href="Javascript:void(0);" onclick="loadArtistListing('+ artist.id +', '+ a +');">' + artist.artistName +'</a></span></td></tr>';
		
		if(it > 0 && ((it + 1) % 20 == 0)) html += '</table></td><td><table width="100%" cellspacing="0" cellpadding="2"><tr valign="top" align="left">';
		
		it++;
	}
	
	html += '</table></td></tr></table>';
	
	document.getElementById('genreDiv').innerHTML = html;
	
	document.getElementById('genreDiv').style.height = "340px";
	
	jQuery('#genreDiv').fadeIn(500);
	
}

function loadArtist(artist)
{

	var isThere = false;
	
	document.title = "Columbia Records | Artists";
	
	artist = artist.toLowerCase();
	 var artistNames = "";
	for(var thisArtist in artistObj[2].artists)
	{
		thisArtistName1 = artistObj[2].artists[thisArtist].artistName.toLowerCase();
		thisArtistName = thisArtistName1.replace(/ /g,'');
		
		switch(artist)
		{
			case "beyoncé":
			case "beyonc%E9":
				thisArtistName = "beyonce";
				break;
				
			case "celinédion":
			case "celin%E9dion":
				thisArtistName = "celinedoin";
				break;
				
		}
		
		if(thisArtistName == artist)
		{
			artistId = artistObj[2].artists[thisArtist].id;
			isThere = true;
			break;
		}
	}
	
	if(isThere == false) 
	{
	 	loadArtistPane();
	} else {
		loadArtistListing(artistId);
	}
	

}

var imageCount = 0;

var imageArray = new Array();

var currentArtistId = 0;

var currentArtistIndex = 0;

var currentArtistGenre = -1;

function loadArtistListing(artistId, thisGenreNum)
{

	loadGenresArtistPage();
	
	currentArtistIndex = 0
	
	currentArtistGenre = -1;
	
	var flowDivHTML  = "";

	flowDivHTML += '<div id="coverFlow" class="ContentFlow">';
	flowDivHTML += '<div class="loadIndicator"><div class="indicator"></div></div>';
	flowDivHTML += '<div id="flowDiv" class="flow"></div>';
	flowDivHTML += '<div class="globalCaption"></div>';
	flowDivHTML += '<div class="scrollbar"><div class="slider"><div class="position"></div></div></div>';
	flowDivHTML += '</div><div class="clearfix"></div>';

	document.getElementById('tertiary_1').innerHTML = flowDivHTML;
		
	imageCount = 0;
	
	currentArtistId = artistId;
	
	//currentArtistIndex = artistIndex;
	
	document.getElementById('itemcontainer').innerHTML = "";
	
	document.getElementById('loadingDiv').style.display = "block";
	
	document.getElementById('flowDiv').innerHTML = '';
	
	document.getElementById('overlay').onclick =  function () { closeTertiary(); };
	
	if(thisGenreNum != undefined)
	{
		currentArtistGenre = thisGenreNum;
		imageArray = artistObj[1].genres[thisGenreNum].artists;

	} else {
		imageArray = artistObj[2].artists;
	}

	loadImagesIntoContainer();
	jQuery("#secondaryContainer").fadeOut(0, function(){});
	jQuery("#tertiaryContainer").fadeIn(500, function(){});
}

function displayProgress(loaded, total)
{
	loaded = loaded + 1;
	var percentLoaded = (loaded /total) * 100;
	
	document.getElementById('progressText').innerHTML = '<span id="contentText">Please wait, loading artist image '+ loaded + ' of '+ total +' images</span>';
	document.getElementById('progressBar').style.width = percentLoaded +"%";
}
	
function loadImagesIntoContainer()
{

	displayProgress(imageCount, imageArray.length);
	
	if(imageCount < imageArray.length)
	{
		
		var artist = imageArray[imageCount];
	
		if(currentArtistId == artist.id) currentArtistIndex = imageCount;
			
		
		if(browserName == "msie")
		{
			flowHTML = '<img class="item" artistId="'+ artist.id +'" src="'+ artist.artistImage +'" title="'+ artist.artistName +'" />';

			document.getElementById('flowDiv').innerHTML += flowHTML;
				
			imageCount++;
		
			loadImagesIntoContainer();
			
		} else {

			var img=document.createElement("img");

			img.src= artist.artistImage;

			img.title= artist.artistName;

			img.setAttribute("class", "item");

			img.setAttribute("artistId", artist.id)
			
			img.setAttribute("onload", "loadImagesIntoContainer();");
			//img.onload=function() {loadImagesIntoContainer() };

			imageCount++;
			
			document.getElementById('flowDiv').appendChild(img);	
		}
		
		
		
	} else {
	
		
		document.getElementById('loadingDiv').style.display = "none";
		
		var flowDiv = document.getElementById('flowDiv');
		
		if(currentArtistId == null) currentArtistId = imageArray[0].id;
		
		//alert(flowDiv.innerHTML);
		
		if(ContentFlowGlobal.Flows.length > 1) ContentFlowGlobal.clear();
		
		var myNewFlow = new ContentFlow('coverFlow', { startItem: currentArtistIndex, reflectionHeight: 0, scaleFactor: 0.85, endOpacity: 0.7, circularFlow: false, flowSpeedFactor: 1.75, flowDragFriction: 0.2, visibleItems: 4} ) ;

		ContentFlowGlobal.onloadInit();
		
	     //	myNewFlow.init();
		
		loadArtistInfo(currentArtistId);
		
		
	}
}

function loadArtistInfo(artistId)
{

	var artist = artistObj[3].artistInfo[artistId]
	
	// BIO
	var tertiary_2 = document.getElementById('tertiary_2');
	
	tertiary_2.innerHTML = "";
	
	var columnHead = '<div style="width: 315px; padding: 0px 10px 5px 0px; float: left">';
	var column1HTML = columnHead;
	var column2HTML = columnHead;
	var column3HTML = '<div style="width: 315px; padding: 0px 10px 5px 0px; float: right">';
	
	var bioHTML = "";
	var videoHTML = "";
	var newsHTML = "";
	var eventsHTML = "";
	var suggestedHTML = "";
	var releaseHTML = "";
	
	// bio
	
	bioHTML = '<div style="width:100%; position: relative; height: 405px; margin:0px 0px 50px 0px"><span id="header24">'+ artist.artistName +'</span><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/>';
	
	var website = "";
	var myspace = "";
	var twitter = "";
	var facebook = "";
	
	for(var lk in artist.links)
	{
		switch(artist.links[lk].linkName)
		{
			case "Website":
				website = artist.links[lk].linkUrl;
				break;
				
			case "Myspace":
				myspace = artist.links[lk].linkUrl;
				break;
				
			case "Twitter":
				twitter = artist.links[lk].linkUrl;
				break;

			case "Facebook":
				facebook = artist.links[lk].linkUrl;
				break;
		}
	}
	
	
	var sitesHTML = '<div style="width: 100%; float:left; text-align:left">';
	var likeHTML = "";
	
	if(website != "") sitesHTML += '<a href="'+ website +'" target="_blank"><img src="images/website.jpg" border="0" style="margin: 0px 0px 0px 0px" /></a>';
	if(twitter != "") sitesHTML += '<a href="'+ twitter +'" target="_blank"><img src="images/twitter.jpg" border="0" style="margin: 0px 0px 0px 3px" /></a>';
	if(myspace != "") sitesHTML += '<a href="'+ myspace +'" target="_blank"><img src="images/myspace.jpg" border="0" style="margin: 0px 0px 0px 3px" /></a>';
	if(facebook != "")
	{
		sitesHTML += '<a href="'+ facebook +'" target="_blank"><img src="images/facebook.jpg" border="0" style="margin: 0px 3px 0px 3px" /></a><iframe src="http://www.facebook.com/plugins/like.php?href='+ escape(facebook) +'&amp;layout=button_count&amp;show_faces=true&amp;width=90&amp;action=like&amp;colorscheme=dark&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:23px;" allowTransparency="true"></iframe>';
	}	
	
	bioHTML += sitesHTML + '</div><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/>';
	
	bioHTML += '<div style="position: relative; width: 100%; height: 290px; overflow-x: hidden; overflow-y:hidden"><div id="bioTrunc" style="position: absolute; width: 305px; left: 0; top: 0; z-index:1"><span id="contentText">'+ artist.artistBio +'</span></div><div id="bioFull" class="initiallyHidden" style="height: 100%; overflow-x: hidden; overflow-y: hidden"><span id="contentText">'+ artist.artistBio +'</span></div><div id="bioThumb" style="position:absolute; height:50px; width:10px; background-color:#eee; border:1px outset #eee; left:305px; top:0; z-index:2;"></div></div><div style="position: absolute; top: 394px; left:0px; height: 11px; width: 100%;"><img src="images/hr.jpg" width="100%" height="1"/></div></div>';
	
	if(artist.videos.length > 0)
	{
		videoHTML = '<div style="width: 100%; float: left; margin:0px 0px 50px 0px"><span id="header24">Videos</span><br/><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/><br/><div id="videoDiv"></div>';
		
		var videoListing = "";
		
		videoTruncHTML = '<div id="videosTrunc" style="height: 70px; overflow-x: hidden; overflow-y:hidden">'; 
		videoFullHTML = '<div id="videosFull" class="initiallyHidden" style="height: 100%; overflow-x: hidden; overflow-y: hidden">';
		

		for(var thisVid in artist.videos)
		{
			var video = artist.videos[thisVid];
			videoListing += '<div style="float:left;';
			
			if((parseInt(thisVid) + 1) % 4 != 0)
			{
				videoListing += 'padding: 0px 11px 11px 0px;';
			} else {
				videoListing += 'padding: 0px 0px 11px 0px;';
			}

			
			videoListing += '"><div id="videoThumbDiv">';

			videoListing += '<a href="javascript:void(0);" onclick="loadArtistVideo('+ video.videoId +');"><img src="php/imagePush.php?img='+ video.videoThumb+'&max=70" style="margin: 0px 0px 0px 0px; border-width: 0px; display: inline" title="'+ video.videoTitle +'"/></a></div></div>';
		}
		

		videoTruncHTML += videoListing + '</div>';
		
		videoHTML += videoTruncHTML;
		
		if(artist.videos.length > 4)
		{
			videoFullHTML += videoListing + "</div>";
			videoHTML += videoFullHTML;
			videoHTML += '<br/><img src="images/hr.jpg" width="100%" height="1" /><br/><div id="videosButton" style="float: right"><a href="javascript:void(0);" onclick="toggleDivs(\'videos\');"><img src="images/moreArtist.jpg" border="0" /></a></div>'
		}
		
		videoHTML  += '</div>';
		
	}
	
	// news
	
	if(artist.feedUrl != "") newsHTML = '<div style="position: relative; width: 100%; height: 405px; margin:0px 0px 50px 0px"><span id="header24">News</span><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/><div id="newsDiv" style="position: relative; width: 100%; height: 350px; overflow-x: hidden; overflow-y:hidden"><div style="text-align: center"><img src="images/loading.gif" /></div></div><div style="position: absolute; top: 394px; left:0px; height: 11px; width: 100%;"><img src="images/hr.jpg" width="100%" height="1"/></div></div>';
	
	// releases
	
	if(artist.releases.length > 0)
	{
		releaseHTML = '<div style="width:100%; float: left; margin:0px 0px 50px 0px"><span id="header24">Releases</span><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/><div id="clearfix"></div>';

		releaseTruncHTML = '<div style="position: relative; width: 100%; height: 290px; overflow-x: hidden; overflow-y:hidden"><div id="releasesTrunc" style="position: absolute; width: 305px; left: 0; top: 0; z-index:1">'; 
		//releaseFullHTML = '<div id="releasesFull" class="initiallyHidden" style="height: 100%; overflow-x: hidden; overflow-y: hidden">';
		
		var releaseListing = "";
		
		var releaseCount = 0;
		
		for(var thisRel in artist.releases)
		{
			var release = artist.releases[thisRel];
			
			releaseListing += '<div><table width="100% cellspacing="0" cellpadding="0"><tr valign="top"><td width="80"><img src="' + release.covers["COVER100"] +'" width="75" height="75" /></td>';
			releaseListing += '<td><span id="releaseTitle">'+ release.releaseTitle +'</span><br/><br/><span id="radioInfoText">';
			
			for(var linkNum in release.links)
			{
				var thisLink = release.links[linkNum];
				
				releaseListing += '<a href="' + thisLink.linkUrl +'" target="_blank">'+ thisLink.linkName +'</a>  ';
			}
			
			releaseListing += '</span></td></tr></table></div>';
			
			if(thisRel < (artist.releases.length - 1)) releaseListing += '<img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/>';
		}
		
		releaseTruncHTML += releaseListing +'</div>';
		
		/*
		if(artist.releases.length > 3)
		{
			releaseFullHTML += releaseListing + "</div>";
			releaseHTML += releaseFullHTML;
			releaseHTML += '<br/><div id="releasesButton" style="float: right"><a href="javascript:void(0);" onclick="toggleDivs(\'releases\');"><img src="images/moreArtist.jpg" border="0" /></a></div>'
		}
		*/
		releaseTruncHTML += '<div id="relThumb" style="position:absolute; height:50px; width:10px; background-color:#eee; border:1px outset #eee; left:305px; top:0; z-index:2;"></div></div>';
		
		releaseHTML += releaseTruncHTML;
		
		releaseHTML += "</div>";
	}
	
	// events
	
	if(artist.events.length > 0)
	{
	
		eventsHTML = '<div style="width: 100%; float: left; height: 355px; margin:0px 0px 50px 0px"><span id="header24">Upcoming Events</span><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/>';
		eventsHTML += '<div style="position: relative; width: 100%; height: 290px; overflow-x: hidden; overflow-y:hidden"><div id="eventTrunc" style="position: absolute; width: 305px; left: 0; top: 0; z-index:1">';
		
		for(evt in artist.events)
		{
			var event = artist.events[evt];
			
			var html = "";
			
			html += '<span id="tourListing"><b>'+ event.eventDate + '</b>  ';
			
			if(event.tickets != "")
			{
				if(event.tickets == "sold out" || event.tickets == "SOLD OUT")
				{
					html += '<img src="images/soldout.jpg" width="60" height="16" border="0" /><br/>';	
				} else {
					html += '<a href="' + event.tickets +'" target="_blank"><img src="images/buy_tickets.jpg" width="60" height="16" border="0" /></a><br/>';
				}
			}
			
			html += '<span id="tourListing">'+event.venue +'<br/></span><span id="tourListingSub">';

			var venueLocation = "";
			if(event.city != "") venueLocation += event.city;

			if(event.state != "")
			{
				if(event.city != "")
				{
					venueLocation += ', '+ event.state;
				} else {
					venueLocation += event.state;
				}
			}

			if(event.country !="")
			{
				venueLocation += ', '+ event.country;
				if(event.city != "" || event.state != "")
				{
					venueLocation += ', '+ event.country;
				} else {
					venueLocation += event.country;
				}		
			}

			html += venueLocation + '<br/>';

			if(event.infoLink != "")
			{
				html += '<a href="' + event.infoLink +'" target="_blank">More Info</a><br/>';	
			}
			html += '</span><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/>';
			
			eventsHTML += html;
			
			if(evt > 5) break;
		}
		
		eventsHTML += '</div><div id="eventThumb" style="position:absolute; height:50px; width:10px; background-color:#eee; border:1px outset #eee; left:305px; top:0; z-index:2;"></div></div><div class="clearfix"></div><div style="float: right"><a href="javascript:void(0);" onclick="jQuery(\'#tertiaryContainer\').fadeOut(200, function() { trackPage(\'/events\', \'Events Page\', \'events\'); getContent(\'events\', '+ artistId +'); });"><img src="images/moreArtist.jpg" border="0" /></a></div></div>';
	}

	// related artists
	
	var relatedArtists = new Array;
	
	if(artist.genres.length > 1)
	{
		for(var gn1 in artist.genres)
		{

			for(var gn2 in artistObj[1].genres)
			{
				if(artist.genres[gn1] == artistObj[1].genres[gn2].genre)
				{
					for(var art1 in artistObj[1].genres[gn2].artists)
					{
						if(!checkForId(relatedArtists, artistObj[1].genres[gn2].artists[art1].id) && artistObj[1].genres[gn2].artists[art1].id != artistId) relatedArtists.push(artistObj[1].genres[gn2].artists[art1]);
					}
				}
			}
			if(gn1 == 1) break;
			
		}
	} else {
		
		for(var gn2 in artistObj[1].genres)
		{
			if(artist.genres[0] == artistObj[1].genres[gn2].genre)
			{
				for(var art1 in artistObj[1].genres[gn2].artists)
				{
					if(!checkForId(relatedArtists, artistObj[1].genres[gn2].artists[art1].id) && artistObj[1].genres[gn2].artists[art1].id != artistId) relatedArtists.push(artistObj[1].genres[gn2].artists[art1]);
				}
			}
		}
	}
	
	var tempRand = 0;
	
	var relatedHTML = "";

	if(relatedArtists.length > 0)
	{
		relatedHTML = '<div style="width: 100%; float: left; height: 355px; margin:0px 0px 50px 0px"><span id="header24">Suggested Artists</span><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/>';
		
		switch(relatedArtists.length)
		{
			case "1":
			case "2":
			
				for(x = 0; x < relatedArtists.length; x++)
				{
					relatedHTML += '<div style="position: relative; width: 315px; height:173px; overflow: hidden; border: 1px solid #333333; margin: 0px 0px 10px 0px">';
					relatedHTML += '<div style="position: absolute; z-index:0; width: 315px; height:173; top: 0px; left: 0px"><a href="Javascript:void(0);" onclick="jQuery(\'#tertiary_2\').fadeOut(200, function() { loadSuggestedArtist('+ relatedArtists[randomnumber].id +') });"><img src="'+ relatedArtists[x].artistImage +'" width="315" height="173" border="0" /></a></div>';
					relatedHTML += '<div style="position: absolute; z-index:1; width: 315px; height:17;top: 157px; left: 0px; background-image: url(images/overlay.png);"><span id="suggestedText"><a href="Javascript:void(0);" onclick="jQuery(\'#tertiary_2\').fadeOut(200, function() { loadSuggestedArtist('+ relatedArtists[x].id +') });">'+ relatedArtists[x].artistName +'</a></span></div>';
					relatedHTML += '</div>';
				}
				break;
			
			default:
	
				var randomnumber = Math.floor(Math.random()*relatedArtists.length);
				for(x = 0; x < 2; x++)
				{
					if(randomnumber != tempRand)
					{
						tempRand = randomnumber;
						relatedHTML += '<div style="position:relative; width: 315px; height:173px; overflow: hidden; border: 1px solid #333333; margin: 0px 0px 10px 0px">';
						relatedHTML += '<div style="position: absolute; z-index:0; width: 315px; height:173; top: 0px; left: 0px"><a href="Javascript:void(0);" onclick="jQuery(\'#tertiary_2\').fadeOut(200, function() { loadSuggestedArtist('+ relatedArtists[randomnumber].id +') });"><img src="'+ relatedArtists[randomnumber].artistImage +'" width="315" height="173" border="0" /></a></div>';
						relatedHTML += '<div style="position: absolute; z-index:1; width: 315px; height:17;top: 157px; left: 0px; background-image: url(images/overlay.png);"><span id="suggestedText"><a href="Javascript:void(0);" onclick="jQuery(\'#tertiary_2\').fadeOut(200, function() { loadSuggestedArtist('+ relatedArtists[randomnumber].id +') });">'+ relatedArtists[randomnumber].artistName +'</a></span></div>';
						relatedHTML += '</div>';
					} else {
						x--;
					}
					randomnumber = Math.floor(Math.random()*relatedArtists.length);
				
				}
				break;
		}
		relatedHTML += '</div>';
	}
	
	var pageArray = new Array;
	
	pageArray.push(bioHTML);
	
	if(newsHTML != "") pageArray.push(newsHTML);
	if(videoHTML != "") pageArray.push(videoHTML);
	if(relatedHTML != "") pageArray.push(relatedHTML);
	if(releaseHTML != "") pageArray.push(releaseHTML);
	if(eventsHTML != "") pageArray.push(eventsHTML);
	

	for(var nd in pageArray)
	{
		switch(nd)
		{
			case "0":
			case "3":
			case "6":
				column1HTML += pageArray[nd];
				break;
				
			case "1":
			case "4":
			case "7":
				column2HTML += pageArray[nd];
				break;
				
			case "2":
			case "5":
			case "8":
				column3HTML += pageArray[nd];
				break;
		}
	}
	
	column1HTML += "</div>";  column2HTML += "</div>";  column3HTML += "</div>";
	
	tertiary_2.innerHTML += column1HTML + column2HTML + column3HTML;

	if(artist.feedUrl != "") printArtistNews(artist.feedUrl, artist.feedType);
	
	if(artist.videos.length > 0) loadArtistVideo(artist.videos[0].videoId);
	
	jQuery('#tertiary_2').fadeIn(300, function() { setScrollBars() });
}

function setScrollBars()
{

	var divMaskHeight = 290;
	
	if(document.getElementById("releasesTrunc") != null)
	{
		var relThumb = document.getElementById("relThumb");
		var relDiv = document.getElementById("releasesTrunc");
		var relOffsetHeight = relDiv.offsetHeight;

		if(relOffsetHeight > divMaskHeight)
		{
			Drag.init(relThumb, null, 305, 305, 0, (divMaskHeight - 50));
				relThumb.onDrag = function(x, y) {
				var dragPercent = (y / (divMaskHeight - 50));
				var scrollDif = relOffsetHeight - divMaskHeight;
				relDiv.style.top= "-"+scrollDif * dragPercent +"px";
			}
		} else {
			relThumb.style.display = "none";
		}
	}
	
	if(document.getElementById("bioTrunc") != null)
	{
		var bioThumb = document.getElementById("bioThumb");
		var bioDiv =document.getElementById("bioTrunc");
		var bioOffsetHeight = bioDiv.offsetHeight;
		//alert(bioOffsetHeight);
		if(bioOffsetHeight > divMaskHeight)
		{
			Drag.init(bioThumb, null, 305, 305, 0, (divMaskHeight - 50));
				bioThumb.onDrag = function(x, y) {
				var dragPercent = (y / (divMaskHeight - 50));
				var scrollDif = bioOffsetHeight - divMaskHeight;
				bioDiv.style.top= "-"+scrollDif * dragPercent +"px";
			}
		} else {
			bioThumb.style.display = "none";
		}
	}
	
	if(document.getElementById("eventTrunc") != null)
	{
		var eventThumb = document.getElementById("eventThumb");
		var eventDiv = document.getElementById("eventTrunc");
		var eventOffsetHeight = eventDiv.offsetHeight;

		if(eventOffsetHeight > divMaskHeight)
		{
			Drag.init(eventThumb, null, 305, 305, 0, (divMaskHeight - 50));
				eventThumb.onDrag = function(x, y) {
				var dragPercent = (y / (divMaskHeight - 50));
				var scrollDif = eventOffsetHeight - divMaskHeight;
				eventDiv.style.top= "-"+scrollDif * dragPercent +"px";
			}
		} else {
			eventThumb.style.display = "none";
		}
	}
}

function setScrollBarsNews()
{

	var divMaskHeight = 350;
	
	var newsThumb = document.getElementById("newsThumb");
	var newsDiv =document.getElementById("newsTrunc");
	var newsOffsetHeight = newsDiv.offsetHeight;
	
	if(newsOffsetHeight > divMaskHeight)
	{
		Drag.init(newsThumb, null, 305, 305, 0, (divMaskHeight - 50));
			newsThumb.onDrag = function(x, y) {
			var dragPercent = (y / (divMaskHeight - 50));
			var scrollDif = newsOffsetHeight - divMaskHeight;
			newsDiv.style.top= "-"+scrollDif * dragPercent +"px";
		}
	} else {
		newsThumb.style.display = "none";
	}
	
}

function loadSuggestedArtist(id)
{

	var caught = false;
	var thisIndex = 0;
	
	for(var sug in ContentFlowGlobal.Flows[0].items)
	{
		if(id == ContentFlowGlobal.Flows[0].items[sug].content.getAttribute('artistId'))
		{
			caught = true;
			thisIndex = sug;
		}
	}
	
	if(caught == true)
	{
		ContentFlowGlobal.Flows[0].moveToIndex(thisIndex);
	} else {
		loadArtistListing(id);
	}
}

function checkForId(array, id)
{
	for(var check in array)
	{
		if(id == array[check].id) return true;
	}
	
	return false;
}
		
function loadGenresArtistPage()
{
	var html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td width="50%"><table cellspacing="0" cellpadding="2">';
	
	var it = 0;
	
	var dividend = Math.ceil(artistObj[1].genres.length / 2);
	
	for(var gn in artistObj[1].genres)
	{
		var genre = artistObj[1].genres[gn].genre;
		
		html += '<tr valign="top" align="left"><td><span id="genreListing"><a href="Javascript:void(0);" onclick="showGenrePane(); jQuery(\'#tertiary_2\').fadeOut(200, function() { loadArtistListing(null, '+ gn +'); });">' + genre +'</a></span></td></tr>';
		
		if(it > 0 && ((it + 1) % dividend == 0)) html += '</table></td><td width="50%"><table width="100%" cellspacing="0" cellpadding="2"><tr valign="top" align="left">';
		
		it++;
	}
	
	html += '</table></td></tr><tr><td style="padding: 10px 0px 0px 0px"><span id="genreListing"><a href="Javascript:void(0);" onclick="showGenrePane(); jQuery(\'#tertiary_2\').fadeOut(200, function() { loadArtistListing(); });">Full Artist Listing (A - Z)</a></span></td></tr></table>';
	
	html += '<br/><div id="closeButton" style="float:right"><a href="Javascript:void(0);" onclick="showGenrePane();"><img src="images/close_button_s.png" border="0"></a></div>';
	document.getElementById('tertiaryGenreListing').innerHTML = html;
	
	document.getElementById('tertiaryGenreListing').style.height = "auto";
	jQuery('#tertiaryGenreDiv').fadeIn(500);
	
}

function loadArtistVideo(videoId)
{

	document.getElementById('videoDiv').innerHTML = '<embed src="http://c.brightcove.com/services/viewer/federated_f9/557970707001?isVid=1&isUI=1" bgcolor="#FFFFFF" flashVars="@videoPlayer='+videoId+'&playerID=557970707001&&domain=embed&dynamicStreaming=true" base="http://admin.brightcove.com" name="flashObj" width="320" height="240" seamlesstabbing="false" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" swLiveConnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
}

// ArtistNews feed

var oXMLHttpArtistNews;

function GetArtistNewsXMLHttpObject()
{
     oXMLHttpArtistNews = null;

      try
      {
            oXMLHttpArtistNews = new ActiveXObject("MSXML2.XMLHTTP");
      }
      catch (E)
      {
            try
            {
                  oXMLHttpArtistNews = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E)
            {
              oXMLHttpArtistNews = null;
            }
    }

      if ((oXMLHttpArtistNews == null) && (typeof(XMLHttpRequest) != 'undefined'))
      {
            oXMLHttpArtistNews = new XMLHttpRequest();
      }

      return oXMLHttpArtistNews;
}


var newsObj = new Object;

function printArtistNews(url, feedType)
{

	if(oXMLHttpArtistNews)
	{
		oXMLHttpArtistNews.abort();
	}

	oXMLHttpArtistNews = GetArtistNewsXMLHttpObject();

	var url = "php/getArtistNews.php?url="+ url+"&feedType="+  feedType;

	oXMLHttpArtistNews.open("POST", url, true);

	oXMLHttpArtistNews.onreadystatechange = function()
	    {
		  if (oXMLHttpArtistNews.readyState == 4)
		  {
			var JSONObject = new Object;

			var response = oXMLHttpArtistNews.responseText;

			//alert(response);
			JSONObject = JSON.parse(response);

			newsObj = JSONObject.News;

			var thisHTML = '<div id="newsTrunc" style="position: absolute; width: 305px; left: 0; top: 0; z-index:1">';
			
			for(var newsArt in newsObj)
			{
			
				var news = newsObj[newsArt];
				
				thisHTML += '<div><span id="artistHeadlineText"><a href="' + news.itemLink + '" target="_blank">'+ news.itemDate +'</a></span><br/><span id="artistHeadlineTitle"><a href="' + news.itemLink + '" target="_blank">'+ news.itemTitle +'</a></span></div>';
				
				if(newsArt < (newsObj.length - 1) && newsArt < 4) thisHTML += '</span><br/><img src="images/hr.jpg" width="100%" height="1" /><br/>';
				
				if(newsArt == 4) break;
			}
		
			thisHTML += '</div><div id="newsThumb" style="position:absolute; height:50px; width:10px; background-color:#eee; border:1px outset #eee; left:305px; top:0; z-index:2;"></div>';
			document.getElementById('newsDiv').innerHTML = thisHTML;
			setScrollBarsNews();
		  }
	    }

	oXMLHttpArtistNews.send(null);

}


function toggleDivs(id)
{

	var buttonDiv = id+"Button";
	
	var button = document.getElementById(buttonDiv).getElementsByTagName('img')[0];
	
	switch(id)
	{
		case "bio":
			var trunc = document.getElementById('bioTrunc');
			var full = document.getElementById('bioFull');
			break;

		case "releases":
			var trunc = document.getElementById('releasesTrunc');
			var full = document.getElementById('releasesFull');
			break;
			
		case "videos":
			var trunc = document.getElementById('videosTrunc');
			var full = document.getElementById('videosFull');
			break;
			
	}
	
	if(trunc.style.display == "none")
	{
		trunc.style.display = "block";
		full.style.display = "none";
		button.src = "images/moreArtist.jpg";
		
	} else {
		trunc.style.display = "none";
		full.style.display = "block";
		button.src = "images/lessArtist.jpg";
	}
}

function showGenrePane()
{
	var tertDiv = document.getElementById('tertiaryGenreListing');
	if(tertDiv.style.display == "block")
	{
		jQuery("#tertiaryGenreListing").slideUp();
		document.getElementById('closeGenreButton').getElementsByTagName('img')[0].src = 'images/genre_open.jpg';

	} else {
		
		jQuery("#tertiaryGenreListing").slideDown();
		document.getElementById('closeGenreButton').getElementsByTagName('img')[0].src = 'images/genre_close.jpg';
	}
}

function addPictures(){
        var ic = document.getElementById('itemcontainer');
        var is = ic.getElementsByTagName('img');
        for (var i=0; i< is.length; i++) {
            myNewFlow.addItem(is[i], 'last');
        }
}


function loadEventsPane(artistId)
{

	document.title = "Columbia Records | Events";

	html = '<table width="100%" cellspacing="0" cellpadding="0" style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><tr valign="top" align="left"><td><span id="header28">ARTISTS ON TOUR</span><td><tr></table>';
	getElement('secondary_1').style.width = "325px";
	getElement('secondary_2').style.width = "575px";

	html += '<tr valign="top" align="left"><td>';
	html += '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td><div id="artistTourList"><table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td>';

	var it = 0;
	
	for(var art in contentObj[1].listing)
	{
		artist = contentObj[1].listing[art];
		
		html += '<span id="genreListing"><a href="javascript:void(0);" onclick="jQuery(\'#secondary_2\').fadeOut(500, function() { loadArtistEvents(\''+ artist.artistId +'\'); })">'+ artist.artistName +'</span></a><br/>';
		
		if(it > 0 && ((it + 1) % 20 == 0)) html += '</td><td>';
		
		it++;
	}		
	
	html += '</td></tr></table></div></td></tr></table>';
	
	document.getElementById('secondary_1').innerHTML = html;
	

	html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><span id="header28">UPCOMING APPEARANCES</span></td></tr>';
	html += '<tr><td height="5" /></tr>';
	html += '<tr valign="top" align="left"><td><div id="artistTourDatesDiv">';
	

	
	html += '</div></td></tr></table>';
		
	document.getElementById('secondary_2').innerHTML = html;
	
	if(artistId == null) 
	{
		loadEventsToday();
	} else {
		loadArtistEvents(artistId);
	}
	
	document.getElementById('secondary_2').style.display = "block";
	

	jQuery("#secondaryContainer").fadeIn(500, function(){});

}

function loadEventsToday()
{
	var html = '<table width="100%" cellspacing="5" cellpadding="0"><tr valign="top" align="left"><td>';
	
	var it = 0;
	
	var thisDate = "";
	
	var dateSegment = contentObj[0].today;
	
	for(property in dateSegment)
	{
		dates = dateSegment[property];
		
		html += '<div style="float: left; width: 100%;  height:auto; padding: 3px 3px 3px 0px; margin-bottom: 10px"><span id="tourListing"><b>'+ property +'</b></span></div>';
		
		for(var gn in dates)
		{
		
			var event = dates[gn];
			
			html += '<div style="float:left; width: 265px;  height:75px; border: 1px solid #333333; margin: 0px 3px 0px 0px"><div style="width: 80px; float:left;"><div id="imageDiv"><div style="position:relative; left: -30px; top: 0px"><img src="'+ event.artistImage +'" width="136" height="75" style="margin: 0px 0px 0px 0px; display: inline" /></div></div></div><div style="width: 175px; float:left;"><div id="tourListing"><b>'+ event.artistName +'</b><br/>'+ event.venue +'<br/></div><div id="tourListingSub">';

			var venueLocation = "";
			if(event.city != "") venueLocation += event.city;

			if(event.state != "")
			{
				if(event.city != "")
				{
					venueLocation += ', '+ event.state;
				} else {
					venueLocation += event.state;
				}
			}

			if(event.country !="")
			{
				venueLocation += ', '+ event.country;
				if(event.city != "" || event.state != "")
				{
					venueLocation += ', '+ event.country;
				} else {
					venueLocation += event.country;
				}		
			}

			html += venueLocation + '<br/>';

			if(event.infoLink != "")
			{
				html += '<a href="' + event.infoLink +'" target="_blank">More Info</a><br/>';	
			}

			if(event.tickets != "")
			{
				if(event.tickets == "sold out" || event.tickets == "SOLD OUT")
				{
					html += '<img src="images/soldout.jpg" width="60" height="16" border="0" />';	
				} else {
					html += '<a href="' + event.tickets +'" target="_blank"><img src="images/buy_tickets.jpg" width="60" height="16" border="0" /></a><br/>';
				}
			}

			html += '</div></div></div>';

			//if(it > 0 && ((it + 1) % 2 == 0)) html += '</tr><tr valign="top" align="left">';

	
		}
		html += '<div style="width: 100%; height 1px; clear:both; margin-bottom: 10px"></div>';
		
		it++;
	}
	
	html += '</td></tr></table>';
	
	if(it < 1)
	{
		html = '<div style="float: left; width: 543px;  height:auto; padding: 3px 3px 3px 0px; margin-bottom: 10px"><span id="tourListing">There are no upcoming appearances this week, please select an artist on tour from the left for dates further in the future.</span></div>';
	}
	
	document.getElementById('artistTourDatesDiv').innerHTML = html;
		
	
	document.getElementById('artistTourDatesDiv').style.height = "347px";;
	//jQuery('#artistTourDatesDiv').fadeIn(500);
	
}

function loadArtistEvents(artistNum)
{

	document.title = "Columbia Records | Events";
	
	var artist = contentObj[2].artistEvents[artistNum];
	
	html = '<table width="100%" cellspacing="0" cellpadding="0"><tr valign="top" align="left"><td style="padding: 0px 0px 0px 5px; border-bottom: 1px solid #333333"><span id="header28">'+ artist.artistName.toUpperCase() +'</span></td></tr>';
	html += '<tr><td height="20" /></tr>';
	html += '<div style="position: absolute; top: 45px; left:390px;"><span id="tourListing" width="100"><u>Date</u></span></div><div style="position: absolute; top: 45px; left:520px;"><span id="tourListing"><u>Venue</u></span></div><div style="position: absolute; top: 45px; left:840px;"><span id="tourListing" width="100"><u>Tickets</u></span></div>';
	html += '<tr valign="top" align="left"><td><div id="artistTourDatesDiv">';
	html += '<table width="100%" cellspacing="5" cellpadding="0">';
	var it = 0;
	
	for(var gn in artist.events)
	{
		var event = artist.events[gn];
		
		if(it % 2 == 0)
		{
			bgColor = "#1e1e1e";
		} else {
			bgColor = "transparent";
		}
		
		html += '<tr valign="top" align="left"><td><table width="100%" cellspacing="0" cellpadding="0" style="background-color: '+ bgColor +';border: 1px solid #333333"><tr valign="top" align="left"><td width="130"><span id="tourListing"><b>'+ event.eventDate + '</b></td><td><span id="tourListing">'+event.venue +'<br/></span><span id="tourListingSub">';
		
		var venueLocation = "";
		if(event.city != "") venueLocation += event.city;
		
		if(event.state != "")
		{
			if(event.city != "")
			{
				venueLocation += ', '+ event.state;
			} else {
				venueLocation += event.state;
			}
		}
		
		if(event.country !="")
		{
			venueLocation += ', '+ event.country;
			if(event.city != "" || event.state != "")
			{
				venueLocation += ', '+ event.country;
			} else {
				venueLocation += event.country;
			}		
		}
		
		html += venueLocation + '<br/>';

		if(event.infoLink != "")
		{
			html += '<a href="' + event.infoLink +'" target="_blank">More Info</a><br/>';	
		}
		html += '</span></td>';
		html += '<td width="100">';
			if(event.tickets != "")
		{
			if(event.tickets == "sold out" || event.tickets == "SOLD OUT")
			{
				html += '<img src="images/soldout.jpg" width="60" height="16" border="0" />';	
			} else {
				html += '<a href="' + event.tickets +'" target="_blank"><img src="images/buy_tickets.jpg" width="60" height="16" border="0" /></a><br/>';
			}
		}
		html += '</td>';
		html += '</tr></table></td></tr>';
	
		
		it++;
	}
	
	html += '</table></div></td></tr></table>';
	
	document.getElementById('secondary_2').innerHTML = html;
	
	document.getElementById('artistTourDatesDiv').style.height = "330px";
	jQuery('#secondary_2').fadeIn(500);
	
}

function loadAbout()
{
	closeAll();
	var contentHeight = 375;
	var aboutBlurb = '<center><div style="width: 980px; padding-top: 290px; padding-bottom: 10px;">';
	var thisHTML = '<div style="width: 310px; float:left; margin-right: 20px;"><span  id="header24">About Columbia Records</span><br/><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/>';
	thisHTML += '<div style="position: relative; width: 100%; height:'+ contentHeight +'px; overflow-x: hidden; overflow-y:hidden"><div id="aboutTrunc" style="position: absolute; width: 295px; left: 0; top: 0; z-index:1; text-align: left">';
	
	thisHTML += '<span id="contentText">';
	
	thisHTML += "Columbia Records is an American record label that was founded in 1888, evolving from an earlier enterprise, the American Graphophone Company - successor to the Volta Graphophone Company. Columbia Records is the oldest surviving brand name in pre-recorded sound, being the first record company to produce pre-recorded records as opposed to blank cylinders. From 1961 to 1990, the label's recordings were released outside the U.S. and Canada on the CBS Records label before officially being renamed Columbia Records on January 1, 1991.<br/><br/>";
	thisHTML += "Today, Columbia Records is one of the most respected and successful record labels in the world, being home to established superstars and exciting new talent. Columbia Records operates as an imprint of the Columbia/Epic Label Group under Label Group Chairman Rob Stringer and Columbia Records Chairman Steve Barnett and is owned by Sony Music Entertainment.<br/><br/>";
	thisHTML += "Sony Music Entertainment is a global recorded music company with a roster of current artists that includes a broad array of both local artists and international superstars. The company boasts a vast catalog that comprises some of the most important recordings in history. Sony Music Entertainment is a wholly owned subsidiary of Sony Corporation of America. ";
	thisHTML += '</span></div>';
	
	thisHTML += '<div id="aboutThumb" style="position:absolute; height:50px; width:10px; background-color:#eee; border:1px outset #eee; left:300px; top:0; z-index:2;"></div>';
	thisHTML += '</div></div>';
	
	thisHTML += '<div style="width: 305px; float:left; margin-right: 20px;">';
	thisHTML += '<center><div style="text-align: left"><span id="header24">Careers/Internships</span><br/><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/><br/>';
	thisHTML += '<span id="contentText">Do you have a passion for music? Are you looking to enter the music industry with a global company? If yes, then a career at Columbia Records and Sony Music Entertainment might be right for you!<br/><br/><a href="https://jobs-sonymusic.icims.com/jobs/search?ss=1&searchLocation=&searchCategory=" target="_blank"><img src="images/moreJobs.jpg" border="0"/></a></span><br/><br/>';
	thisHTML += '<span id="header15"><b>Internships</b></span><br/><br/><span id="contentText">Are you the type of person who loves new music? Are you a student? Are you looking to get your foot in the door at a major record company? If so, an internship might be just the ticket!<br/><br/><a href="https://jobs-sonymusic.icims.com/jobs/search?ss=1&searchKeyword=&searchLocation=&searchCategory=11344&searchCategory=11345&searchCategory=11346&searchPositionType=&searchRadius=5&searchZip=" target="_blank"><img src="images/moreInterns.jpg" border="0"/></a></span>;'
	thisHTML += '</div></center></div>';
	
	thisHTML += '<div style="width: 305px; float:left">';
	thisHTML += '<div style="text-align: left"><span id="header24">Contact Us</span><br/><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/><br/>';
	thisHTML += '<span id="contentText">Have a question or concern about Columbia Records?<br/><br/><a href="mailto:feedback@columbiarecords.com"><img src="images/emailus.jpg" border="0"/></a></span><br/><br/>';
	thisHTML += '<span id="header24">Site Feedback</span><img src="images/hr.jpg" width="100%" height="1" style="margin: 10px 0px 10px 0px"/><br/><span id="contentText">If you notice a technical or content error on one of our websites, please let us know.<br/><br/><a href="mailto:feedback@columbiarecords.com"><img src="images/sitefeedback.jpg" border="0"/></a></span>';
	thisHTML += '</div></div><div style="clear:both"></div></div></center>';
	
	aboutBlurb += thisHTML;
	
	document.getElementById('quaternary_1').innerHTML = aboutBlurb;
	
	jQuery('#quaternary_1').fadeIn(200, function() { setScrollBarsAbout() });
	
	jQuery("#quaternaryContainer").fadeIn(500, function(){  });
}

function setScrollBarsAbout()
{

	var divMaskHeight = 375;
	
	var aboutThumb = document.getElementById("aboutThumb");
	var aboutDiv =document.getElementById("aboutTrunc");
	var aboutOffsetHeight = aboutDiv.offsetHeight;
	
	if(aboutOffsetHeight > divMaskHeight)
	{
		Drag.init(aboutThumb, null, 300, 300, 0, (divMaskHeight - 50));
			aboutThumb.onDrag = function(x, y) {
			var dragPercent = (y / (divMaskHeight - 50));
			var scrollDif = aboutOffsetHeight - divMaskHeight;
			aboutDiv.style.top= "-"+scrollDif * dragPercent +"px";
		}
	} else {
		aboutThumb.style.display = "none";
	}
	
}

// Email feed

function checkForCookie()
 {

	var form = document.forms['coppaCheck'];

	SONYMUSIC_COPPA_13.updateForm(form);


	// This function checks the value of the hidden "U13" form field and will write the appropriate flash var according to the value passed

	u13 = document.getElementById('U13').value;

	if(u13 == "true")
	{

		// global under13 cookie found, change embed code accordingly
		// under13 = true;
		
		return false;

	} else {
		//if(browserName != "msie") loadNewsLetter();
		return true;

	}

	

	// write message to div or send the value of u13 as a callBack to the widget

	//under13 = false;

}




function areaOnFocus(element, inputText)
{

	var el = document.getElementById(element);
	if(el.value == inputText)
	{

	  el.value='';

	}

}

function areaOnBlur(element, inputText)
{

	var el = document.getElementById(element);
	if(el.value=='')
	{

	  el.value = inputText;

	}

}

var oXMLHttpRadio;

function GetRadioXMLHttpObject()
{
     oXMLHttpRadio = null;

      try
      {
            oXMLHttpRadio = new ActiveXObject("MSXML2.XMLHTTP");
      }
      catch (E)
      {
            try
            {
                  oXMLHttpRadio = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E)
            {
              oXMLHttpRadio = null;
            }
    }

      if ((oXMLHttpRadio == null) && (typeof(XMLHttpRequest) != 'undefined'))
      {
            oXMLHttpRadio = new XMLHttpRequest();
      }

      return oXMLHttpRadio;
}


var contentObj = new Object;

var currentFeat = 0;

function loadRadio()
{

	if(oXMLHttpRadio)
	{
		oXMLHttpRadio.abort();
	}

	oXMLHttpRadio = GetRadioXMLHttpObject();

	var url = "php/getRadioPlaylist.php";

	oXMLHttpRadio.open("POST", url, true);

	oXMLHttpRadio.onreadystatechange = function()
	    {
		  if (oXMLHttpRadio.readyState == 4)
		  {
			var JSONObject = new Object;

			var response = oXMLHttpRadio.responseText;

			JSONObject = JSON.parse(response);

			radioObj = JSONObject.Playlist;

			loadSong(0, radioObj[0].location, radioObj[0].title);
		  }
	    }

	oXMLHttpRadio.send(null);

}

function showSongInfo()
{

	if(getElement('radioPlaylist').style.display == "block")
	{
		jQuery("#radioPlaylist").slideUp();
		getElement('radioPlaylistButton').innerHTML = '<a href="Javascript:void(0);" onclick="showPlaylist();"><img src="images/playlist_open.jpg" border="0" width="100" height="16" border="0" /></a>';
	}
	
	if(getElement('radioInfo').style.display == "block")
	{
		jQuery("#radioInfo").slideUp();

	} else {

	var info = '<table width="250" cellspacing="0" cellpadding="0">';
	   info += '<tr valign="top"><td style="padding: 0px 0px 0px 0px"><span id="radioInfoText">Now Playing "'+ radioObj[currentSong].title + '" by '+ radioObj[currentSong].artistName +'</span></td>';
	   if(radioObj[currentSong].buyLink != "")
	   {
	   	info += '<td align="right"><a href="'+ radioObj[currentSong].buyLink +' target="_blank"><img src="images/buynow.jpg" border="0"></a></td>';
	   } else {
	   	info += '<td />';
	   }
	   info += '</tr>';

	   if(radioObj[currentSong].release.length == undefined)
	   {
	
	   	var release = radioObj[currentSong].release;
	   	buyLinks = release.buyLinks;
	   	
	   	info += '<tr valign="top"><td colspan="2"><table width="100%" height="100%"><tr valign="top" align="left"><td width="80"><img src="'+ release.cover +'" /></td>';
	   	info += '<td><span id="radioInfoText">From <i>'+ release.releaseTitle +'</i>';
	   	
	   	if(buyLinks.length > 0)
	   	{
			info += '<br/><br/>Buy it now:<br/>';
				for(var i in buyLinks)
				{
					info += '<a href="'+ buyLinks[i].url +'" target="_blank">'+ buyLinks[i].name +'</a>  ';
				}
			info += '</span></td>';
		} else {
			info += '</span></td>';
		}
	   }

	   info += '<tr align="right"><td colspan="2"><a href="Javascript:void(0);" onclick="showSongInfo();"><img src="images/close_button_s.png" border="0"></a></td></tr></table>';	   
	getElement('radioInfo').innerHTML = info;
	jQuery("#radioInfo").slideDown();
	//getElement('radioInfo').style.display = "block";
	}
}

function showPlaylist()
{

	if(getElement('radioInfo').style.display == "block")
		{
		jQuery("#radioInfo").slideUp();
	}
	
	if(getElement('radioPlaylist').style.display == "block")
	{
		jQuery("#radioPlaylist").slideUp();
		getElement('radioPlaylistButton').innerHTML = '<a href="Javascript:void(0);" onclick="showPlaylist();"><img src="images/playlist_open.jpg" border="0" width="100" height="16" border="0" /></a>';

	} else {
		getElement('radioPlaylistButton').innerHTML = '<a href="Javascript:void(0);" onclick="showPlaylist();"><img src="images/playlist_close.jpg" border="0" width="100" height="16" border="0" /></a>';
		
		var info = '<table width="260" cellspacing="0" cellpadding="0" style="border-left: 1px solid #333333; border-bottom: 1px solid #333333; border-right: 1px solid #333333">';

		for(x = 0; x < radioObj.length; x++)
		{
		   
		   var release = radioObj[x];
		
		   info += '<tr valign="top"><td style="padding: 5px 5px 5px 5px; ';
		   
		   if((x + 1) < radioObj.length) info += 'border-bottom: 1px solid #333333;';

		   info += '"><span id="radioPlaylistText"><a href=\"Javascript:void(0);\" onclick=\"loadSong(\'' + x +'\', \''+ release.location +'\', \''+ escape(release.title) +'\');\">"'+ release.title + '" - '+ release.artistName +'</a></span></td>';
		   
		   info += '<td style="padding: 5px 0px 5px 0px; ';
		   
		   if((x + 1) < radioObj.length) info += 'border-bottom: 1px solid #333333;';

		   info += ' text-align: right;\"><a href=\"Javascript:void(0);\" onclick=\"loadSong(\'' + x +'\', \''+ release.location +'\', \''+ escape(release.title) +'\');\"><img src=\"images/play_button.jpg\" border=\"0\" /></a></td></tr>';
	
		}
		
		info += '<tr align="right"><td colspan="2"><a href="Javascript:void(0);" onclick="showPlaylist();"><img src="images/close_button_s.png" border="0"></a></td></tr></table>';

		getElement('radioPlaylist').innerHTML = info;
		jQuery("#radioPlaylist").slideDown();
		//getElement('radioInfo').style.display = "block";
	}
}

var currentSong = -1;



function stopAudio(id)
{
	if(objectPlaying != getElement(id))
	{
		objectPlaying.stopAudio();
	}
	
	var radio = getElement("radioPlayer");
	
	radio.stopAudio();
}

function loadSong(songNum, url, title)
{
	if(songNum == currentSong) 
	{
		stopAudio();
		currentSong = -1;
	} else {
	
		currentSong = songNum
		setPlaying('radioPlayer');
		objectPlaying.loadInSong(url, title);
	}

}

function playerLoaded()
{
	loadSong(radioObj[0].location, radioObj[0].title);
}

function placeRadio()
{
	var html = '<table width="255" height="18" cellspacing="0" cellpadding="0"><tr valign="top"><td style="padding-top: 3px">';
	
	switch(browserName)
	{

		case "firefox" :
				html += "<embed src=\"flash/radio.swf\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#ffffff\" width=\"115\" height=\"18\" id=\"radioPlayer\" name=\"radioPlayer\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
				break;
		default :

				html += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"115\"height=\"18\" id=\"radioPlayer\">";
				html += "<param name=\"allowScriptAccess\" value=\"always\" />";
				html += "<param name=\"allowFullScreen\" value=\"false\" />";
				html += "<param name=\"wmode\" value=\"transparent\" />";
				html += "<param name=\"movie\" value=\"flash/radio.swf\" />";
				html += "<param name=\"quality\" value=\"high\" />";
				html += "<param name=\"bgcolor\" value=\"#ffffff\" />";
				html += "<embed src=\"flash/radio.swf\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#ffffff\" width=\"115\" height=\"18\" id=\"radioPlayer\" name=\"radioPlayer\" allowScriptAccess=\"always\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
				html += "</object>";
				break;
	}
	
	html += '</td><td><div id="radioInfoButton" style="margin-top: 5px;"><a href="Javascript:void(0);" onclick="showSongInfo();"><img src="images/moreSongInfo.jpg" border="0" width="27" height="16" border="0" /></a></div></td><td><div id="radioPlaylistButton" style="margin-top: 5px;"><a href="Javascript:void(0);" onclick="showPlaylist();"><img src="images/playlist_open.jpg" border="0" width="100" height="16" border="0" /></a></div></td></tr></table>';
	
	document.getElementById('radioDiv').innerHTML = html;
	

}

function setPlaying(id){

	objectPlaying = getElement(id);
	
}

function trackPage(url, name, section)
{
	try {

			SME$Analytics.ajaxPageView( {pageURL: ""+ url +"", pageName: "" + name +"", siteSection: ""+ section +""});


	}catch(e){ alert('error');}

}

function openNewsletter()
{
	launch("newsletter/", "newsletter", "650", "", "menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1");
}
