<!--
myRaagaUrl = base_url+"channels/myraaga/";homeUrl = base_url+"channels/home/";puPlUrl = base_url+"playlists/";widgetUrl = base_url+"widgets/";lngUrl = base_url+"lounge/";listenUrl = base_url+"listen/";shop_url = base_url+"channels/downloads/";invite_url = base_url+"friends/";

vidUrl 	   = homeUrl +"video.asp";

var NEW_FRIENDS_ALERT = myRaagaUrl + "alert-invites.asp"

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function getActivation(){	
	url = myRaagaUrl + 'getactivation.asp';
	//parent.closeMessage();
	popWin(url, 'Account Activation', 504,200);
}

function activateAcct(x){	
	url = myRaagaUrl + 'activation_form.asp'
	if (x) { url = url + "?" + x }
	popWin(url, 'Activate Account', 504,250);
}

function getPwd(){
	url = myRaagaUrl+"getPwd.asp"
	popWin(url, 'Forgot Password', 504,180);
}

function register(){
	//url = myRaagaUrl+"register_form.asp";
	//popWin(url, 'Register', 600,500);
	url = myRaagaUrl+"register.asp";
	window.open(url,"raagaRegWin");
}

function clearFrmVal(e,v){
	if(e.value == v) {e.value=''; e.focus(); return false;e.style.color='#000000';}
}

function resetFrmVal(e,v){
	if(e.value == '') {e.value=v; e.focus(); return false;e.style.color='#CC0000';}
}


function musicSearch(){toggleSlide('searchDiv');}

function searchTCld(){
	var url = homeUrl + "search-tagcloud.asp";
	ajax_loadContent("searchTagCld", url);
}

function submitTag( srch, fld, l, m){
	if (document.getElementById('tagFrm')){
		var frm = document.getElementById('tagFrm')
		frm.search.value = srch
		frm.search_fld.value = fld
		frm.match.value = m
		frm.lang.value = l
		frm.submit();
	}
}

function getCompatibility(){	
	url = homeUrl+ 'compatibility.asp'
	messageObj.setSize(504,400);
	displayMessage(url);
}


function loginMsg(url){
	if (url == null || url == "undefined"){
		url = myRaagaUrl + 'login_form.asp'
	}
	popWin(url, 'Login', 570,400);	
}

function pendingActivation(u){
	//closeMessage();
	popWin(u, 'Login', 550,250);
}

function handleLoginErr(){
	var lgE = document.getElementById('lgnErrMsg');
	if (lgE) {
		lgE.innerHTML = "<span class=red>Login failed! Please verify username/password and try again</span>"
		lgE.style.display = 'block';
		blinkit('lgnErrMsg');
		lgE.style.backgroundColor = '#FFFF99';
	}
}

function redirectPULogin(url){
	if (url == null || url == "undefined"){
		url = myRaagaUrl + 'login_form.asp'
	}
	closeMessage();
	popWin(url, 'Login', 520,360);
}

function inviteFriends(iUrl,rUrl, dId){
	if (!iUrl){ 
	 	iUrl = invite_url +"share.asp"
	 //iUrl = homeUrl +"widget_share.asp"
	}
	
	winW = 730
	winH = 485
	winName = 'inviteFriends' + Math.floor(Math.random()*11);
	
	raagaIF = doWin(iUrl, winName, 1);
	raagaIF.focus();
	if (rUrl != ""){
		rUrl = homeUrl + "widget_share.asp?mailurl=" + rUrl
		if (dId && document.getElementById(dId)) {
			ajax_loadContent(dId, rUrl);
		} else {
			//alert(rUrl)
			//doWin(iUrl, 'informerWin')
			//document.location.href= rUrl;
			//popWin(rUrl, 'Share Playlist', 475, 485);
		}
	}
}

/*function sendLink(x){
	if (!x) x=document.location.href;
	createCookie('sendPage', x)
	inviteFriends();
}*/


function sendLink(x){
	if(!x) x=document.location.href;
	var url = homeUrl + "widget_share.asp";
	createCookie('sendPage', x)
	popWin(url, 'Send this page', 730, 485);
	/*
	winW = 730
	winH = 485
	doWin(url,'informer');
	*/
}

function shareThis(k,v){
	var url = homeUrl + "widget_share.asp?"+k+'='+v;
	popWin(url, 'Send this page', 730, 485);
}

function showFriends(x){
	var fUrl = lngUrl + "friends.asp?pid=" + x + "&wp=1&sn=Y"
	window.open(fUrl)
}

function loadFriends(x,d){
	if (document.getElementById(d)){
		ajax_loadContent(d, x);
	}		
}

function loadPageDiv(x,d){
	if (d && document.getElementById(d)){
		ajax_loadContent(d, x);
	} else {
		window.location.href = x;
	}
}

function sharePuPL(pId){
	var iUrl
	//iUrl = homeUrl+"widget_invite.asp";
	//popWin(iUrl, 'Share Playlist', 550, 350);
	//iUrl = base_url+"invite/invite.asp"
	//inviteFriends(iUrl,puPlUrl+"?"+pId)
	sendLink(listenUrl+"?"+pId)
	
}

function savePuPl(pId){
	//iUrl = puPlUrl + "savePuPlPrompt.asp?"+pId
	//iUrl = myRaagaUrl + "favSavePrompt.asp?p="+pId
	iUrl = puPlUrl + "savePuPl.asp?p="+pId
	popWin(iUrl, 'Save Playlist', 600, 400);
}

function savePuPlMini(pId,dId){
	iUrl = puPlUrl + "savePuPlMini.asp?p="+pId
	ajax_loadMini(dId,iUrl);
}


function favAlbum(aId){
	//iUrl = myRaagaUrl + "favSavePrompt.asp?a="+aId
	iUrl = myRaagaUrl + "favAlbumSave.asp?a="+aId
	popWin(iUrl, 'Save Album', 600, 400);
}

function favAlbumMini(aId,dId){
	iUrl = myRaagaUrl + "favAlbumSaveMini.asp?a="+aId
	ajax_loadMini(dId,iUrl);
}

function loadFavs(x,d){
	var iUrl;
	iUrl = lngUrl + 'loadFavAlbums.asp?u=' + x
	if (document.getElementById('mpFav1'))document.getElementById('mpFav1').style.display = 'none';
	if (document.getElementById('mpFav2'))document.getElementById('mpFav1').style.display = 'none';
	if (document.getElementById('mpFav3'))document.getElementById('mpFav1').style.display = 'none';
	if (document.getElementById(d))document.getElementById(d).style.display = 'block';
	ajax_loadContent(d,iUrl);
}

var isFavT1, isFavT2, isFavT3;

isFavT1 = true;
function loadFavTab(x, u,cCh,pre){
	for (i=1;i<=3;i++){		
		if (document.getElementById(pre + i)){
			document.getElementById(pre + i).style.display = 'none';
			document.getElementById(pre + i + 'Tab').className = 'inactive-tab r-rounded';
			//mpFavTab3
		}
	}

	var dId = pre +x;

	var d = document.getElementById(dId);
	var dT = document.getElementById(dId+'Tab');
	if (d) {
		//grtSrchTab = x;
		d.style.display = 'block';
		dT.className = 'active-tab r-rounded white';

		var y = eval('isFavT'+x);
		if ((u && !y) || cCh ) { ajax_loadContent(dId, u);  y = true }
		eval('isFavT'+x+' = ' + y);
	}
}

function embedPuPl(pId){
	iUrl = puPlUrl + "embed.asp?pid="+pId	
	popWin(iUrl, 'Embed Public Playlist', 650, 450);
}

function loadPuPLList(x,y){
	if (!x) x = 2
	var iUrl = puPlUrl + "summary.asp?m="+x
	if (y) iUrl += "&l="+y
	ajax_loadContent('divPublicPL',iUrl);
}

function inviteFriendsMsg(pEm){
	var iUrl = invite_url+"invite.asp"
	if (pEm) iUrl += "?Account="+pEm
	popWin(iUrl, 'Invite Friends', 525, 535);
}

function doLoginAjax(rUrl){
	if (rUrl == '') {
		enableLogin();
		refMRMenu(1);
		showBadge();
	} else {
	 	document.location.href= rUrl
	}
}

function enableLogin(){
	if (document.getElementById('rLgdIn')){
		ajax_loadContent('rLgdIn',myRaagaUrl + 'logged_in_menu.asp');
	}
	if (document.getElementById('emailLgnBar')){
		ajax_loadContent('emailLgnBar', myRaagaUrl + 'myemail.asp');
	}
	if (document.getElementById(cmntWrtFrm)){
		var curSrc = document.getElementById(cmntWrtFrm).src;
		document.getElementById(cmntWrtFrm).src = curSrc;
	}
}

function refMRMenu(x){
	var dId = document.getElementById('dropmenuMR');
	var dSrc;
	if (x==1)
		dSrc = document.getElementById('dropmenuMRLogged');
	else
		dSrc = document.getElementById('dropmenuMRSignin');

	if (dSrc && dId){
		dId.innerHTML = dSrc.innerHTML
	}
}


function refreshCart(){
	if (document.getElementById('rightColumn')){
		ajax_loadContent('rightColumn',shop_url + 'viewcartdiv_ajax.asp');
	}
}

function remCartItem(x){
	window.location.replace(shop_url +"delCartItem.asp?itemId="+x);
}

function emptyCart(){
	if (confirm("This will remove all the items in your cart.\n\nDo you wish to continue?")){
		window.location.replace(shop_url +"delCart.asp");
	}		
}


function showLoginAjax(){
	if (document.getElementById('rLgdIn')){
		ajax_loadContent('rLgdIn',myRaagaUrl + 'log_in_menu.asp');
	}
	//showBadge();
}

function showBadge(){
	if (document.getElementById('mybadge')){
		ajax_loadContent('mybadge', myRaagaUrl + 'badge.asp');
	}
	refMRMenu(1);
}

function signOutAjax(){
	/*
	if (document.getElementById('rcntP')){
		ajax_loadContent('rcntP',myRaagaUrl + 'logoutAjax.asp');
		showLoginAjax();
		alert("Successfully logged out!");
		if (ajaxMR){
			window.location.href= myRaagaUrl + 'default.asp';
		}
	}*/ 
	if (document.getElementById('rcntPDiv')){
		document.getElementById('rcntPDiv').src = myRaagaUrl + 'logoutAjax.asp';
		if (ajaxMR){
			window.location.href= myRaagaUrl + 'default.asp';
		}
	} else {
		top.window.location = myRaagaUrl + 'logout.asp'
	}	
}


function getFeedback(){
	url = homeUrl+"feedback.asp"
	winW = 507
	winH = 437
	winName = 'raagaFB'	
	raagaFB = doWin(url, winName);
}


function mailSong(x){  
	listStr = homeUrl+"mailclip.asp?id="+x;
	winW = 600
	winH = 450	
	rmail = doWin (listStr,'rmail');
}


function getChannel(channel){
 if (channel != ''){
	channel = escape(channel);
	//plyrW, plyrH, plyrWin
	winW = plyrW;
	winH = plyrH;
	winName = plyrWin;
	winHandle = doWin(homeUrl+"loadchannel.asp?channelid="+channel,winName);

 } else {
	alert("Please select a channel and try again");
 }
}

function launchChannel(){
	channelsUrl = homeUrl+"nonstop.asp"
	opnr = top.window.opener;
	if(opnr && !opnr.closed ){
		top.window.opener.location.href = channelsUrl
		top.window.opener.focus();
	} else{
	  	window.open(channelsUrl);
	}
}


var winW;
var winH;

function rate(id){
	winW = 500;
	winH = 430;
	winName = 'raagaRate'
	url = homeUrl+"rating.asp?id="+id;
	raagaRate = doWin(url,winName);	
}

function getImg(img,title,w,h){
  winName= "win"+w+"_"+h
  winW = w;
  winH = h;
  url = "getImg.asp?cast="+title+"&img="+escape(img)+"&w="+w+"&h="+h
  rcWin = doWin(url,winName);
}

function getGallery(gName){
	gName = escape(gName);
	window.location = "gallery.asp?cast="+gName
}

function getOffsets(){

	if (screen.availWidth && screen.availHeight)
		    var xMax = screen.availWidth, yMax = screen.availHeight;
	else
		if (document.layers)
		    var xMax = window.outerWidth, yMax = window.outerHeight;
		else
		    var xMax = 640, yMax=480;

	if (winW > xMax-20){
		isScroll = 1;
		winW = xMax-20;
	}
	if (winH > yMax-20){
		isScroll = 1;
		winH = yMax-30;
	}
		    
	dwXOffset = (xMax/2)-(winW/2);
	dwYOffset = (yMax/2)-(winH/2);	
}

var dwXOffset, dwYOffset;

function doWin(x,winName,scrollable){

	isScroll=0;
	
	if(winH < 1)
		winH=1;
	if(winW < 1)
		winW=1;
	
	getOffsets();

	if ( scrollable )
		isScroll = 1;

	var thisWin = window.open (x,winName,'width='+winW+',height='+winH+',directories=no,toolbar=no,menubar=no,location=no,scrollbars='+isScroll+',minimize=yes,resizable=no,copyhistory=no,status=no,titlebar=no,screenX='+dwXOffset+',screenY='+dwYOffset+',top='+dwYOffset+',left='+dwXOffset+'');
	if (thisWin) { 
		thisWin.focus();
		return thisWin;
	} else {
		//displayStaticMessage("We are unable to open the Raaga player.<br>Please make sure you have pop-ups enabled","black")
		alert("We are unable to open the Raaga player.\nPlease make sure you have pop-ups enabled");
		//return false;
	}
    	
    return thisWin;
}


function popUp(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin";
}

function closeLtWin(){
	top.tb_remove();
/*
	if (parent.myLightWindow){
		parent.myLightWindow.deactivate();
	} else {
		window.close();
	}
*/	
}

function setSort(fld){
	imgObj = eval("document."+fld+"_SORT")
	//imgObj.src = base_url+"images/sortdown.gif";
}

function sortBy(fld){
	document.centerFrm.sortFld.value = fld
	document.centerFrm.submit();
}

function setDivTxt(x,y){
	if (document.getElementById(x)){
	if (y == "") y = "&nbsp;"
	document.getElementById(x).innerHTML = y
	}
}

var os;
var osv;
var browser;
var bversion;

function browserTest() {
  if (navigator.appName.indexOf("Netscape") != -1) {
    browser = "Netscape";
    bversion = parseFloat(navigator.appVersion);
  } else if (navigator.userAgent.indexOf("MSIE") != -1) {
    browser = "MSIE";
    var start = navigator.appVersion.indexOf("MSIE");
    var v = parseFloat(navigator.appVersion.substring(start + 4));
    bversion = v;
  } else {
    browser = false;
    bversion = false;
  }
}

// Determine the OS of the client machine
function osTest() {
  if (navigator.userAgent.indexOf("Win") != -1) {
    os = "Windows";
    if (navigator.userAgent.indexOf("Windows NT") != -1 ||
	navigator.userAgent.indexOf("WinNT") != -1)
      osv = "NT";
    else if (navigator.userAgent.indexOf("Windows 98") != -1 ||
	navigator.userAgent.indexOf("Win98") != -1)
      osv = "98";
    else if (navigator.userAgent.indexOf("Windows 95") != -1 ||
	navigator.userAgent.indexOf("Win95") != -1)
      osv = "95";
    else if (navigator.userAgent.indexOf("Windows 3.1") != -1 ||
	navigator.userAgent.indexOf("Win16") != -1)
      osv = "3.1";
  } else if (navigator.userAgent.indexOf("Mac") != -1) {
    os = "Macintosh";
    osv = "";
  } else if (navigator.userAgent.indexOf("FreeBSD") != -1) {
    os = "Unix";
    osv = "FreeBSD";
  } else if (navigator.userAgent.indexOf("Linux") != -1) {
    os = "Unix";
    osv = "Linux";
  } else if (navigator.userAgent.indexOf("Solaris") != -1) {
    os = "Unix";
    osv = "Solaris";
  } else if (navigator.userAgent.indexOf("SunOS") != -1) {
    os = "Unix";
    osv = "SunOS";
  } else if (navigator.userAgent.indexOf("IRIX") != -1) {
    os = "Unix";
    osv = "IRIX";
  } else if (navigator.userAgent.indexOf("HPUX") != -1) {
    os = "Unix";
    osv = "HPUX";
  } else if (navigator.userAgent.indexOf("AIX") != -1) {
    os = "Unix";
    osv = "AIX";
  } else if (navigator.userAgent.indexOf("Unix") != -1) {
    os = "Unix";
    osv = "";
  } else {
    os = "Other";
    osv = "";
  }
}

function rdl(q){var dF = document.dlFrm; if (dF){ dF.ids.value=q;dF.submit();}}

function openHelp( referenceUrl, w, h ){
	winName = "raagaHelp";
	if (!w || !h){
		winW = 400;
		winH = 300;
	} else {
		winW = w;
		winH = h;
	}
	doWin( referenceUrl, winName );
}

function help(u,w,h){
	if (!w) {
		w = 504
		h = 270
	}
	messageObj.setSize(w,h)
	displayMessage(u)
}

function getLyrics( songId ){
	lyricsURL = homeUrl+"lyrics.asp?id="+songId;
	winName = "raagaLyrics";
	winW = 468;
	winH = 500;
	rlWin = doWin( lyricsURL, winName, true );

}

function sortAlbumsBy( obj ){
    //alert( obj.options[obj.selectedIndex].value );
    document.rDisplay.submit();
}

function sortTracks( obj ){
    if(document.pageFrm){
    	var st = obj.options[obj.selectedIndex].text;
    	if (document.pageFrm.sortBy){
    		document.pageFrm.sortBy.value=st
    	} else {    		
			document.pageFrm.action += "?sortBy=" + st;
		}
		document.pageFrm.submit();
    }
}


function linkAlbumPreview(x){
	aU = widgetUrl+"album/?"+x;
	popWin(aU, "Link/Bookmark Album Widget", 504,220)
}

function showAlbBtn(x,t){
	if (!t) t = 'block'
	if(document.getElementById(x) ) document.getElementById(x).style.display=t;
}
function hideAlbBtn(x){
	if(document.getElementById(x) ) document.getElementById(x).style.display='none';
}

function sAI(tdId, x){	
	if (!isIE6){
		tdId.style.backgroundColor='#E8E8E8';
		var infoObj;
		if (!document.getElementById(x+'Info')){
			infoObj = document.createElement('DIV');
			infoObj.style.position = 'relative';
			infoObj.style.display = 'inline';
			infoObj.style.top = '3px';
			infoObj.style.left = '2px';
			infoObj.innerHTML = '<img id="' + x +'" src="'+imgPath+'common/icon/y/info-icon.jpg" onClick="showAlbumToolTip(this.id,this);return false;" style="cursor:pointer;" border=0 width=14 height=14>'
			infoObj.id = x+'Info';		
			tdId.appendChild(infoObj);
		} else {
			document.getElementById(x+'Info').style.display = 'inline';
		}
	}	
}
function hAI(tdId,x){
	x = x + 'Info';
	if(document.getElementById(x) ) {
	//infoObj.innerHTML = '';
	document.getElementById(x).style.display='none';
	}
	tdId.style.backgroundColor=''
}
//*******************************************//

messageObj = new DHTML_modalMessage();	// We only create one object of this class
messageObj.setShadowOffset(5);	// Large shadow

function popWin(url, title, w,h){
	//alert(url)
	if(url.indexOf("?")!==-1)	{
		url = url + "&TB_iframe=-1&width="+w+"&height=" + h
	} else {
		url = url + "?TB_iframe=-1&width="+w+"&height=" + h
	}
	//alert(url)
	jQuery(document).ready(function(){
		tb_show(title, url, null);
	});
	
		
	
	
	//alert(url);
	/*if  (myLightWindow){
	myLightWindow.activateWindow({
		href: url, 
		title: title, 
		height: h,
		width: w,
		type:'external'
	});
	} else {
		winW = w
		winH = h
		displayMessage(url)
		messageObj.setSize(w,h);	
		//doWin(url,title)
	}*/
}

function displayMessage(url){	
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
	messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
}

function displayStaticMessage(messageContent,cssClass){
	messageObj.setHtmlContent(messageContent);
	messageObj.setSize(300,150);
	messageObj.setCssClassMessageBox(cssClass);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();	
}

function closeMessage(){
	
	if (messageObj.divs_transparentDiv) {
		messageObj.close();
	} else {
		closeLtWin()
	}
}

//***********************************************//

function JSFX_FloatTopLeft()
{
	var startX = 10, startY = 200;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	var px = document.layers ? "" : "px";
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
		el.x = startX; el.y = startY;
		return el;
	}
	window.stayTopLeft=function()
	{
		var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		ftlObj.y = (pY > startY) ? pY : startY;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 20);
	}
	ftlObj = ml("rightColumn");
	stayTopLeft();
}
//JSFX_FloatTopLeft();


var clipped;
var lenUSig;
var maxLength=1500;

function calcCharLeft(x,e){
	clipped = false;
	lenUSig = 0;
	
	if (x > 0 ) 
		maxLength = x;
	else
		maxLength = 1500;
		
	if (e==null || e=="undefined") e = "albComments"
	var charleft;
	if (document.getElementById(e).value.length > maxLength) {
		charleft = 0;
		clipped = true;
		document.getElementById(e).value = document.getElementById(e).value.substring(0,maxLength)
		document.getElementById("chrCnt").innerHTML = "<span class=red>You have reached your character limit.</span>";
		blinkit('chrCnt');
	} else {
		charleft = maxLength - document.getElementById(e).value.length;
		document.getElementById("chrCnt").innerHTML = charleft + " characters left";
	}
	
	return clipped;
}

function textKey() {
	calcCharLeft();
}

function regFrm(obj, actionUrl) {
	var getstr = "?";
	getstr = getstr + "register1NAME=" + document.getElementById("register1NAME").value;
	getstr = getstr + "&register1EMAIL=" + document.getElementById("register1EMAIL").value;
	getstr = getstr + "&register1PASSWORD=" + document.getElementById("register1PASSWORD").value;
	getstr = getstr + "&register1PASSWORD1=" + document.getElementById("register1PASSWORD1").value;
	
	var gender = document.getElementById("register1GENDER");
	if (gender.checked) {
		getstr = getstr + "&register1GENDER=" + gender.value;
	}
	var gender2 = document.getElementById("register2GENDER");
	if (gender2.checked) {
		getstr = getstr + "&register1GENDER=" + gender2.value;
	}
	getstr = getstr + "&register1AGE=" + document.getElementById("register1AGE").value;	
	getstr = getstr + "&register1ZIP=" + document.getElementById("register1ZIP").value;
	
	var rcvMail = document.getElementById("register1RECEIVE_MAIL");
	if (rcvMail.checked) {
		getstr = getstr + "&register1RECEIVE_MAIL=" + rcvMail.value;
	}else{
		getstr = getstr + "&register1RECEIVE_MAIL=";
	}
	
	
	var country = document.getElementById("register1COUNTRY");
	getstr += "&register1COUNTRY=" + country.options[country.selectedIndex].value;
	
	//prompt("SDSDS", actionUrl + getstr);
	
	ajax_loadContent('regFrmDiv', actionUrl + getstr);
}

function getRctnUsrs(){
	if ( document.getElementById('rcntUsrsList') ){
		ajax_loadContent('rcntUsrsList', homeUrl + "getRecentUsers.asp");
	}
}

function getPoplPLUsrs(l,g){
	if ( document.getElementById('poplPlUsrsList') ){
		ajax_loadContent('poplPlUsrsList', homeUrl + "getPopularUsers.asp?l="+l+"&g="+g);
	}
}

function getRcntPlays(x){
	if ( document.getElementById('rcntUsrPlays') ){
		ajax_loadContent('rcntUsrPlays', homeUrl + "getRecentPlays.asp?pid="+x);
	}
}

function loadFrndsPL(){
	if ( document.getElementById('frndsPlList') ){
		ajax_loadContent('frndsPlList', myRaagaUrl + "friends-pl-list.asp?iS=Y");
	}
}

function refreshGenre(d,l,e){
	if ( document.getElementById(d) ){
		ajax_loadContent(d, homeUrl + "genre_dd.asp?l=" + l +'&eI=' + e);
	}
}	



function getUsrProfile(i){
	//window.open( lngUrl +'?' + i )
	window.location.href = lngUrl +'?' + i 
}


function getTopAlbums(){
	if ( document.getElementById('topAlbums') ){
		ajax_loadContent('topAlbums', "getMostPopular.asp");
	}
}	

function getNowPlaying(x,y){
	var u = "getNowPlaying.asp?";if (x) {u = u + "x="+x+"&"};if(y) {u = u + "g="+y+"&"}
	if ( document.getElementById('npHPD') ){
		ajax_loadContent('npHPD', u);
	}
}	

function getNowPlayingAll(x,l){
	var u = homeUrl+"getNowPlaying.asp";
	u = u + "?x="+x+"&l="+l;
	if ( document.getElementById('npHPD') ){
		ajax_loadContent('npHPD', u);
	}
}	

function getRelated(x,a){
	if ( document.getElementById('relatedAlbums') ){
		ajax_loadContent('relatedAlbums', a + "refreshRelatedAlbums.asp?mid="+x);
	}
}

function getRelatedTracks(x,a){
	if ( document.getElementById('relatedTracks') ){
		ajax_loadContent('relatedTracks', a + "refreshRelatedTracks.asp?id="+x);
	}
}

function artistRcnt(cn,ct){
	var u = homeUrl+"getArtistRecent.asp";if (cn && ct) {u = u + "?ct="+ct+"&cn="+cn};
	if ( document.getElementById('rcArtistD') ){
		ajax_loadContent('rcArtistD', u);
	}
}

function clrRcntPlys(){
	if (confirm("This will clear your listening history on Raaga. Do you wish to continue?")){
		window.location.href= homeUrl + "recentplays-refresh.asp"
	}
}


function activateFrm(dId, actionUrl) {
	var getstr = "?";
	getstr = getstr + "EMAIL=" + document.getElementById("EMAIL").value;
	getstr = getstr + "&PASSWORD=" + document.getElementById("PASSWORD").value;
	getstr = getstr + "&ACTCODE=" + document.getElementById("ACTCODE").value;
	
	//prompt("SDSDS", actionUrl + getstr);
	
	ajax_loadContent(dId, actionUrl + getstr);
}

function loadCmnts(x,y){
	var url;
	if (!y) y = 1;
	url = homeUrl + 'getcomments.asp?aid=' + x + '&cmmod=' + y + '&iss=Y'
	ajax_loadContent('albCmntsRd', url);
}

function showAllCmnts(x){
	var url;
	url = homeUrl + 'getcomments.asp?aid=' + x 
	popWin(url, 'User Comments', 900,500);
}

function postCmnt(x,p){
	/*
	if(document.getElementById('location')){
		document.getElementById('location').scrollIntoView(true);
	}
	call_div( 'comments', 'a='+escape(x)+'&l='+escape(p) );
	*/
	if(document.getElementById('albCmntsRd')){
		document.getElementById('albCmntsRd').scrollIntoView(true);
	}
	url = base_url + 'channels/home/widget_comments.asp?a='+escape(x)+'&l='+escape(p) +'&dId=comments'
	popWin(url, 'Post Comments', 765,300);
}	

function postReplyCmnts(x,ds,sbj,aid){
	//call_div('postCmnt'+x+ds, 'pstid='+x+'&ds='+ds+'&sbj='+sbj+'&aid='+aid);
	var xd = 'postCmnt'+x+ds;
	var url = homeUrl + 'postreply.asp?pstid='+x+'&ds='+ds+'&sbj='+sbj+'&aid='+aid
	/*if (document.getElementById(xd)){
		var dx = document.getElementById(xd);
		dx.style.display = 'block'
	}
	toggleSlideAjax(xd, homeUrl + 'postreply.asp?pstid='+x+'&ds='+ds+'&sbj='+sbj+'&aid='+aid)
	*/
	popWin(url, 'Post Reply', 500,300);
}

function rptAbuseCmnts(x,ds){
	//call_div('postAbs'+x+ds, 'pstid='+x+'&ds='+ds);
	url = base_url + 'channels/home/widget_abuse.asp?pstid='+x+'&ds='+ds
	popWin(url, 'Report Abuse', 500,348);
	//messageObj.setSize(504,400);
	//displayMessage(url);

}

function postAbuse(x, ac){
	var g = "?";
	g = g + "pstid=" + x;
	for (i=1;i<=6;i++){
		var r = document.getElementById("rptAbsTp"+i);
		if (r.checked) {
		g = g + "&rptAbsTp=" + r.value;
		}
	}
	//prompt("SDSDS", ac + g);
		
	ajax_loadContent("abuseRptDiv", ac + g);
}

var ttEP

var stimeTT 

function showAlbumToolTip(u,o,t){
	//if ( document.getElementById('ajax_tooltipObj') ) {
		//ajax_hideTooltip();
	//}

	//stimeTT = setTimeout(ajax_showTooltip, 2000, u, o);
	//clearTimeout(x);
	
	u = base_url + "channels/home/album-tooltip.asp?mid="+u
	if (t) u = u + '&t=' + t
	
	//clearTimeout(stimeTT);	
	//stimeTT = window.setTimeout(function () { ajax_showTooltip(u,o); }, 500);
	ajax_showTooltip(u,o); 
	
}

function showCompToolTip(u,o){	
	u = base_url + "channels/home/comp-tooltip.asp?cid="+u
	ajax_showTooltip(u,o); 	
}


function hideAlbumToolTip(){
	ajax_hideTooltip()
	//clearTimeout(stimeTT);
	//var x = setTimeout("ajax_hideTooltip()", 20000);
}


function addFriend(x){
	var url;
	url = lngUrl + 'add-friend-verify.asp?p='+x
	popWin(url, 'Add as Friend', 554,250);
}

function confirmInvite(x, invite,i){
	var frm = eval("document.inviteConfirmFrm"+i);
	if (frm) {
		frm.ic.value = invite;
		frm.xStatus.value = x;
		frm.submit();
	}		
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function msgAlert(x,u){
	messageObj.setSize(504,250);
	var hideInvMsg = readCookie("hideInvMsg");
	if (hideInvMsg != "1") displayMessage(NEW_FRIENDS_ALERT);
	//popWin(NEW_FRIENDS_ALERT, '', 504,300);
	if (document.getElementById('msgftraltdiv') && x){
		if (u) {
			document.getElementById('msgftraltdiv').innerHTML = "<center><a href='" + u + "' class=smlTxt>" + x + "</a></center>"
		} else {
			document.getElementById('msgftraltdiv').innerHTML = "<center>" + x + "</center>"
		}
		toggleSlide('msgftraltdiv');
	}		
}

function setInvPendMsg(x){
	if (x) { createCookie("hideInvMsg","1",10)} else {createCookie("hideInvMsg","0",10)}
}

var smu = homeUrl + "sm.asp"

function sm(){
 if (document.getElementById("81B1B52E-87D7-11DD-AEF0-E5CF56D89593")){
 		var smD = document.getElementById("81B1B52E-87D7-11DD-AEF0-E5CF56D89593")
 		ajax_loadContent(smD, smu);
 		setTimeout("sm",60000);
 }
} 

function loadVideoList(x){
	if (x){
		if (document.getElementById('vidClipDiv')){
			if(document.getElementById('vidClipDiv')){
				document.getElementById('vidClipDiv').scrollIntoView(true);
			}
			ajax_loadContent('vidClipDiv', vidUrl + '?pid='+x);
		}
	}
}

function loadTopVid(u){
	if (document.getElementById('vidClipDiv')){
		
		if(document.getElementById('vidClipDiv')){
			//document.getElementById('vidClipDiv').scrollIntoView(true);
			ajax_loadContent('vidClipDiv', u);
		}
		
	}
}

function loadVid(x){
	slidedown('vidClipFrm');
	window.open (x,'rVidePlyFrme');
}

var tglAlbMdDId = "";

function tglAlbMn(dId,x){
	if(document.getElementById('location')){document.getElementById('location').scrollIntoView(true);}
	if (tglAlbMdDId && document.getElementById(tglAlbMdDId) ) slideup(tglAlbMdDId);
	tglAlbMdDId = dId;
	toggleSlideAjax(dId,x,550,300)
	
}

function loadJC(x,y){
	if(!y) y = "N"
	//prompt('test','latest.asp?at='+x+"&is=100&it=4&isF=1&frmW=440&isn="+y)
	ajax_loadContent('jcrfrs', 'latest-framed.asp?at='+x+"&is=100&it=4&isF=1&frmW=450&isn="+y);
}

function loadMap(x){
	ajax_loadContent('yMpLoadDiv', base_url + 'musicmap/loadmap.asp?m='+x);
}

function loadBadge(x){
	ajax_loadContent(x, myRaagaUrl + 'badge.asp');
}

var tlflg = false;
function showTLMenu(x){

	if(tlflg){
		tlflg  = false;
		document.getElementById(x).style.visibility = "hidden";

	}
	else{
		tlflg  = true;
		document.getElementById(x).style.visibility = "visible";

	}
}

function fanSignup(x){
	var u = homeUrl + 'fan_signup.asp?artist='+x;
	popWin(u, 'Become a Fan', 500,200);	
}

function fanClub(x){
	var u = homeUrl + 'fanclub.asp?artist='+x;
	window.open (u)
}

function dTxt(d,t){
	if (document.getElementById(d)){
		if (t=="") t = "&nbsp;";
		document.getElementById(d).innerHTML = t;
	}
}

var hpBtnBar=""
var hpBtnDId = "";var hpBtnAId="";var hpBtn1 = "Listen Now";var hpBtn2 = "Add to QuickList";var hpBtn3 = "Download Album";var hpBtn4 = "Add to My Raaga";var hpBtn5 = "E-Mail Album";var hpBtn6 = "Embed Album";var hpBtn7 = '';
function setBtnBar1(id,aId,aName){	
	hpBtnDId = id;
	hpBtnAId = aId;
	//alert(hpBtnDId);
	//alert(hpBtnAId);
	//alert(hpBtn1);
	hpBtnBar = '';
	hpBtnBar = hpBtnBar +  '<table cellpadding=2 cellspacing=2 border=0 width=105 align=center>'
	hpBtnBar= hpBtnBar +  '<tr>'
	hpBtnBar= hpBtnBar +  '<td nowrap><a href="" onMouseOver="dTxt(\''+hpBtnDId+'\',\''+hpBtn1+'\');" onMouseOut="dTxt(\''+hpBtnDId+'\',\''+hpBtn7+'\')" onClick="top.playAlbum(\''+hpBtnAId+'\');return false" class=albTools><img src='+imgPath+'common/icon/y/play-sml.jpg border=0 width=16 height=16></a></td>'
	hpBtnBar= hpBtnBar +  '<td nowrap><a href="" onMouseOver="dTxt(\''+hpBtnDId+'\',\''+hpBtn2+'\');" onMouseOut="dTxt(\''+hpBtnDId+'\',\''+hpBtn7+'\')" onClick="top.quicklistAlbum(\''+hpBtnAId+'\');return false" class=albTools><img src='+imgPath+'common/icon/y/add16.jpg border=0 width=16 height=16></a></td>'
	hpBtnBar= hpBtnBar +  '<td nowrap><a href="" onMouseOver="dTxt(\''+hpBtnDId+'\',\''+hpBtn3+'\');" onMouseOut="dTxt(\''+hpBtnDId+'\',\''+hpBtn7+'\')" onClick="top.addFullAlbum(\''+hpBtnAId+'\',hpBtn7);return false" class=albTools><img src='+imgPath+'common/icon/y/download16.jpg border=0 height=16 width=16></a></td>'
	hpBtnBar= hpBtnBar +  '</tr>'
	hpBtnBar= hpBtnBar +  '<tr>'
	hpBtnBar= hpBtnBar +  '<td nowrap><a href="" onMouseOver="dTxt(\''+hpBtnDId+'\',\''+hpBtn4+'\');" onMouseOut="dTxt(\''+hpBtnDId+'\',\''+hpBtn7+'\')" onClick="top.saveAlbum(\''+hpBtnAId+'\');return false;" class=albTools><img src='+imgPath+'common/icon/y/heart16.jpg border=0 width=16 height=16></a></td>'
	hpBtnBar= hpBtnBar +  '<td nowrap><a href="" onMouseOver="dTxt(\''+hpBtnDId+'\',\''+hpBtn5+'\');" onMouseOut="dTxt(\''+hpBtnDId+'\',\''+hpBtn7+'\')" onClick="top.shareAlbum(\''+hpBtnAId+'\');return false;" class=albTools><img src='+imgPath+'common/icon/share-icon.jpg border=0 width=16 height=16></a></td>'
	hpBtnBar= hpBtnBar +  '<td nowrap><a href="" onMouseOver="dTxt(\''+hpBtnDId+'\',\''+hpBtn6+'\');" onMouseOut="dTxt(\''+hpBtnDId+'\',\''+hpBtn7+'\')" onClick="top.embedAlbum(\''+hpBtnAId+'\');return false;" class=albTools><img src='+imgPath+'common/icon/y/embed16.jpg border=0 width=16 height=16></a></td>'
	hpBtnBar= hpBtnBar +  '</tr>'

	hpBtnBar= hpBtnBar +  '<tr>'
	hpBtnBar= hpBtnBar +  '	<td nowrap colspan=3><div class=smlTxt id='+hpBtnDId+'>&nbsp;</div></td>'
	hpBtnBar= hpBtnBar +  '</tr>'
	hpBtnBar= hpBtnBar +  '</table>'	
	 document.write(hpBtnBar);	 
}

function setBtnBar(id,aId,aName){	
	hpBtnDId = id;
	hpBtnAId = aId;
	//alert(hpBtnDId);
	//alert(hpBtnAId);
	//alert(hpBtn1);
	hpBtnBar = '';
	hpBtnBar = hpBtnBar +  '<table cellpadding=2 cellspacing=2 border=0 width=105 align=center>'
	hpBtnBar= hpBtnBar +  '<tr>'
	hpBtnBar= hpBtnBar +  '<td nowrap id="hpLnk"><a href="" onClick="top.quicklistAlbum(\''+hpBtnAId+'\');return false" class=albTools><img src='+imgPath+'common/icon/y/add16.jpg border=0 width=10 height=10> Quicklist</a></td>'
	hpBtnBar= hpBtnBar +  '<td nowrap id="hpLnk"><a href="" onClick="top.shareAlbum(\''+hpBtnAId+'\');return false;" class=albTools><img src='+imgPath+'common/icon/share-icon.jpg border=0 width=10 height=10> Share</a></td>'
	
	hpBtnBar= hpBtnBar +  '</tr>'
	hpBtnBar= hpBtnBar +  '<tr>'
	hpBtnBar= hpBtnBar +  '<td nowrap id="hpLnk"><a href="" onClick="top.saveAlbum(\''+hpBtnAId+'\');return false;" class=albTools><img src='+imgPath+'common/icon/y/heart16.jpg border=0 width=10 height=10> My Raaga</a></td>'
	hpBtnBar= hpBtnBar +  '<td nowrap id="hpLnk"><a href="" onClick="top.embedAlbum(\''+hpBtnAId+'\');return false;" class=albTools><img src='+imgPath+'common/icon/y/embed16.jpg border=0 width=10 height=10> Embed</a></td>'
	hpBtnBar= hpBtnBar +  '</tr>'
	hpBtnBar= hpBtnBar +  '<tr>'
	hpBtnBar= hpBtnBar +  '<td nowrap id="hpLnk"><a href="" onClick="top.addFullAlbum(\''+hpBtnAId+'\',hpBtn7);return false" class=albTools><img src='+imgPath+'common/icon/y/download16.jpg border=0 width=10 height=10> Download</a></td>'
	hpBtnBar= hpBtnBar +  '<td nowrap id="hpLnk"><a href="" onClick="top.playAlbum(\''+hpBtnAId+'\');return false" class=albTools><img src='+imgPath+'common/icon/y/play-sml.jpg border=0 width=10 height=10> Play</a></td>'
	
	hpBtnBar= hpBtnBar +  '</tr>'
	/*hpBtnBar= hpBtnBar +  '<tr>'
	hpBtnBar= hpBtnBar +  '	<td nowrap colspan=3><div class=smlTxt id='+hpBtnDId+'>&nbsp;</div></td>'
	hpBtnBar= hpBtnBar +  '</tr>'*/
	hpBtnBar= hpBtnBar +  '</table>'
	
	document.write(hpBtnBar);
}



function setHBtnBar(aId,aName){	
	hpBtnAId = aId;
	hpBtnBar = '';
	hpBtnBar= hpBtnBar +  '<div id="bhheader" class="grayBdr"><ul id="bhnav">'
	hpBtnBar= hpBtnBar +  '<li id="bh-dload"><a href="" onClick="top.addFullAlbum(\''+hpBtnAId+'\',hpBtn7);return false">MP3 Downloads</a></li>';
	hpBtnBar= hpBtnBar +  '<li id="bh-listen"><a href="" onClick="top.playAlbum(\''+hpBtnAId+'\');return false">Listen Now</a></li>';
	hpBtnBar= hpBtnBar +  '<li id="bh-myraaga"><a href="" onClick="top.saveAlbum(\''+hpBtnAId+'\');return false;">Add to My Raaga</a></li>';
	hpBtnBar= hpBtnBar +  '<li id="bh-qlist"><a href="" onClick="top.quicklistAlbum(\''+hpBtnAId+'\');return false;">QuickList</a></li>';
	hpBtnBar= hpBtnBar +  '<li id="bh-share"><a href="" onClick="top.shareAlbum(\''+hpBtnAId+'\');return false;">Share</a></li>';
	hpBtnBar= hpBtnBar +  '<li id="bh-embed"><a href="" onClick="top.embedAlbum(\''+hpBtnAId+'\');return false;">Embed</a></li>';
	hpBtnBar= hpBtnBar +  '</ul></div>';	
	document.write(hpBtnBar);
}

function previewWidget(u,t,w,h){
	popWin(u, t, w,h);
}

function publishPLs(m){
	var frm = document.raaga	
	if(frm){
		frm.plm.value = m
		frm.submit()
	}
}

function importAB(x){
	winW = 600
	winH = 500
	doWin(x,"abImport",1)
}

function importFriends(x){
	winW = 600
	winH = 500
	doWin(x,"friendsImport",1)
}


function blinkit(o){
intrvl=0;
	if (o && document.getElementById(o) ){
	for(nTimes=0;nTimes<5;nTimes++){
		intrvl += 200;
		setTimeout("document.getElementById('"+o+"').style.backgroundColor='#FFFF33';",intrvl);
		intrvl += 200;
		setTimeout("document.getElementById('"+o+"').style.backgroundColor='#FFFFFF';",intrvl);
	}
	}
}

function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
}

function fbs_click(u,t) {window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}

//document.onkeypress = stopRKey; 
//-->