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 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 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 changeVal(id)
{
	val = "";
	document.getElementById(id).value = val;
}


//
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(){
	
	scrollValue = document.getElementById('contentDiv').scrollTop;
	moveDiv();
}


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;

	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;
	}
}



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 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(); }; });
		
}
		

// 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;

	}

}


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");
}
