function callSongSamplePopup(songId, x, y) {
	iframePopup2 ('/3613-5-0.html?id=' + songId + '&', 323, 21, null, true, 'img_' + songId + '_smpl_ref', x, y, true);
}


//function callSongSamplePopup(songId, x, y, exp) {
//	iframePopup ('/3613-5-0.html?id=' + songId + '&', 323, 21, null, true, 'img_' + songId + '_smpl_ref', x, y, true, exp);
//}

var showingSamples = false;

// to be retired
function callSongListingSamplePopup(songId, x, y, exp) {	
	iframePopup ('/3613-5-0.html?id=' + songId + '&', 323, 19, null, true, 'img_' + songId + '_smpl_ref', x, y, false, exp);
}

function callSongListingSamplePopup2(songId, x, y, exp, pt) {	
	iframePopup ('/3613-5-0.html?id=' + songId + '&', 200, 45, null, true, 'img_' + songId + '_smpl_ref', x, y, false, exp, pt);
}

function callSongListingSamplePopup3(songId, x, y, exp, pt) {
	iframePopup3 ('/3613-5-0.html?id=' + songId + '&', 323, 45, null, true, 'img_' + songId + '_smpl_ref', x, y, false, exp, pt);
}
    
function callArtistListingSamplePopup(artistId, x, y, exp) {
	iframePopup ('/3633-5-' + artistId + '.html?', 323, 75, null, true, 'img_' + artistId + '_smpl_ref', x, y, false, exp);
}

function callChartSamplePopup(artistId, x, y, exp) {
	iframePopup ('/3633-5-' + artistId + '.html?', 323, 75, null, true, 'img_' + artistId + '_smpl_ref', x, y, false, exp);
}

function callChartSamplePopup2(artistId, x, y, exp) {
	iframePopup ('/3633-5-' + artistId + '.html?', 323, 75, null, true, 'img_' + artistId + '_smpl_ref', x, y, false, exp);
}

// unused?
function callSamplePopup(artistId, x, y) {
	iframePopup ('player.html?', 323, 75, null, true, artistId + '_smpl_ref', x, y, false);
}



function resetClasses () {
	var elements = document.getElementsByTagName('li');
	for (i=0; i < elements.length; i++) {
		changeClass(elements[i].id,'notSelected');
	}
}

function playSample(id,playlistServiceUrl) {
	resetClasses();
	changeClass(id,'sampleSelected');
	var fo = new FlashObject("/html/mdl/player/flash/MDLSamplePlayer.swf", "MDLSamplePlayer", "321", "18", 6, "#ffffff");
	fo.addVariable("connectionSpeed", MDLGetConnectionSpeed() );
	fo.addVariable("playlistServiceURL", playlistServiceUrl);
	fo.addVariable("playlistIds", "song-" + id);
	fo.write("mdlsampleplayer");
}
											
//opens iframe with url location
// url - location for iframe
// w - width of the iframe
// h - height of the iframe
// caption - title for the iframe (visible to the user)
// scrollIframe - add scrollbars to the popup
// exp - is song explicit

function iframePopup (url, w, h, caption, scrollIframe, refObj, refx, refy, showCaption, exp, pt) {
  //alert ('opening iframe:\n url: ' + url + '\n scroll New Window: ' + scrollIframe);
  //olW = parseInt(w) + 40;
  //olH = parseInt(h) + 40;
  //add the close link
  //var editBody = '<div class="closePopup"><b><a href="javascript:cClick();nd();void(0);">close</a></b></div>';
  var popUpPref = showPopUps;
  var editBody ='';

    //explicit content checker
    if (exp == true && MDLGetExp() == 0) {
    	h = '75';
        url += '&referrer=' + escape(document.URL);
    }
    if (pt) {
    	url += '&pt=' + pt;
    }

  if (caption != null) {
   editBody += '<div class="iframePopupCaption"><b>' + caption + '</b></div>';
  }
  if (showCaption == true) {
   editBody += '<div id="samplePlayerClose"><a href="javascript: void(0);" onclick="showPopUps = ' + popUpPref + ';document.getElementById(\'iframeBody\').src=\'http://www.download.com\';cClick();"><img src="http://music.download.com/i/mdl/global/close.gif" width="42" height="7" alt="close" border="0" class="close" /></a><img src="http://music.download.com/i/mdl/global/playingsample.gif" width="86" height="5" alt="Playing Sample" border="0"/></div>';
  } else {
   editBody += '<div id="samplePlayerClose"><a href="javascript: void(0);" onclick="showPopUps = ' + popUpPref + ';document.getElementById(\'iframeBody\').src=\'http://www.download.com\';cClick();"><img src="http://music.download.com/i/mdl/global/close.gif" width="42" height="7" alt="close" border="0" class="close" /></a></div>';
  }
  if (w == "200") {
  editBody ='';
  }
  //editBody += "<div class=\"navPopdown\">" + url + "<br>h: " + olH + "<br>w: " + olW + "</div>";
  editBody += '<iframe src="' + url + '" name="iframeBody" id="iframeBody" width="' + w + '" height="' + h + '" frameborder="0"';
  if (scrollIframe == "true") {
   editBody += ' scrolling="auto">';
  } else {
   editBody += ' scrolling="no">';
  }
  editBody += '</iframe>';
  //alert (editBody);
  showPopUps = false;
  if (showCaption == false) {
   return overlib(editBody, STICKY, REF, refObj, REFX, refx, REFY, refy, BACKGROUND,'/i/mdl/dotclear.gif',DRAGGABLE);
  } else {
   return overlib(editBody, STICKY, REF, refObj, REFX, refx, REFY, refy, FGCOLOR, "#ffffff",DRAGGABLE);
  }

 }
 
 
 
 
 function iframePopup2 (url, w, h, caption, scrollIframe, refObj, refx, refy, showCaption) {
  //alert ('opening iframe:\n url: ' + url + '\n scroll New Window: ' + scrollIframe);
  //olW = parseInt(w) + 40;
  //olH = parseInt(h) + 40;
  //add the close link
  //var editBody = '<div class="closePopup"><b><a href="javascript:cClick();nd();void(0);">close</a></b></div>';
  var popUpPref = showPopUps;
  var editBody ='';



  if (caption != null) {
   editBody += '<div class="iframePopupCaption"><b>' + caption + '</b></div>';
  }
  if (showCaption == true) {
   editBody += '<div id="samplePlayerClose"><a href="javascript: void(0);" onclick="showPopUps = ' + popUpPref + ';document.getElementById(\'iframeBody\').src=\'http://www.download.com\';cClick();"><img src="http://music.download.com/i/mdl/global/close.gif" width="42" height="7" alt="close" border="0" class="close" /></a><img src="http://music.download.com/i/mdl/global/playingsample.gif" width="86" height="5" alt="Playing Sample" border="0"/></div>';
  } else {
   editBody += '<div id="samplePlayerClose"><a href="javascript: void(0);" onclick="showPopUps = ' + popUpPref + ';document.getElementById(\'iframeBody\').src=\'http://www.download.com\';cClick();"><img src="http://music.download.com/i/mdl/global/close.gif" width="42" height="7" alt="close" border="0" class="close" /></a></div>';
  }
  //editBody += "<div class=\"navPopdown\">" + url + "<br>h: " + olH + "<br>w: " + olW + "</div>";
  editBody += '<iframe src="' + url + '" name="iframeBody" id="iframeBody" width="' + w + '" height="' + h + '" frameborder="0"';
  if (scrollIframe == "true") {
   editBody += ' scrolling="auto">';
  } else {
   editBody += ' scrolling="no">';
  }
  editBody += '</iframe>';
  //alert (editBody);
  showPopUps = false;
  if (showCaption == false) {
   return overlib(editBody, STICKY, REF, refObj, REFX, refx, REFY, refy, BACKGROUND,'/i/mdl/dotclear.gif',DRAGGABLE);
  } else {
   return overlib(editBody, STICKY, REF, refObj, REFX, refx, REFY, refy, FGCOLOR, "#ffffff",DRAGGABLE);
  }

 }

function iframePopup3 (url, w, h, caption, scrollIframe, refObj, refx, refy, showCaption, exp, pt) {
  //alert ('opening iframe:\n url: ' + url + '\n scroll New Window: ' + scrollIframe);
  //olW = parseInt(w) + 40;
  //olH = parseInt(h) + 40;
  //add the close link
  //var editBody = '<div class="closePopup"><b><a href="javascript:cClick();nd();void(0);">close</a></b></div>';
  var popUpPref = showPopUps;
  var editBody ='';

    //explicit content checker
    if (exp == true && MDLGetExp() == 0) {
    	h = '75';
        url += '&referrer=' + escape(document.URL);
    }
    if (pt) {
    	url += '&pt=' + pt;
    }

if (caption != null) {
   editBody += '<div class="iframePopupCaption"><b>' + caption + '</b></div>';
  }
  if (showCaption == true) {
   editBody += '<div id="samplePlayerClose"><a href="javascript: void(0);" onclick="showPopUps = ' + popUpPref + ';document.getElementById(\'iframeBody\').src=\'http://www.download.com\';cClick();"><img src="http://music.download.com/i/mdl/global/close.gif" width="42" height="7" alt="close" border="0" class="close" /></a><img src="http://music.download.com/i/mdl/global/playingsample.gif" width="86" height="5" alt="Playing Sample" border="0"/></div>';
  } else {
   editBody += '<div id="samplePlayerClose"><a href="javascript: void(0);" onclick="showPopUps = ' + popUpPref + ';document.getElementById(\'iframeBody\').src=\'http://www.download.com\';cClick();"><img src="http://music.download.com/i/mdl/global/close.gif" width="42" height="7" alt="close" border="0" class="close" /></a></div>';
  }
  if (w == "200") {
  editBody ='';
  }
  //editBody += "<div class=\"navPopdown\">" + url + "<br>h: " + olH + "<br>w: " + olW + "</div>";
  editBody += '<iframe src="' + url + '" name="iframeBody" id="iframeBody" width="' + w + '" height="' + h + '" frameborder="0"';
  if (scrollIframe == "true") {
   editBody += ' scrolling="auto">';
  } else {
   editBody += ' scrolling="no">';
  }
  editBody += '</iframe>';
  //alert (editBody);

  showPopUps = false;
  if (showCaption == false) {
   return overlib(editBody, STICKY, ANCHOR, refObj, ANCHORALIGN, 'UL', ANCHORX, refx, ANCHORY, refy, BACKGROUND,'/i/mdl/dotclear.gif', DRAGGABLE);
  } else {
   return overlib(editBody, STICKY, ANCHOR, refObj, ANCHORALIGN, 'UL', ANCHORX, refx, ANCHORY, refy, FGCOLOR, "#ffffff", DRAGGABLE);
  }

 }