// JavaScript Document
//HTTP_SERVER = 'http://www.likezebra.com/';

/********************************************************************************************************
DONT DELETE 
**********************************************************************************************/
// SEARCH FORM ////////////////////////////////////////////////////////////////////////////////////
function verifySearch(thisForm) {
	
	var kw = thisForm.kw.value;
	
	if(!thisForm.kw.value) {
		alert('Please enter a keyword to search');
		return false;
	} else {
		window.location='#search-bands/kw='+kw;
		pageload('search-bands/kw='+kw);
		return false;
	}
}

// TEXT COUNTER FOR FORM FIELDS //////////////////////////////////////////////////////////
function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
		cntfield.value = maxlimit - field.value.length;
}

if (document.images) {
  pic1= new Image(550,63); 
  pic1.src="../images/TwoTabs_Top2.png"; 
}

//BUG FORM /////////////////////////////////////////////////////////////////////////////////////
function changeStyle(id) {
	id.style.borderColor='#0066FF';
	id.style.background='#FFFFFF';
}

function removeStyle(id) {
	id.style.borderColor='#999999';
	id.style.background='#F2F2F2';
}

function bugClick(){
	$(".bug_click").click(function () { 
      
	  if(document.getElementById('bug_wrapper').style.display=='block') {
				document.getElementById('bug_wrapper').style.display='none';
				document.getElementById('text_here').innerHTML = '';
			} else {
				document.getElementById('bug_wrapper').style.display='block';
			}
	  
    });
}

/********************************************************************************************************
END DONT DELETE 
**********************************************************************************************/


/*
// ****************  Loading Track Albums BM 07/13/09	*************  //
function getAlbum(album_id) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	var url=HTTP_SERVER+"manage_music_get_album.php"
	url=url+"?album_id="+album_id;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=showAlbum
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)	
}

function showAlbum() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("album_featured_container").innerHTML =  xmlHttp.responseText
		
		// initiate editText class on the featured album - function found in instantedit.js
		 editbox_init();
		 
		 // reset lightbox
		 lightwindowInit();
		 
	}
}
*/

function getUserComments() {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}

	page = parseInt(document.getElementById('comment_page').value);
	document.getElementById('comment_page').value = page+1;
	profile_id = document.getElementById('comment_profile_id').value;
	var more = document.getElementById('more_comments');
	more.style.display = 'none';
	more.setAttribute('id','');
	
	var url=HTTP_SERVER+"profile_get_user_comments.php"
	url=url+"?page="+page;
	url=url+"&profile_id="+profile_id;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=sendUserComments
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)	
}

function sendUserComments() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		var comments = document.createElement('div');
		comments.innerHTML = xmlHttp.responseText;
		document.getElementById('user_comments').appendChild(comments);
	}
}


// ****************  End Loading Track Albums BM 07/10/09	*************  //

function changePassword(formObj) {
	var curPassword = formObj.old_password;
	var newPassword = formObj.new_password;
	var cnfPassword = formObj.conf_password;

	if(!curPassword.value) {
		alert("Please enter your current password to begin password change process");
	}
	else {
		if(!newPassword.value || !cnfPassword.value) {
			alert("Please enter your new password twice to finish password change process");
		}
		else {
			document.getElementById("changing_password").style.display='block';  
			javascript:ajax_loadContent('changing_password','/change_password.php?old_password='+curPassword.value+'&new_password='+newPassword.value+'&conf_password='+cnfPassword.value+'','Processing...');	
			curPassword.value = '';
			newPassword.value = '';
			cnfPassword.value = '';
		}
	}
}




// Rollover for 'invite fan/band to likeZebra' image - BM 7/03/09
function inviteRollover(href) {
	document.getElementById("invite_image").src = href;
}
// end Rollover for 'invite fan/band to likeZebra' image - BM 7/03/09

function showProgBar() {
	document.getElementById('progBar').style.display='block';
}

function editBlurb() {
	document.getElementById('cur-blurb').style.display='none';
	document.getElementById('new-blurb').style.display='inline';
}

function editDisplayName() {
	document.getElementById('cur-displayname').style.display='none';
	document.getElementById('new-displayname').style.display='inline';
}

function editUpdate(update_id) {
	document.getElementById('cur-update-'+update_id).style.display='none';
	document.getElementById('new-update-'+update_id).style.display='inline';
}

function editConfig(update_id) {
	document.getElementById('cur-update-'+update_id).style.display='none';
	document.getElementById('new-update-'+update_id).style.display='inline';
}

function updateGenre(genre_id) {
	document.getElementById('cur-genre-'+genre_id).style.display='none';
	document.getElementById('new-genre-'+genre_id).style.display='inline';
}

function deleteMessage(conversation_id, from) {
	if(window.confirm("Are you sure you want to delete this conversation?")) {
		javascript:ajax_loadContent('message-'+conversation_id,'/del-message.php?conversation_id='+conversation_id,'Deleting...');	
	}
}

/*function deletePeer(user_id) {
	if(window.confirm("Are you sure you want to remove this user as a peer?")) {
		javascript:ajax_loadContent('peer-'+user_id,'/delete-peer.php?user_id='+user_id,'Processing...');	
	}
}*/

function deleteBlog(blog_id) {
	if(window.confirm("Are you sure you want to remove this blog? This can not be undone!")) {
		javascript:ajax_loadContent('blog-'+blog_id,'/delete-blog.php?blog_id='+blog_id,'Deleting...');	
	}
}

function delCategory(category_id) {
	if(window.confirm("Are you sure you want to remove this category and all ads within? This can not be undone!")) {
		javascript:ajax_loadContent('category-'+category_id,'/del-category.php?category_id='+category_id,'Deleting...');	
	}
}

function delGenre(genre_id) {
	if(window.confirm("Are you sure you want to remove this genre? This can not be undone!")) {
		javascript:ajax_loadContent('genre-'+genre_id,'/del-genre.php?genre_id='+genre_id,'Deleting...');	
	}
}

function deleteAd(post_id) {
	if(window.confirm("Are you sure you want to remove this ad? This can not be undone!")) {
		javascript:ajax_loadContent('ad-'+post_id,'/delete-ad.php?post_id='+post_id,'Deleting...');	
	}
}

function deleteEvent(event_id) {
	if(window.confirm("Are you sure you want to remove this event? This can not be undone!")) {
		javascript:ajax_loadContent('event-'+event_id,'/delete-event.php?event_id='+event_id,'Deleting...');	
	}
}

function deletePage(id) {
	if(window.confirm("Are you sure you want to remove this page? This can not be undone!")) {
		javascript:ajax_loadContent('page-'+id,'/delete-page.php?id='+id,'Deleting...');	
	}
}

function deleteAlbum(album_id) {
	if(window.confirm("Are you sure you want to delete this album and all the artwork in it? This can not be undone!")) {
		javascript:ajax_loadContent('album-'+album_id,'/delete-album.php?album_id='+album_id,'Deleting...');	
	}
}

function deletePhoto(photo_id) {
	if(window.confirm("Are you sure you want to delete this image? This can not be undone!")) {
		javascript:ajax_loadContent('photo-'+photo_id,'/delete-photo.php?photo_id='+photo_id,'Deleting...');	
	}
}

function deleteTrack(audio_id) {
	if(window.confirm("Are you sure you want to delete this track? This can not be undone!")) {
		javascript:ajax_loadContent('delete-'+audio_id,'/delete-track.php?audio_id='+audio_id,'Deleting...');	
	}
}

function deleteDir(id) {
	if(window.confirm("Are you sure you want to delete this entry? This can not be undone!")) {
		javascript:ajax_loadContent('dir-'+id,'/delete-dir.php?id='+id,'Deleting...');	
	}
}

function loadImage(artwork_id) {
	var collection = document.getElementById('collections_album');
	
	if(collection.value!='0') {
		var user_id = document.getElementById('collections_album').value;
		javascript:ajax_loadContent('featuredArt','/_view_photo.php?collections='+user_id+'&photo='+artwork_id,'Grabbing Media...');	
	}
	else {
		javascript:ajax_loadContent('featuredArt','/_view_photo.php?photo='+artwork_id,'Grabbing Media...');	
	}
}

function loadAlbum(album_id) {
	document.getElementById('my-artwork').className = 'current';
	document.getElementById('my-collection').className = '';
	document.getElementById('my-personal').className = '';
	var viewAll;
	
	if( document.getElementById('view-all').checked == true) {
		viewAll = 1;
	}
	else {
		viewAll = 0;
	}

	javascript:ajax_loadContent('curAlbum','/_album-transition.php?viewall='+viewAll+'&album_id='+album_id,'Getting album...');	
}

function loadPersonalAlbum(album_id) {
	document.getElementById('my-artwork').className = '';
	document.getElementById('my-collection').className = '';
	document.getElementById('my-personal').className = 'current';
	var viewAll;
	
	if( document.getElementById('view-all').checked == true) {
		viewAll = 1;
	}
	else {
		viewAll = 0;
	}

	javascript:ajax_loadContent('curAlbum','/_album-transition.php?viewall='+viewAll+'&album_id='+album_id,'Getting album...');	
}

function loadCollections(user_id) {
	document.getElementById('my-artwork').className = '';
	document.getElementById('my-collection').className = 'current';
	document.getElementById('my-personal').className = '';
	var viewAll;
	
	if( document.getElementById('view-all').checked == true) {
		viewAll = 1;
	}
	else {
		viewAll = 0;
	}

	javascript:ajax_loadContent('curAlbum','/_album-transition.php?viewall='+viewAll+'&album_id=collection&user_id='+user_id,'Getting album...');	
}

function viewAllCurrent() {
	var artwork = document.getElementById('my-artwork');
	var collection = document.getElementById('my-collection');
	var personal = document.getElementById('my-personal');
	
	if(artwork.className=='current') { 
		loadAlbum(document.getElementById('album_id').value);
	}
	if(collection.className=='current') {
		loadCollections(document.getElementById('collections-album').value);
	}
	if(personal.className=='current') {
		loadPersonalAlbum(document.getElementById('personal-album').value);
	}
}

function findFriends() {
	document.getElementById('findfriends-link').style.display = 'none';
	document.getElementById('findfriends-search').style.display = 'inline';
}

function giveStar(artwork_id, user_id) {
	javascript:ajax_loadContent('give-star','/give-star.php?photo='+artwork_id+'&user_id='+user_id,'Incrementing...');	
	document.getElementById('star-count').innerHTML = document.getElementById('star-count-incremented').innerHTML;
}

function addToWidget(audio_id) {alert('what');
	//divId = divId || 'widget';
	javascript:ajax_loadContent('','/add-to-widget.php?audio_id='+audio_id,'...'); 	 
	if(document.getElementById('widget-playlist') && divId != 'widgetlist') {
		loadWidget();
	}
}

function addToFeatured(artwork_id) {
	javascript:ajax_loadContent('photo-'+artwork_id,'/add-to-featured.php?photo='+artwork_id,'Featuring...');	
}

function featureAlbum(album_id) {
	javascript:ajax_loadContent('album-'+album_id,'/feature-album.php?album_id='+album_id,'Featuring...');	
}

function addToFeaturedDir(id) {
	javascript:ajax_loadContent('dir-'+id,'/add-to-featured-dir.php?id='+id,'Featuring...');	
}

function removeFromWidget(audio_id, divId) {
	divId = divId || 'widget';
	javascript:ajax_loadContent(divId+'-'+audio_id,'/remove-from-widget.php?audio_id='+audio_id,'...');	
	if(document.getElementById('widget-playlist') && divId != 'widgetlist') {
		loadWidget();
	}
}

function loadWidget() {
	setTimeout(ajax_loadContent('widget-playlist','/list-widget.php','Refreshing...'), 5);	
}

function removeFromFeatured(artwork_id) {
	javascript:ajax_loadContent('photo-'+artwork_id,'/remove-from-featured.php?photo='+artwork_id,'Removing...');	
}

function removeFeaturedDir(dir_id) {
	javascript:ajax_loadContent('dir-'+dir_id,'/remove-from-featured-dir.php?dir='+dir_id,'Removing...');	
}

function verifySignup() {
	if(!document.getElementById('username').value) {
			alert("You must enter a username to register");
			document.getElementById('username').focus();
			return false;
	}
	if(!document.getElementById('password').value) {
			alert("You must enter a password to register");
			document.getElementById('password').focus();
			return false;
	}
	if(!document.getElementById('confirm_pw').value) {
			alert("You must enter a password to register");
			document.getElementById('confirm_pw').focus();
			return false;
	}
	if(!document.getElementById('email').value) {
			alert("You must enter an email address to register");
			document.getElementById('email').focus();
			return false;
	}
	if(!document.getElementById('confirm_email').value) {
			alert("You must enter an email address to register");
			document.getElementById('confirm_email').focus();
			return false;
	}
	return true;	
}



function trackMouseOver(divId) {
	document.getElementById(divId).className = 'trackBg-longBlack';
	document.getElementById(divId+'-actions').style.visibility = 'visible';
}

function trackMouseOut(divId, className) {
	document.getElementById(divId).className = className;
	document.getElementById(divId+'-actions').style.visibility = 'visible';
}


if (document.images) {
  pic1= new Image(550,63); 
  pic1.src="../images/TrackBar_Active.png"; 
}




function createRingtone(audio_id) {
	javascript:ajax_loadContent('convert-'+audio_id,'make-ringtone.php?audio_id='+audio_id,'');	
	javascript:refreshRingtoneList();
	setInterval('refreshRingtoneList()', 5000);
}

function refreshRingtoneList() {
	javascript:ajax_loadContent('ringtoneList','list-ringtones.php','Refreshing...');	
}

function refreshTrackList() {
	javascript:ajax_loadContent('trackList','list-tracks.php','Refreshing...');	
}

function editTrack(audio_id) {
	document.getElementById('edit-track-'+audio_id).style.display='block';
	document.getElementById('edit-button-'+audio_id).style.display='none';	
}

// function addslashes
function addslashes(str) {
str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\0/g,'\\0');
return str;
}

function saveTrack(audio_id) {
	title = document.getElementById('title-'+audio_id).value;
	artist = document.getElementById('artist-'+audio_id).value;
	javascript:ajax_loadContent('track-'+audio_id,'update-track.php?audio_id='+audio_id+'&title='+title+'&artist='+artist,'Saving...');	
	document.getElementById('edit-track-'+audio_id).style.display='none';
	document.getElementById('edit-button-'+audio_id).style.display='block';	
}

// updating track with album_id - BM 7/15/09
function saveTrack2(audio_id) {
	title = document.getElementById('title-'+audio_id).value;
	artist = document.getElementById('artist-'+audio_id).value;
	album_id = document.getElementById('album_id-'+audio_id).value;
	current_album_id = document.getElementById('current_album_id').value;
	
	javascript:ajax_loadContent('track-'+audio_id,'update-track.php?audio_id='+audio_id+'&title='+title+'&artist='+artist+'&album_id='+album_id,'Saving...');	
	
	if(current_album_id != album_id)  {
		document.getElementById('track-'+audio_id).style.display = 'none'; 
	
		album_count = document.getElementById('album_count'); 
		album_count.value -= 1;
		if(album_count.value < 1 )
			document.getElementById('ringtoneList').innerHTML = '<span style="margin-left: 30px; padding:5px;">Empty library</span>';
	}

	document.getElementById('edit-track-'+audio_id).style.display='none';
	document.getElementById('edit-button-'+audio_id).style.display='block';

}
// end updating track with album_id - BM 7/15/09

function trackMouseOver(divId) {
	document.getElementById(divId).className = 'trackBg-longBlack';
	document.getElementById(divId+'-actions').style.visibility = 'visible';
}

function trackMouseOut(divId, className) {
	document.getElementById(divId).className = className;
	document.getElementById(divId+'-actions').style.visibility = 'visible';
}





/* Drop down JS */
/*
window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
var menuActive = 0;
var menuOn = 0;
var onLayer;
var timeOn = null;

function showLayer(layerName,aa){
var x =document.getElementById(aa);
var tt =findPosX(x);
var ww =findPosY(x)+20;

if (timeOn != null) {
clearTimeout(timeOn);
hideLayer(onLayer);
}
if (IE4) {
var layers = eval('document.all["'+layerName+'"].style');
layers.left = tt;
eval('document.all["'+layerName+'"].style.display="block"');
}
else {
if(document.getElementById){
var elementRef = document.getElementById(layerName);
if((elementRef.style)&& (elementRef.style.visibility!=null)){
elementRef.style.display = 'block';
elementRef.style.left = tt;
elementRef.style.top = ww;
}
}
}
onLayer = layerName
}

function hideLayer(layerName){
if (menuActive == 0)
{
if (IE4){
eval('document.all["'+layerName+'"].style.display="none"');
}
else{
if(document.getElementById){
var elementRef = document.getElementById(layerName);
if((elementRef.style)&& (elementRef.style.display!=null)){
elementRef.style.display = 'none';
}
}
}
}
}

function btnTimer() {
timeOn = setTimeout("btnOut()",600)
}

function btnOut(layerName){
if (menuActive == 0){
hideLayer(onLayer)
}
}

var item;
function menuOver(itemName,ocolor){
item=itemName;
itemName.style.backgroundColor = ocolor; //background color change on mouse over
clearTimeout(timeOn);
menuActive = 1
}

function menuOut(itemName,ocolor){
if(item)
itemName.style.backgroundColor = ocolor;
menuActive = 0
timeOn = setTimeout("hideLayer(onLayer)", 100)
}

function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}

function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
/* END DROP DOWN JS */


// set News Videos
function setNewsVideos() {
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//  get collection of posts that have video
	//  this collection will hold the media type and media_id separated by '|' the pipe
	//  ie: news_123|news_124
	//  send out info to get video parameters
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	var id_group = $("#div_ids").val();
	if(id_group == '')  {
		return false;
	} else {
		$.get('buzz_get_video.php', {media_info:id_group, sid:Math.random()}, function(response){
			// alert("response: "+response);
			var videos = response.split("||");
			for(var i=0; i<videos.length; i++) {
				var values = videos[i].split("|");
				if (values[1] == "Video Unavailable") {
					$("#"+values[3]).html(values[1]);
				} else {
					
					var so = new SWFObject("flvPlayer.swf?imagePath="+HTTP_SERVER+"files/"+values[0]+"&videoPath="+HTTP_SERVER+"files/"+values[1]+"&autoStart=false&autoHide=false&autoHideTime=5&hideLogo=true&volAudio=60&newWidth=780&newHeight=460&disableMiddleButton=false&playSounds=false&soundBarColor=0x0066FF&barColor=0x0066FF&barShadowColor=0x91BBFB&subbarColor=0xffffff&videoDuration="+values[2]+"", "sotester", "455", "279", "9", "#efefef");
					so.addParam("allowFullScreen", "true");
					so.addParam("wmode", "transparent");
					so.write(values[3]);
				}
			}		
		});
	}
}



/*************************************************************************************************
tagline image swap
*************************************************************************************************/
function tagLineLinks() {
	
	// preload images
	if (document.images) {
	  join_artist_ro= new Image(187,74); 
	  join_artist_ro.src=HTTP_SERVER+'images/Join-Artist-ro.png'; 
	  
	  join_fan_ro= new Image(133,74); 
	  join_fan_ro.src=HTTP_SERVER+'images/Join-Fan-ro.png';
	  
	  invite_artist_ro= new Image(187,74); 
	  invite_artist_ro.src=HTTP_SERVER+'images/Invite-Artist-ro.png'; 
	  
	  invite_fan_ro= new Image(133,74); 
	  invite_fan_ro.src=HTTP_SERVER+'images/Invite-Fan-ro.png'; 
	  
	  top_10_ro=new Image(72,72);
	  top_10_ro.src=HTTP_SERVER+'images/Top10Button-Rollover.png';
	  
	  top_downloads_ro=new Image(72,72);
	  top_downloads_ro.src=HTTP_SERVER+'images/DownloadsButton-Rollover.png';
	  
	  most_loves_ro=new Image(72,72);
	  most_loves_ro.src=HTTP_SERVER+'images/LoveButton-Rollover.png';
	  
	  popular_ro=new Image(72,72);
	  popular_ro.src=HTTP_SERVER+'images/PopularButton-Rollover.png';
	}

	
	// set join artist functions
	if(document.getElementById('join_artist')) {
		document.getElementById('join_artist').onmouseover = function joinArtistOver() {
			this.src=join_artist_ro.src;	
			this.style.cursor = 'pointer';	
		}
		document.getElementById('join_artist').onmouseout = function joinArtist() {
			this.src=HTTP_SERVER+'images/Join-Artist.png';
		}
		document.getElementById('join_artist').onclick = function joinArtistClick() {
			window.location = "#signup";
			pageload('signup');
		}
	}
	
	// set join fan functions
	if(document.getElementById('join_fan')) {
		document.getElementById('join_fan').onmouseover = function joinFanOver() {
			this.src=join_fan_ro.src;	
			this.style.cursor = 'pointer';
		}
		document.getElementById('join_fan').onmouseout = function joinFan() {
			this.src=HTTP_SERVER+'images/Join-Fan.png';	
		}
		document.getElementById('join_fan').onclick = function joinFanClick() {
			window.location = "#signup-fan";
			pageload('signup-fan');
		}
	}
	
	// set invite artist functions
	if(document.getElementById('invite_artist')) {
		document.getElementById('invite_artist').onmouseover = function inviteArtistOver() {
			this.src=invite_artist_ro.src;	
			this.style.cursor = 'pointer';
		}
		document.getElementById('invite_artist').onmouseout = function inviteArtist() {
			this.src=HTTP_SERVER+'images/Invite-Artist-static.png';	
		}
		document.getElementById('invite_artist').onclick = function inviteArtistClick() {
			var sender = document.getElementById('signedin_user').getAttribute('alt');
			modalWindow('invite_user.php?type=artist&sender='+sender);
		}
	}
	
	// set invite fan functions
	if(document.getElementById('invite_fan')) {
		document.getElementById('invite_fan').onmouseover = function inviteFanOver() {
			this.src=invite_fan_ro.src;	
			this.style.cursor = 'pointer';
		}
		document.getElementById('invite_fan').onmouseout = function inviteFan() {
			this.src=HTTP_SERVER+'images/Invite-Fan-static.png';	
		}
		document.getElementById('invite_fan').onclick = function inviteFanClick() {
			var sender = document.getElementById('signedin_user').getAttribute('alt');
			modalWindow('invite_user.php?type=fan&sender='+sender);
		}
	}
	
	
	// set top 10 button functions
	if(document.getElementById('top_10_button')) {
		document.getElementById('top_10_button').onmouseover = function () {
			this.src=top_10_ro.src;	
			this.style.cursor = 'pointer';
		}
		document.getElementById('top_10_button').onmouseout = function () {
			this.src=HTTP_SERVER+'images/Top10Button-Static.png';	
		}
		document.getElementById('top_10_button').onclick = function () {
			loadPlaylistChooser(HTTP_SERVER+"playlist_chooser.php?sid="+Math.random()+"&playlist_title=Top%2010&track_total=10&date_created=&playlist_image=Top10Button-Static.png","top-10-playlist.xml");
		}
	}
	
	// set top downloads button functions
	if(document.getElementById('top_downloads_button')) {
		document.getElementById('top_downloads_button').onmouseover = function () {
			this.src=top_downloads_ro.src;	
			this.style.cursor = 'pointer';
		}
		document.getElementById('top_downloads_button').onmouseout = function () {
			this.src=HTTP_SERVER+'images/DownloadsButton-Static.png';	
		}
		document.getElementById('top_downloads_button').onclick = function () {		
			loadPlaylistChooser(HTTP_SERVER+"playlist_chooser.php?sid="+Math.random()+"&playlist_title=Top%20Downloads&track_total=10&date_created=&playlist_image=DownloadsButton-Static.png","top-downloaded-playlist.xml");
		}
	}
	
	// set top downloads button functions
	if(document.getElementById('most_loves_button')) {
		document.getElementById('most_loves_button').onmouseover = function () {
			this.src=most_loves_ro.src;	
			this.style.cursor = 'pointer';
		}
		document.getElementById('most_loves_button').onmouseout = function () {
			this.src=HTTP_SERVER+'images/LoveButton-Static.png';	
		}
		document.getElementById('most_loves_button').onclick = function () {
			loadPlaylistChooser(HTTP_SERVER+"playlist_chooser.php?sid="+Math.random()+"&playlist_title=Top%20Loves&track_total=10&date_created=&playlist_image=LoveButton-Static.png","top-loves-playlist.xml");
			
		}
	}
	
	
	// set top downloads button functions
	if(document.getElementById('popular_button')) {
		document.getElementById('popular_button').onmouseover = function () {
			this.src=popular_ro.src;	
			this.style.cursor = 'pointer';
		}
		document.getElementById('popular_button').onmouseout = function () {
			this.src=HTTP_SERVER+'images/PopularButton-Static.png';	
		}
		document.getElementById('popular_button').onclick = function () {
			loadPlaylistChooser(HTTP_SERVER+"playlist_chooser.php?sid="+Math.random()+"&playlist_title=Popular&track_total=10&date_created=&playlist_image=PopularButton-Static.png","random-10-playlist.xml");
		}
	}
	
}


function successMessage(msg, milliseconds){
	// if seconds is null, default to 3 seconds
	if(!milliseconds) milliseconds = 3000;
	
	// remove if success message is visible
	if($('#success_message').is('*') )
		$('#success_message').remove();
		
	// create a new success message div
	var success = document.createElement('div');
	success.setAttribute('id', 'success_message');
	document.body.insertBefore(success, document.body.firstChild);

	// display and remove success message
	$('#success_message').html("<div id='message_content'>"+msg+"</div>").fadeIn(function(){
		setTimeout(function(){
			$('#success_message').fadeOut(function(){ 
				$('#success_message').remove('#success_message');
			})
		}, milliseconds);
	});
	
	
}

function signupClasses () {
	
	$(".tab_link").click(function(){
		$('.tab_link').css({'color':'#f90'}); 
		$(this).css({'color':'#06f'});  
		
		$(".hide_content").hide();
		
		var id = "#"+$(this).attr('id')+"_content";
		$(id).show();

		var pos=$(id).position(); 
		scrollToTop(pos.top);
	});
	
	
}



/*
function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		//Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}


*/