	//			All pages
	var gAjaxPermit = false;
	var gFunZoneStatus = 1;
	var gThoughtType = 0;
	var gMemberUid = 0;
	var gCountryCode = null;
	var gMemberBroadcast = 0;
	var gNewArrivalMember = 0;
	var gStationId = 0;
	var gStationOnlineStatus = 9;
	var gStationUid = null;
	var gMemberToView = null;
	var gMemberViews = null;
	var gMemberSimilars = null;
	var gMemberStationId = null;
	var searchArtistId = 0;
	var searchTrackId = 0;
	var gPostId = 0;
	var gSingleMeepId = 0;
	var gMeepStationId = 0;
	var gStationPageOnButtons = false;
	
	window.self.focus();
	window.self.name = "web";
	
	function refreshPage()
	{
		window.parent.location.reload(); 				
	}
	
	function loadMiddlePanelCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{					
			return;
		}
		document.getElementById('middle_content').innerHTML = text;		
		gAjaxPermit = false;
		eval(usr_word);
	}
	
	function releaseAjax()
	{
		gAjaxPermit = false;
	}
	
	function loadMiddlePanel(link, func, back)
	{
		mp_stationPageChatDisconnect();
		
		if (document.getElementById('blog_adds') != null)
			document.getElementById('blog_adds').style.display = 'none';
		if (document.getElementById('middle-footer-d') != null)	
			document.getElementById('middle-footer-d').style.display = "block";
		if ( gAjaxPermit )
		{
			return;
		}
		if ( document.getElementById('member_top_nav') != null )
			document.getElementById('member_top_nav').cursor = 'wait';
		if (document.getElementById('listeners_help_info') != null)
			document.getElementById('listeners_help_info').style.display = "none";
		if (document.getElementById('invitation_help_info') != null)
			document.getElementById('invitation_help_info').style.display = "none";
		if (document.getElementById('pm_help_info') != null)
			document.getElementById('pm_help_info').style.display = "none";
		if (document.getElementById('favorites_help_info') != null)
			document.getElementById('favorites_help_info').style.display = "none";
		this.MiddlePanelcallback = loadMiddlePanelCallback;	
		var req = new JSAjaxDoc(this, "MiddlePanelcallback", func);
		if (back)
			req.addParam('back_clicked', back);
		gAjaxPermit = true;
		req.send(link, "GET");		

	}
	
	function loadLeftPanelCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('left_content').innerHTML = text;
		if (gCountryCode != null && document.getElementById('country') != null)
		{
			document.getElementById('country').value = gCountryCode;
		}
	}
	
	function loadLeftPanel(link)
	{
		if (link != '/fun_zone/fun_zone.php' || gFunZoneStatus == 1)
		{
			if (link == '/fun_zone/fun_zone.php')
				gFunZoneStatus = 0;
			this.loadLeftP = loadLeftPanelCallback;	
			var req = new JSAjaxDoc(this, "loadLeftP");
			req.send(link, "POST");
		}
	}
	
	function selectMeeBarHelp(link)
	{
		document.getElementById('mee_profile_bar').style.fontWeight = "normal";
		document.getElementById('mee_community_bar').style.fontWeight = "normal";
		document.getElementById('mee_music_bar').style.fontWeight = "normal";
		document.getElementById(link).style.fontWeight = "bold";
		if (link == 'mee_profile_bar')
		{
			window.location='/profile/help/';
		}
		if (link == 'mee_community_bar')
		{
			window.location='/blog/';
		}
		if (link == 'mee_music_bar')
		{
			window.location='/stations/';
		}
		
	}
	
	function selectMeeBar(link, div)
	{
		document.getElementById('mee_profile_bar').style.fontWeight = "normal";
		document.getElementById('mee_community_bar').style.fontWeight = "normal";
		document.getElementById('mee_music_bar').style.fontWeight = "normal";
		document.getElementById('mee_source_bar').style.fontWeight = "normal";
		//mee_profile_div
		document.getElementById('mee_profile_div').style.display = "none";
		document.getElementById('mee_community_div').style.display = "none";
		document.getElementById('mee_music_div').style.display = "none";
		document.getElementById('mee_source_div').style.display = "none";
		
		document.getElementById(div).style.display = "block";
		
		document.getElementById(link).style.fontWeight = "bold";
	}
	
	function overMeeBar(link, div)
	{
		document.getElementById('mee_profile_div').style.display = "none";
		document.getElementById('mee_community_div').style.display = "none";
		document.getElementById('mee_music_div').style.display = "none";
		document.getElementById('mee_source_div').style.display = "none";
		
		document.getElementById(div).style.display = "block";		
	}
	
	function checkMeeProfile()
	{
		if (	document.all.profile_bar.style.fontWeight == "normal"
			&&	document.all.pm_bar.style.fontWeight == "normal"
			&&	document.all.invitation_bar.style.fontWeight == "normal"
			&&	document.all.listeners_bar.style.fontWeight == "normal"
			&&	document.all.favorites_bar.style.fontWeight == "normal")
			
			return true;
		else
			return false;
	}
	
	function checkMeeCommunity(link)
	{
		if (document.all.blog_bar.style.fontWeight == "normal"
			&& document.all._bar.style.fontWeight == "normal"
			&& document.all.audience_bar.style.fontWeight == "normal"
			&& document.all.thoughts_bar.style.fontWeight == "normal"
			&& document.all.mee_people_bar.style.fontWeight == "normal")
			return true;
		else
			return false;
	}
	
	function checkMeeMusic()
	{
		if (	document.all.station_bar.style.fontWeight == "normal"
			&&	document.all.top_100_bar.style.fontWeight == "normal"
			&&	document.all.new_releases_bar.style.fontWeight == "normal")
			return true;
		else
			return false;
	}
	
	/*function checkMeeSource()
	{
		if (document.all.source_bar.style.fontWeight == "normal")
			return true;
		else
			return false;
	}*/
	
	function initSelected(link)
	{
		if (link == '/profile/profile.php' || 
			link == '/pm/pm.php' || 
			link == '/invitation/invitation.php' || 
			link == '/listeners/listeners.php' || 
			link == '/favorites/favorites.php')
				initSelectedMeeProfile(link);
					
		if (link == '/blog/blog.php' ||
			link == '/member_search/member_search.php' ||
			link == '/audience/audience.php' ||
			link == '/thoughts/thoughts.php' ||
			link == '/mee_people/mee_people.php')
			initSelectedMeeCommunity(link);
			
		if (link == '/stations/stations.php' || 
			link == '/top_100/top_100.php' ||
			link == '/new_releases/new_releases.php')
			
			initSelectedMeeMusic(link);
			
		//if (link == 'source/source.php')
		//	initSelectedMeeSource(link);
	}
	
	function initSelectedMeeProfile(link)
	{
		selectMeeBar('mee_profile_bar');
		if (link == '/profile/profile.php')
			profileInit();
		if (link == '/pm/pm.php')
			pmInit();
		if (link == '/invitation/invitation.php')
			invitationInit();
		//if (link == '/listeners/listeners.php')
		//	listenersInit();
		if (link == '/favorites/favorites.php')
			favoritesInit();
	}
	
	function initSelectedMeeCommunity(link)
	{
		selectMeeBar('mee_community_bar');
		if (link == '/blog/blog.php')
			blogInit();
		if (link == '/member_search/member_search.php')
			memberSearchInit();
		if (link == '/audience/audience.php')
			audienceInit();
		if (link == '/thoughts/thoughts.php')
			thoughts_init();
		if (link == '/mee_people/mee_people.php')
			mee_people_init();
	}
	
	function initSelectedMeeMusic(link)
	{
		selectMeeBar('mee_music_bar');
		if (link == '/stations/stations.php')
			stationsInit();
		if (link == '/top_100/top_100.php')
			top100Init();
		if (link == '/new_releases/new_releases.php')
			newReleasesInit();
		
	}
	
	
	/*function initSelectedMeeSource(link)
	{
		selectMeeBar('mee_source_bar');
		if (link == 'source/source.php')
			sourceInit();
	}*/
	
	function setBarBold(div_bar)
	{
		document.getElementById('profile_bar').style.fontWeight = "normal"; 
		document.getElementById('pm_bar').style.fontWeight = "normal";
		document.getElementById('invitation_bar').style.fontWeight = "normal";
		document.getElementById('listeners_bar').style.fontWeight = "normal";
		document.getElementById('favorites_bar').style.fontWeight = "normal";
		document.getElementById('feeds_bar').style.fontWeight = "normal";
		
		document.getElementById('station_bar').style.fontWeight = "normal";
		document.getElementById('top_100_bar').style.fontWeight = "normal";
		document.getElementById('top_artists_bar').style.fontWeight = "normal";
		document.getElementById('top_videos_bar').style.fontWeight = "normal";
		document.getElementById('new_releases_bar').style.fontWeight = "normal";
//		document.getElementById('audience_bar').style.fontWeight = "normal";
		
		document.getElementById('thoughts_bar').style.fontWeight = "normal";
		document.getElementById('mee_people_bar').style.fontWeight = "normal";
		document.getElementById('member_search_bar').style.fontWeight = "normal";
//		document.getElementById('mee_tee_bar').style.fontWeight = "normal";
		document.getElementById('gallery_bar').style.fontWeight = "normal";
		document.getElementById('meeps_bar').style.fontWeight = "normal";
		
		document.getElementById('widgets_bar').style.fontWeight = "normal";
		document.getElementById('chart_bar').style.fontWeight = "normal";
		
		document.getElementById(div_bar).style.fontWeight = "bold";
	}
	
	function mp_linkOver(div)
	{
		document.getElementById(div).style.color = "#00517A";	
	}
	
	function mp_linkOut(div)
	{
		document.getElementById(div).style.color = "#059DFF";	
	}
	
	function mp_objectLinkOver(element)
	{
		element.style.color = "#00517A";	
	}
	
	function mp_objectLinkOut(element)
	{
		element.style.color = "#059DFF";	
	}

	function DivGetBold(div)
	{
		//document.getElementById(div).style.fontWeight = "bold";	
		document.getElementById(div).style.color = "#3E3E3E";	
	}
	
	function DivGetNormal(div, color)
	{
		//document.getElementById(div).style.fontWeight = "normal";	
		if (color)
			document.getElementById(div).style.color = color;
		else
			document.getElementById(div).style.color = "#7E7E7E";	
	}
	
	function mp_unDisplayChatBtn()
	{		
		if (document.getElementById('right_top_div_1').style.display == "block")
		{
			document.getElementById('chat_status').style.display = "none";	
		}
	}
	
	function mp_divChangeColor(div)
	{
		document.getElementById(div).style.color = "#3E3E3E";	
	}
	
	function mp_divReChangeColor(div)
	{
		document.getElementById(div).style.color = "#3195ED";	
	}
	

	function mp_overImage(out,over)
	{
		document.getElementById(out).style.display = "none";
		document.getElementById(over).style.display = "block";
	}
	
	function mp_outImage(out,over)
	{
		document.getElementById(over).style.display = "none";
		document.getElementById(out).style.display = "block";
	}
	
	function mp_switchChildImage(element) 
	{
		var first = true;
		for ( var i = 0; i < element.childNodes.length; i++ ){
			if ( element.childNodes[i].nodeName == "IMG" ) {
				if ( first ) {
				   	if (element.childNodes[i].style.display == "none") {
					   	element.childNodes[i].style.display = "inline";
				   	}
				   	else if (element.childNodes[i].style.display != "none") {
					   	element.childNodes[i].style.display = "none";
				   	}
				   	first = false;
				} else {
				   	if (element.childNodes[i].style.display == "none") {
					   	element.childNodes[i].style.display = "inline";
				   	}
				   	else if (element.childNodes[i].style.display != "none") {
					   	element.childNodes[i].style.display = "none";
				   	}
			    	break;
				}
			}
	    }
	}

	function mp_overObject(element) 
	{
        var x=element.childNodes;
		var element_count = 0;
		for (var i=0;i<x.length;i++)
       {
         	if (x[i].nodeType==1 && element_count==1)
        	{
        		element.childNodes[i].style.display = "inline";
   		  		break;
        	}
        	if (x[i].nodeType==1 && element_count==0)
        	{
        		element.childNodes[i].style.display = "none";
   		  		element_count++;
        	}
        }       
    }
    
   	function mp_outObject(element) 
   	{
        var x=element.childNodes;
		var element_count = 0;
		for (var i=0;i<x.length;i++)
       {
        	if (x[i].nodeType==1 && element_count==1)
        	{
        		element.childNodes[i].style.display = "none";
   		  		break;
        	}
       		if (x[i].nodeType==1 && element_count==0)
        	{
        		element.childNodes[i].style.display = "inline";
   		  		element_count++;
        	}
        }       
    }

	function mp_changeTextObject(element, color)
	{
		element.style.color = color;	
	}
	
	function mp_overImage_inline(out,over)
	{
		document.getElementById(out).style.display = "none";
		document.getElementById(over).style.display = "inline";
	}	
	
	function mp_outImage_inline(out,over)
	{
		document.getElementById(over).style.display = "none";
		document.getElementById(out).style.display = "inline";
	}
	
	function mp_divDisplaySwitch(div) {
		if (document.getElementById(div).style.display == 'none') {
			document.getElementById(div).style.display = 'block';
		}
		else {
			document.getElementById(div).style.display = 'none';
		}
	}
	
	function mp_divDisplaySwitchInline(div) {
		if (document.getElementById(div).style.display == 'none') {
			document.getElementById(div).style.display = 'inline';
		}
		else {
			document.getElementById(div).style.display = 'none';
		}
	}
	
	function mp_logoLink()
	{
		callApp();
		return false;
	}

	function overHelpIcon(div)
	{
		document.getElementById(div).src = "/pm/img/help_icon_over.gif"
	}
	
	function outHelpIcon(div)
	{
		document.getElementById(div).src = "/img/misc/help_icon.gif"
	}
	
	function displayHelp(div)
	{		
		if (div != 'listeners_help_info')
			document.getElementById('listeners_help_info').style.display = "none";
		if (div != 'invitation_help_info')
			document.getElementById('invitation_help_info').style.display = "none";
		if (div != 'pm_help_info')
			document.getElementById('pm_help_info').style.display = "none";
		if (div != 'favorites_help_info')
			document.getElementById('favorites_help_info').style.display = "none";
		if (div != 'thoughts_help_info')
			document.getElementById('thoughts_help_info').style.display = "none";
		
		
		if (document.getElementById(div) != null)
			if (document.getElementById(div).style.display == "none")
				document.getElementById(div).style.display = "block";
			else
				document.getElementById(div).style.display = "none";
	}
	
	function linkHelp(link, func, div)
	{
		loadMiddlePanel(link, func);
		displayHelp(div);
	}
	
	function mp_getMouseLeft()
	{
		return event.clientX;
	}
	
	function mp_getThoughtsByType(thoughtType)
	{		
		gThoughtType = thoughtType;
		loadMiddlePanel('/thoughts/thoughts.php?init=1&type='+gThoughtType,'thoughts_init()');
	}
	
	function mp_getMembersByCountry(countryCode)
	{
		gCountryCode = countryCode;
		loadMiddlePanel('/member_search/member_search.php?init=0','memberSearchInit()');
	}
	
	function mp_getMemberByName(memberUid)
	{
		gMemberUid = memberUid;
		loadMiddlePanel('/member_search/member_search.php?init=0','memberSearchInit()');
	}
	
	function mp_getMemberByBroadcast()
	{
		gMemberBroadcast = 1;
		loadMiddlePanel('/member_search/member_search.php?init=1&broadcast_search='+gMemberBroadcast,'memberSearchPageInit()');
	}
	
	function mp_getNewMembers()
	{
		gNewArrivalMember = 1;
		loadMiddlePanel('/member_search/member_search.php?init=1&tab_value=3','memberSearchPageInit(0)');
	}
	
	function mp_loadMeeAudience(station_id, online_status)
	{
		gStationId = station_id;
		gStationOnlineStatus = online_status;
		loadMiddlePanel('/listeners/listeners.php','listenersInit()');
	}
	
	function mp_getMeeAudience(station_id, online_status)
	{
		gStationId = station_id;
		gStationOnlineStatus = online_status;
		loadMiddlePanel('/listeners/listeners.php?station_id='+station_id+'&online_status='+online_status,'listenersAppInit()');
	
		//listenersInit();
	}
	
	function mp_loadAudience(station_id, online_status, station_owner)
	{	
		gStationId = station_id;
		gStationOnlineStatus = online_status;
		gStationUid = station_owner;
		loadMiddlePanel('/audience/audience.php','audienceInit()');
	}
	
	function mp_getAudience(station_id, online_status, station_owner)
	{	
		gStationId = station_id;
		gStationOnlineStatus = online_status;
		gStationUid = station_owner;
		audienceInit();
	}
	
	function mp_loadSimilarMembers(uid)
	{
		memberResetSearch(false);
		searchArtistId = 0;
		searchTracktId = 0;
		gMemberSimilars = uid;
		loadMiddlePanel('/member_search/member_search.php?init=0','memberSearchInit()');
	}
	
	function mp_loadViewerMembers(uid)
	{
		memberResetSearch(false);
		searchArtistId = 0;
		searchTracktId = 0;
		gMemberToView = uid;
		loadMiddlePanel('/member_search/member_search.php?init=0','memberSearchInit()');
	}
		
	function mp_getViewerMembers(uid)
	{		
		members_resetValues();
		gCountryCode = null;
		searchArtistId = 0;
		searchTracktId = 0;
		gMemberToView = uid;
		//memberSearchInit();
	}

	function mp_loadMemberViews(uid)
	{
		memberResetSearch(false);
		searchArtistId = 0;
		searchTracktId = 0;
		gMemberViews = uid;
		loadMiddlePanel('/member_search/member_search.php?init=0','memberSearchInit()');
	}
		
	function mp_getMemberViews(uid)
	{
		members_resetValues();
		gCountryCode = null;
		searchArtistId = 0;
		searchTracktId = 0;
		gMemberViews = uid;
		//memberSearchInit();
	}
	
	function mp_loadStationPage(station_id, uid, type, sort, offset, discussion)
	{
		if (uid != null)	{
			loadMiddlePanel('/station_page/station_page.php?station_id='+station_id+'&uid='+uid+'&type='+type+'&sort='+sort+'&offset='+offset+'','station_page_init('+station_id+')');
			loadLeftPanel('/station_page/station_page_left.php?station_id='+station_id+'');
		}
		else {
			if (discussion == true) {
				loadMiddlePanel('/station_page/station_page.php?station_id='+station_id+'','station_page_init('+station_id+','+discussion+')');
				loadLeftPanel('/station_page/station_page_left.php?station_id='+station_id+'');
			}
			else {
			loadMiddlePanel('/station_page/station_page.php?station_id='+station_id+'','station_page_init('+station_id+')');
			loadLeftPanel('/station_page/station_page_left.php?station_id='+station_id+'');
			}
		}
		mp_unDisplayChatBtn();
	}
	
	function mp_loadTravellerStationPage(station_id)
	{
		loadMiddlePanel('/station_page/station_page.php?station_id='+station_id+'','station_page_traveller_init()');
		mp_unDisplayChatBtn();
	}
	
	function mp_getStationPage(station_id)
	{
		//loadMiddlePanel('/station_page/station_page.php?station_id='+station_id+'','');
		//station_page_init(station_id);
		mp_unDisplayChatBtn();
	}
	
	function mp_stationPageChatDisconnect()
	{
		try {
			var chat_box = getFlashMovieObject("station_page_chat_box");
			chat_box.chatDisconnect();
		} catch (e) {};
	}
	
	function mp_loadSingleMeep(meep_id, add)
	{
		if (add!=null)
			loadMiddlePanel('/meeps/meeps.php?meep_id='+meep_id+'&add='+add,'meeps_init()');
		else
			loadMiddlePanel('/meeps/meeps.php?meep_id='+meep_id,'meeps_init()');
			
		return false;
	}	
	
	function mp_publishThoughtFacebook(thought_id) 
	{
		u = 'http://www.meemix.com/thoughts/get_thought/index.php?thoughtId='+ thought_id +'&display=1&campaign_id=17';					
		
		var next_url = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u);	
		
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=1&shared_object=2&shared_src=3","sharer","toolbar=0,status=0,width=626,height=436"); 

	}
	
	function mp_publishThoughtGoogleBookmark(thought_id, title) 
	{
		u = 'http://www.meemix.com/thoughts/get_thought/index.php?thoughtId='+ thought_id +'&display=1&campaign_id=74';					
	
		var next_url = 'http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(title) + '&bkmk='+encodeURIComponent(u);	
	
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=0&shared_object=2&shared_src=3","sharer","toolbar=0,status=0,width=726,height=636,resizable=yes"); 
	}
	
	function mp_publishThoughtStumbleUpon(thought_id) 
	{
		u = 'http://www.meemix.com/thoughts/get_thought/index.php?thoughtId='+ thought_id +'&display=1&campaign_id=84';					
		
		var next_url = 'http://www.stumbleupon.com/submit?url='+encodeURIComponent(u);	
		
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=2&shared_object=2&shared_src=3","sharer","toolbar=0,status=0,width=726,height=436"); 
	}
	
	function mp_publishFacebook(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');

		var next_url = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t);	
	
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=1&shared_object=5&shared_src=3","sharer","toolbar=0,status=0,width=626,height=436"); 
   
        return false;
	}
	
	function mp_publishStumbleUpon(u) 
	{
		var next_url = 'http://www.stumbleupon.com/submit?url='+encodeURIComponent(u);	
	
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=2&shared_object=5&shared_src=3","sharer","toolbar=0,status=0,width=626,height=436"); 
   
        return false;
	}
	
	function mp_publishGoogleBookmark(u, title) 
	{
	//http://www.google.com/bookmarks/mark?op=edit&title=". $res1[$i]['thought_heading'] ."&bkmk=http://www.meemix.com/thoughts/get_thought/index.php?thoughtId=". $thought_id. "\"
		//var next_url = 'http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(title) + '&bkmk='+encodeURIComponent(u);	

		var next_url = 'http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(title) + '&bkmk='+encodeURIComponent(u);	
		
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=0&shared_object=5&shared_src=3","sharer","toolbar=0,status=0,width=726,height=636,resizable=yes"); 

        return false;
	}
	
	var mp = null;
	
	function mp_playSong(source_id, div, source_type)
	{
		try {		
			mp.setContainer(div);  
			if ( source_type == 'album' )    
				mp.setAlbumPlayer(source_id);
			else if ( source_type == 'track' )    
				mp.setTrackPlayer(source_id);
		} catch(e) {};
		
	}
	
	function mp_publishVideoFacebook(yt_id, uid) 
	{
		u = 'http://www.meemix.com/shared/video.php?yt_id=' + yt_id + '&uid=' + uid + '&campaign_id=18';					
		
		var next_url = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u);	
		
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=1&shared_object=2&shared_src=3","sharer","toolbar=0,status=0,width=626,height=436"); 
	}
	
	function mp_publishVideoGoogleBookmark(yt_id, uid, title) 
	{
		u = 'http://www.meemix.com/shared/video.php?yt_id=' + yt_id + "&uid=" + uid + '&campaign_id=73';
	
		var next_url = 'http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(title) + '&bkmk='+encodeURIComponent(u);	
	
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=0&shared_object=2&shared_src=3","sharer","toolbar=0,status=0,width=726,height=636,resizable=yes"); 
	}
	
	function mp_publishVideoStumbleUpon(yt_id, uid) 
	{
		u = 'http://www.meemix.com/shared/video.php?yt_id=' + yt_id + "&uid=" + uid + '&campaign_id=83';
		
		var next_url = 'http://www.stumbleupon.com/submit?url='+encodeURIComponent(u);	
		
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=2&shared_object=2&shared_src=3","sharer","toolbar=0,status=0,width=726,height=436"); 
	}
	
	function mp_publishTrackFacebook(track_id) 
	{
		u = 'http://www.meemix.com/shared/content.php?track_id='+track_id + '&campaign_id=13';
		
		var next_url = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u);	
	
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=1&shared_object=0&shared_src=3","sharer","toolbar=0,status=0,width=626,height=436"); 
    }
    
    function mp_publishTrackGoogleBookmark(track_id, title) 
    {
		u = 'http://www.meemix.com/shared/content.php?track_id=' + track_id + '&campaign_id=71';		
		
		var next_url = 'http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(title) + '&bkmk='+encodeURIComponent(u);	
		
	   	window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=0&shared_object=0&shared_src=3","sharer","toolbar=0,status=0,width=726,height=636,resizable=yes"); 
	}
	
	 function mp_publishTrackStumbleUpon(track_id) 
	 {
		u = 'http://www.meemix.com/shared/content.php?track_id='+track_id + '&campaign_id=81';		
		
		var next_url = 'http://www.stumbleupon.com/submit?url='+encodeURIComponent(u);	
		
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=2&shared_object=0&shared_src=0","sharer","toolbar=0,status=0,width=726,height=436"); 
	    	
		return false;
	}
	
	function mp_publishArtistFacebook(artist_id) 
	{
		u = 'http://meedev-ohad/shared/artist_page.php?artist_id='+artist_id + '&campaign_id=13';
		
		var next_url = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u);	
	
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=1&shared_object=6&shared_src=3","sharer","toolbar=0,status=0,width=626,height=436"); 
	}
    
    function mp_publishArtistGoogleBookmark(artist_id, title) 
	{
		u = 'http://meedev-ohad/shared/artist_page.php?artist_id=' + artist_id + '&campaign_id=71';		
		
		var next_url = 'http://www.google.com/bookmarks/mark?op=edit&title=' + encodeURIComponent(title) + '&bkmk='+encodeURIComponent(u);	
		
	   	window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=0&shared_object=6&shared_src=3","sharer","toolbar=0,status=0,width=726,height=636,resizable=yes"); 
	}
	
	function mp_publishArtistStumbleUpon(artist_id) 
	{
		u = 'http://meedev-ohad/shared/artist_page.php?artist_id='+artist_id + '&campaign_id=81';		
		
		var next_url = 'http://www.stumbleupon.com/submit?url='+encodeURIComponent(u);	
		
		window.open("/shared/shared_gateway.php?next_url="+ encodeURIComponent(next_url) +"&shared_type=2&shared_object=6&shared_src=0","sharer","toolbar=0,status=0,width=726,height=436"); 
	    	
		return false;
	}

	function mp_initPlayer()
	{
		mp = new MMPlayer();
	}
	
	//  			
	//
	//					pm js
	//			
	//
	//
	
	
	
	function PmRecievedDbCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('pm_div').innerHTML = text;
	}

	var gPmId = 0;
	function getRecievedPmDb(status,offset)
	{	
		gPmId++;
		status = status.toLowerCase();
		this.RecievedPmDbcallback = PmRecievedDbCallback;	
		var req = new JSAjaxDoc(this, "RecievedPmDbcallback");
		req.addParam("search_status", status);
		req.addParam("offset", offset);
		var url = "/pm/pm_db_recieved.php?id="+gPmId;
		req.send(url, "GET");
		return false;
	}
	
	function PmSentDbCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('pm_div').innerHTML = text;
	}
	
	function getSentPmDb(status,offset)
	{
		gPmId++;
		status = status.toLowerCase();
		this.SentPmDbcallback = PmSentDbCallback;	
		var req = new JSAjaxDoc(this, "SentPmDbcallback");
		req.addParam("search_status", status);
		req.addParam("offset", offset);
		var url = "/pm/pm_db_sent.php?id="+gPmId;
		req.send(url, "GET");
		
		return false;
	}
	
	function updateReadMsgCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		checkUnReadMessage();
	}
	
	function updateReadMsg(messageId)
	{
		this.ReadMsgcallback = updateReadMsgCallback;	
		var req = new JSAjaxDoc(this, "ReadMsgcallback");
		req.addParam("msg_id", messageId);
		
		var url = "/pm/update_read_msg.php";
		req.send(url, "POST");		
	}
	
	function deleteMessageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		if (text == 9)
			return;
		if (document.getElementById('div_1').style.display == "block")
		{
			if (document.getElementById('search').value == "")
				setTimeout("getRecievedPmDb('0',"+ usr_word +");", 100);
			else
				setTimeout("getRecievedPmDb(document.getElementById('search').value,"+ usr_word +");", 100);
		}
		else
		{
			if (document.getElementById('search').value == "")
				setTimeout("getSentPmDb('0',"+ usr_word +");", 100);
			else
				setTimeout("getSentPmDb(document.getElementById('search').value,"+ usr_word +");", 100);
		}
		
		if ( text == 0 )
		{			
			if (document.getElementById('right_top_div_1').style.display == "block" )
			{
				document.getElementById('mail_button').style.display = "none";
				document.getElementById('html_pm').style.display = "inline";
				callApp('unDisplayPmFlashAlert()', 0, 0);
			}
		}
	}
	
	function deleteMessage(resultCount, offset)
	{
		this. deleteMescallback = deleteMessageCallback;	
		var req = new JSAjaxDoc(this, "deleteMescallback", offset);
		for (i=1; i<=resultCount; i++)
		{
			if (document.getElementById('pm_check_'+i).checked == true)
				req.addParam("msg_id_"+i, document.getElementById('pm_check_'+i).value);
			else
				req.addParam("msg_id_"+i, 0);	
		}
		req.addParam("result_count", resultCount);		
		var url = "/pm/delete_msg.php";
		req.send(url, "POST");
	}
	
	function pm_deleteSingleMessageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		if (document.getElementById('div_1').style.display == "block")
		{
			if (document.getElementById('search').value == "")
				setTimeout("getRecievedPmDb('0',"+ usr_word +");", 100);
			else
				setTimeout("getRecievedPmDb(document.getElementById('search').value,"+ usr_word +");", 100);
		}
		else
		{
			if (document.getElementById('search').value == "")
				setTimeout("getSentPmDb('0',"+ usr_word +");", 100);
			else
				setTimeout("getSentPmDb(document.getElementById('search').value,"+ usr_word +");", 100);
		}
		
	}
	
	function pm_deleteSingleMessage(msg_id, offset)
	{
		this.pm_deleteS = pm_deleteSingleMessageCallback;	
		var req = new JSAjaxDoc(this, "pm_deleteS", offset);
		req.addParam("msg_id", msg_id);
		var url = "/pm/pm_delete_single_message.php";
		req.send(url, "POST");
	}
	
	function deleteSentMessageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		getSentPmDb(document.getElementById('search').value, usr_word);	
	}
	
	function deleteSentMessage(resultCount, offset)
	{
		this. deleteS = deleteSentMessageCallback;	
		var req = new JSAjaxDoc(this, "deleteS", offset);
		for (i=1; i<=resultCount; i++)
		{
			if (document.getElementById('pm_sent_check_'+i).checked == true)
				req.addParam("msg_id_"+i, document.getElementById('pm_sent_check_'+i).value);
			else
				req.addParam("msg_id_"+i, 0);	
		}
		req.addParam("result_count", resultCount);
		//req.addParam("msg_id", messageId);
		var url = "/pm/delete_msg.php";
		req.send(url, "POST");
	}
	
	function blockUserCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		loadMiddlePanel('/pm/pm.php','pmInit()');
	}
	
	function blockUser(userId, blockDiv, unblockDiv)
	{
		this.blockUscallback = blockUserCallback;	
		var req = new JSAjaxDoc(this, "blockUscallback");
		req.addParam("user_id", userId);
		
		var url = "/pm/block_user.php";
		req.send(url, "POST");
	}
	
	function unblockUserCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		loadMiddlePanel('/pm/pm.php','pmInit()');
	}
	
	function unblockUser(userId, blockDiv, unblockDiv)
	{
		this.unblockU = unblockUserCallback;	
		var req = new JSAjaxDoc(this, "unblockU");
		req.addParam("user_id", userId);
		
		var url = "/pm/unblock_user.php";
		req.send(url, "POST");
	}
	
	function checkUnReadMessageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		if (text == 0)
		{
			if (document.getElementById('right_top_div_1').style.display == "block" )
			{
				document.getElementById('mail_button').style.display = "none";
				document.getElementById('html_pm').style.display = "inline";
			}
			document.getElementById('you_blank_off').style.display = "block";
			document.getElementById('you_blank_on').style.display = "none";
			callApp('unDisplayPmYouAlert()', 0, 0);
			callApp('unDisplayPmFlashAlert()', 0, 0);
		}
		if (document.getElementById('right_top_div_1').style.display == "block" )
		{
			you_notificationUpdate();
			callApp('you_notificationUpdate()', 0, 0);
		}
	}
	
	function checkUnReadMessage(userId)
	{
		this.checkUnReadMescallback = checkUnReadMessageCallback;	
		var req = new JSAjaxDoc(this, "checkUnReadMescallback");
		req.addParam("user_id", userId);
		
		var url = "/pm/check_unread_msg.php";
		req.send(url, "POST");
	}
	
	function switch_div(div_name,link_name) // Create Divs
	{
		for ( i = 1; i <= 2; i++ )
		{			
			document.getElementById('div_' + i).style.display = "none";
			document.getElementById('link_' + i).style.fontWeight = "normal";
		}		
		document.getElementById(div_name).style.display = "block";
		document.getElementById(link_name).style.fontWeight = "bold";
	}
	
	function openRcvLocalDiv(div_name,div_father,bgColor,count,read_div,messageId,msgType, read_pm)
	{
		if (document.getElementById(div_name).style.display != "block")
			document.getElementById(div_father).style.fontWeight = "normal";
		
		if (document.getElementById(div_name).style.display != "block")
		{
			if (document.getElementById(read_pm).value == 0)
			{
				document.getElementById(read_div).src = "/pm/img/opened_envelope_icon.gif";
				document.getElementById(read_div).alt = "Msg read";
				document.getElementById(read_pm).value = 1;
				updateReadMsg(messageId);
			}
			else
			{
				document.getElementById(read_div).alt = "Msg Unread";
			}
		}
		if (document.getElementById(div_name).style.display == "")
			document.getElementById(div_name).style.display = "none";
		if (document.getElementById(div_name).style.display == "none")
		{
			for (i=1; i<=count ; i++)
			{
				if (document.getElementById('div_msg_' + i + '_1').style.display == "block")
				{
					document.getElementById('div_msg_' + i + '_1').style.display = "none";
					/*if (document.all["div_msg_" + i + "_1"].style.backgroundColor == "#fdefd2")
						document.all["div_msg_" + i].style.backgroundColor = "#FDEFD2";
					else if (document.all["div_msg_" + i + "_1"].style.backgroundColor == "#e3ffcf")
						document.all["div_msg_" + i].style.backgroundColor = "#E3FFCF";
					else
						document.all["div_msg_" + i].style.backgroundColor = getBgColor(i);*/
				}
			}
			document.getElementById(div_name).style.display = "block";
			if (msgType == 3)
				document.getElementById(div_father).style.backgroundColor = "#FDEFD2";
			if (msgType == 2)
				document.getElementById(div_father).style.backgroundColor = "#E3FFCF";
			if (msgType == 1)
				document.getElementById(div_father).style.backgroundColor = "#F1FBFF";
		}
		else
		{
			document.getElementById(div_name).style.display = "none";
			if (msgType == 3)
				document.getElementById(div_father).style.backgroundColor = "#FDEFD2";
			if (msgType == 2)
				document.getElementById(div_father).style.backgroundColor = "#E3FFCF";
			if (msgType == 1)
				document.getElementById(div_father).style.backgroundColor = bgColor;
		}
	}
	
	function openSntLocalDiv(div_name,div_father,bgColor,count,msgType)
	{
		if (document.getElementById(div_name).style.display == "")
			document.getElementById(div_name).style.display = "none";
		if (document.getElementById(div_name).style.display == "none")
		{
			for (i=1; i<=count; i++)
			{
				if (document.getElementById('div_sent_' + i + '_1').style.display == "block")
				{
					document.getElementById('div_sent_' + i + '_1').style.display = "none";					
				}
			}
			document.getElementById(div_name).style.display = "block";
			if (msgType == 3)
				document.getElementById(div_father).style.backgroundColor = "#FDEFD2";
			if (msgType == 2)
				document.getElementById(div_father).style.backgroundColor = "#E3FFCF";
			if (msgType == 1)	
				document.getElementById(div_father).style.backgroundColor = "#F1FBFF";	
		}
		else
		{
			document.getElementById(div_name).style.display = "none";
			if (msgType == 3)
				document.getElementById(div_father).style.backgroundColor = "#FDEFD2";
			if (msgType == 2)
				document.getElementById(div_father).style.backgroundColor = "#E3FFCF";
			if (msgType == 1)
				document.getElementById(div_father).style.backgroundColor = bgColor;
		}
	}
	
	function markAsUnreadCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		if (document.getElementById('right_top_div_1').style.display == "block" && document.getElementById('html_pm').style.display == "block")
		{
			document.getElementById('html_pm').style.display = "none";
			document.getElementById('mail_button').style.display = "inline";
			callApp('unDisplayPmHtmlAlert()', 0, 0);
		}

	}
	
	function markAsUnread(div, msgId, read_div, read_pm)
	{
		document.getElementById(read_pm).value = 0;
		document.getElementById(div).style.fontWeight ="bold";
		document.getElementById(read_div).src = "/pm/img/03_unread.gif"
		this.markAscallback = markAsUnreadCallback;	
		var req = new JSAjaxDoc(this, "markAscallback");
		req.addParam("msg_id", msgId);
		
		var url = "/pm/mark_as_unread.php";
		req.send(url, "POST");
	}
	
	function acceptFriendCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById(gAlertDiv).style.display = "block";
		document.getElementById(gAlertDiv).innerHTML = text;
		if ( document.getElementById('you_tab_2') != null )
			loadMeeFriends(0);
		callApp("app_loadMeeFriends()");	
			
	}
	
	function acceptFriend(fromUid, div, checkBoxId, deny_div, uid, alert_div, j)
	{
		gAlertDiv = alert_div; 
		msg = "Hey "+fromUid+", " + uid + " has accepted the invitation to join your Friends list. Double your fun in MeeMix with your MeeFriends!";
		document.getElementById(div).style.display = "none";
		$('add_friends_div_'+j).style.display = 'none';
		document.getElementById(deny_div).style.display = "none";
		pmSendPm(fromUid, msg, div, 2, 2,'', 2);
		this.acceptFcallback = acceptFriendCallback;	
		var req = new JSAjaxDoc(this, "acceptFcallback");
		req.addParam("from_uid", fromUid);
		req.addParam("add_friend", document.getElementById(checkBoxId).value);
		var url = "/pm/accept_friend.php";
		req.send(url, "POST");
	}
	
	function denyFriendCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById(gAlertDiv).style.display = "block";
		document.getElementById(gAlertDiv).innerHTML = text;
	}
	
	function denyFriend(fromUid, div, uid, accept_div, alert_div, j)
	{
		gAlertDiv = alert_div; 
		var msg = "Hey "+ fromUid +". "+ uid +" did not accept your offer to join your Friends list. Well, they have no idea what they are missing out on - too bad for them!";
		document.getElementById(div).style.display = "none";
		document.getElementById(accept_div).style.display = "none";
		$('add_friends_div_'+j).style.display = 'none';
		this.denyFcallback = denyFriendCallback;	
		var req = new JSAjaxDoc(this, "denyFcallback");
		req.addParam("from_uid", fromUid);
		var url = "/pm/deny_friend.php";
		req.send(url, "POST");
	}
	
	function setAddFriendValue(checkBoxId)
	{
		if (document.getElementById(checkBoxId).checked)
			document.getElementById(checkBoxId).value = "1";
		else
			document.getElementById(checkBoxId).value = "0";
	}
	
	function getBgColor(i)
	{
		return '#F1FBFF';
	}
	
	function nondisplayFloating(div_name)
	{
		document.getElementById(div_name).style.display = "none";
	}
	
	function displayFloating(div_name)
	{
		document.getElementById(div_name).style.left = event.clientX - 220;
		document.getElementById(div_name).style.top = event.clientY - 150;
		document.getElementById(div_name).style.display = "block";
	}
	
	function checkKey(e,status)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			if ( document.getElementById("link_1").style.fontWeight == "bold" ) {
				getRecievedPmDb(status,0);
			} else {
				getSentPmDb(status,0);
			}
		}
	}
	
	function getPms (status)
	{
		if ( document.getElementById("link_1").style.fontWeight == "bold" )
		{
			getRecievedPmDb(status,0);
		}
		else
		{
			getSentPmDb(status,0);
		}
	}
	
	function pmSendPmCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY  )
		{			
			return;
		}
				
		document.getElementById(gAlertDiv).innerHTML = text;		
	}

	function pmSendPm(toUid, msg, div, msg_type, msg_turn, old_msg, msg_subtype)
	{	
		this.sendPmscallback = pmSendPmCallback;	
		var req = new JSAjaxDoc(this, "sendPmscallback");
		req.addParam('to_uid', toUid);
		req.addParam('pm', msg);
		req.addParam('msg_type', msg_type);
		req.addParam('msg_subtype', msg_subtype);
		req.addParam('msg_turn', msg_turn);
		req.addParam('pm_source', "WEB");
		req.addParam('old_msg', old_msg);
		var url = "/pm/send_pm.php";
		req.send(url, "POST");
	}
	
	function pm_replyCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY  )
		{			
			return;
		}
	}
	
	var gAlertDiv = null;
	
	function pm_reply(toUid, msg, div, msg_type, msg_turn, old_msg, msg_id, alert_div, textarea)
	{
		document.getElementById(div).src = "/pm/img/replied_icon_purple.gif";
		pmSendPm(toUid, msg, div, msg_type, msg_turn, old_msg, 1);
		document.getElementById(textarea).value = "";
		gAlertDiv = alert_div;
		
		this.pm_r = pm_replyCallback;	
		var req = new JSAjaxDoc(this, "pm_r");
		req.addParam('msg_id', msg_id);
		//req.addParam('msg_status', msg_status);
		var url = "/pm/pm_reply.php";
		req.send(url, "POST");
	}
	
	function pm_closeMessagePopup()
	{
		document.getElementById('popup_msg_div_pm').style.display = "none";
	}
	
	function pm_addArtistSuggestions(station_id, artist_id, suggest_id) 
	{
		new Ajax.Request('/app/edit/add_artist_suggestion.php', {
		    method:'get',
		    parameters: {station_id: station_id, artist_id: artist_id, suggest_id: suggest_id},
		    onSuccess: function(transport, json){	
		    	document.getElementById('add_artist_msg_'+ suggest_id).innerHTML = "Artist Added";
		    	document.getElementById('add_artist_msg_'+ suggest_id).style.display = "block";
		    },
		    onFailure: function(){}
	  	});	 
	}
	
	function pm_closePopup()
	{
		document.getElementById('popup_msg_div_pm').style.display = "none";
		for (i=1; i<=10; i++)
		{
			if (document.getElementById('textarea_'+i) != null)
			{
				document.getElementById('textarea_'+i).value = "";	
			}
			if (document.getElementById('div_msg_'+i+'_1') != null)
			{
				document.getElementById('div_msg_'+i+'_1').style.display = "none";
			}
		}
	}
	
	function reset_sent()
	{
		for (j=1; j<= 2; j++)
		{
			document.getElementById('div_sent_'+j+'_1').style.display = "none";
		}
	}
	
	function pm_selectAll(checkboxId, rows)
	{
		for (i=1; i<=rows; i++)
		{
			document.getElementById(checkboxId+i).checked = true;
		}
	}
	
	function pm_getReplyBox(reply_btn, reply_box)
	{
		document.getElementById(reply_box).style.display = "block";
		document.getElementById(reply_btn).style.display = "none";
	}
	
	function pmInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		document.title = "Send and receive messages with all the Mee Community";
		setBarBold('pm_bar');
		rp_resetRightBottom();
		mp_initPlayer();
		//getRecievedPmDb("0",0);
		//getSentPmDb('0',0);
		//if ( document.getElementById('top_div') == null && document.getElementById('right_top_div_5').style.display == 'none' && document.getElementById('right_top_div_4').style.display == 'none' )
		//	right_panel_init();
	}
	
	
	
	//
	//
	//
	//			invitation js
	//	
	//
	//
	
	function getInvitationCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{			
			return;
		}
		if ( document.getElementById('invitation_div') != null )
			document.getElementById('invitation_div').innerHTML = text;
		
	}

	function getInvitation(search, offset)
	{	
		this.Invitationcallback = getInvitationCallback;	
		var req = new JSAjaxDoc(this, "Invitationcallback");
		req.addParam("offset", offset);
		req.addParam("search", search);
		var url = "/invitation/get_invitation.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function inviteYourFriendsCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{			
			return;
		}
				
		document.getElementById('middle_content').innerHTML = text;
	}
	
	function inviteYourFriends()
	{	
		this.inviteYourF = inviteYourFriendsCallback;	
		var req = new JSAjaxDoc(this, "inviteYourF");
		var url = "/invitation/invite_your_friend.php";
		req.send(url, "POST");
	}
	
	function invResendToAllCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{			
			return;
		}
		
		document.getElementById('inviteMessage').style.display = "none";
		setTimeout("loadMiddlePanel('/invitation/invitation.php','invitationInit()')",100);
	}
	
	function invResendToAll()
	{	
		this.invR = invResendToAllCallback;	
		var req = new JSAjaxDoc(this, "invR");
		req.addParam("comment", document.getElementById('comment').value);
		var url = "/invitation/invite_resend_to_all.php";
		req.send(url, "POST");
	}
	
	
	function reSendSingleInvitationCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('invitation_msg_body').innerHTML = "Your friend invitation has been resent"; 	
		document.getElementById('invitation_msg').style.display = "block";
		//setTimeout("loadMiddlePanel('/invitation/invitation.php','invitationInit()')",100);
		
	}
	
	function reSendSingleInvitation(name, email, resend)
	{	
		this.reSendS = reSendSingleInvitationCallback;	
		var req = new JSAjaxDoc(this, "reSendS");
		req.addParam("name_1", name);
		req.addParam("email_1", email);
		req.addParam("resend", resend);
		var url = "/app/invitation/send_invitation.php";
		req.send(url, "POST");
	}
	
	function invSingleGetComment(div)
	{
		document.getElementById(div).style.display = "block";
	}
	
	function invResendOver()
	{
		document.getElementById('resend2all_div').style.display = "none";
		document.getElementById('resend2all_div_over').style.display = "block";
	}
	
	function invResendOut()
	{
		document.getElementById('resend2all_div_over').style.display = "none";
		document.getElementById('resend2all_div').style.display = "block";
	}
	
	
	function reSendInvitationsCallback(text, xml, status, usr_word)
	{
		document.getElementById('invitation_msg_body').innerHTML = "Your friend invitations have been resent"; 	
		document.getElementById('invitation_msg').style.display = "block";
		return;
	}
	
	function reSendInvitations()
	{
		this.reSendI = reSendInvitationsCallback;	
		var req = new JSAjaxDoc(this, "reSendI");
		var url = "/invitation/invitation_resend_to_all.php";
		req.send(url, "POST");
	}
	
	function isEmailAddress(val)
	{
		if (val.match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/))
		{
			return true;
		}
		else
		{
			return false;
		} 
	}
	
	function inviteYourOutlookFriendsCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{			
			return;
		}
				
		document.getElementById('invite_friends').innerHTML = text;
	}

	function inviteYourOutlookFriends()
	{	
		this.inviteYourOutlook = inviteYourOutlookFriendsCallback;	
		var req = new JSAjaxDoc(this, "inviteYourOutlook");
		var url = "/invitation/invite_your_outlook_friend.php";
		req.send(url, "POST");
	}
	
	function getRcvSntCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('rcvSnt_div').innerHTML = text;
	}

	function getRcvSnt()
	{	
		this.RcvSntcallback = getRcvSntCallback;	
		var req = new JSAjaxDoc(this, "RcvSntcallback");
		var url = "/invitation/get_rcv_snt.php";
		req.send(url, "POST");
	}
	
	function mp_getMyFriends()
	{
		if ( document.getElementById('right_top_div_1').style.display == 'block' ) {
			you_tab_change(2);
		}
		else {
			loadRightPanel('you/load_you_top.php?tab_type=2','right_top_div_1');
		}	 
	}
	
	function loadRightPanelFriends(uid)
	{
		loadRightPanel("profilez/main.php?profile_uid="+uid ,"right_top_div_2", 2, "profilez/friends.php?profilezUid="+uid);
	}
	
	function loadRightPanelPm(uid)
	{
		loadRightPanel("profilez/main.php?profile_uid="+uid ,"right_top_div_2", 1, "profilez/personal_msg.php?profilezUid="+uid);
	}

	function loadRightPanelChat(uid)
	{
		loadRightPanel("profilez/main.php?profile_uid="+uid ,"right_top_div_2", 1, "profilez/chat.php?profilezUid="+uid);
	}
	
	function loadRightPanelBroadcast(uid)
	{
		loadRightPanel("profilez/main.php?profile_uid="+uid ,"right_top_div_2", 1, "profilez/broadcast_stations.php?profilezUid="+uid);
	}
	
	function loadRightPanelBroadcastPm(uid, stationId, stationName)
	{
		loadRightPanel("profilez/main.php?profile_uid="+uid ,"right_top_div_2");
		rp_openBroadcast(uid, stationId, stationName);
	}
	
	function loadRightPanelAddFriend(uid)
	{
		loadRightPanel("profilez/main.php?profile_uid="+uid ,"right_top_div_2", 1, "profilez/add_friend.php?profilezUid="+uid);
	}
	
	function reSendInvitation()
	{		
		document.re_invite_friends_form.submit();
		document.getElementById('inviteMessage').style.display = "none";
		loadMiddlePanel('/invitation/invitation.php','invitationInit()');
	}
	
	function sendInvitation()
	{
			document.invite_friends_form.submit();
			document.getElementById('inviteMessage').style.display = "none";
			document.getElementById('popup_msg_invitation').style.display = "block";
	}
	
	function invitation_switchPages(div)
	{
		document.getElementById('invite_friend_html').style.display = "none";
		document.getElementById('invite_friend_flash').style.display = "none";
		document.getElementById(div).style.display = "block";
	}
	
	function invitationInit(offset)
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		setBarBold('invitation_bar');
		rp_resetRightBottom();
		document.title = "Invite your friends to MeeMix and see their status";
		if ( typeof offset != "undefined" )	{
			getInvitation(0, offset);
		}
		else {
			getInvitation(0,0);
		}
	}
	
	//
	//
	//		MeeBlog
	//
	//
	//
	
	function ShowPostsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}				
		document.getElementById('right_div').innerHTML = text;
	}
	
	function ShowPosts(search,value,category,blogDate1,blogDate2,offset)
	{	
		document.getElementById('popup_msg_blog').style.display = "none";
		this.ShowPostcallback = ShowPostsCallback;	
		var req = new JSAjaxDoc(this, "ShowPostcallback");
		//req.addParam("offset", offset);
		req.addParam("offset", document.getElementById('offset').value);
		req.addParam("search_id", search);
		req.addParam("search_value", value);
		if (document.getElementById('comments') != null)
			req.addParam("comment_value", document.getElementById('comments').value);
		else
			req.addParam("comment_value", 1);
		req.addParam("category_value", category);
		req.addParam("blog_date1", blogDate1);
		req.addParam("blog_date2", blogDate2);
		req.addParam("post_id", document.getElementById('post_id').value);
		var url = "/blog/show_posts.php";
		req.send(url, "GET");
	}
	
	function alertDay(num,name)
	{
		var day1 = document.calen[num].value;
		var day2 = day1 - 1 + 2 ;
		month = monthe+1;
		var blogDate1 = yeare+"-"+month+"-"+day1;
		var blogDate2 = yeare+"-"+month+"-"+day2;
		ShowPosts(1,'0',9,blogDate1, blogDate2);
	}
	
	function RatePostCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('rate').innerHTML = text
	}

	function RatePost(divNum,PostId,div_name,div_after)
	{	
		var rate = 0;
		for (i=1; i<=5; i++)
		{
			if (document.getElementById('flame_'+ divNum + i).src == "/blog/img/03_flame_on.gif")
				rate = rate + 1
		}
		document.getElementById(div_name).style.display="none";
		document.getElementById(div_after).style.display="block";
		this.RatePostscallback = RatePostCallback;	
		var req = new JSAjaxDoc(this, "RatePostscallback");
		req.addParam("blog_rate", rate);
		req.addParam("post_id", PostId);
		var url = "/blog/turn_flame.php";
		req.send(url, "POST");
	}
	
	function TurnFlameOn(div_name,rate)
	{
		for (i=1; i<=5; i++)
		{
			document.getElementById(div_name+i).src = "/blog/img/03_flame_off.gif";
		}
		for (i=1; i<=rate; i++)
		{
			document.getElementById(div_name+i).src = "/blog/img/03_flame_on.gif";
		}
	}
	
	function changeRateOver(div_name)
	{
		document.getElementById(div_name).src = "/blog/img/03_ok_btn_over.gif";
	}
	
	
	function changeRateDown(div_name)
	{
		document.getElementById(div_name).src = "/blog/img/03_ok_btn_down.gif";
	}
	
	function SetWritersCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		eval(text);
	}
	
	function SetWriters()
	{
		this.Writerscallback = SetWritersCallback;	
		var req = new JSAjaxDoc(this, "Writerscallback");
		var url = "/blog/set_writers.php";
		req.send(url, "POST");
	}
	
	
	function blog_getCommentsCountCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('view_comment_display_' + usr_word).style.display = 'inline';
		document.getElementById('view_comment_display_' + usr_word).innerHTML = "<span id=\"comment_view_"+ usr_word +"\">Hide</span> comments("+ text +")";
		document.getElementById('comment_div_display_'+ usr_word).style.display = 'block';
	}
	
	function blog_getCommentsCount(postId, i)
	{
		this.blog_getC = blog_getCommentsCountCallback;	
		var req = new JSAjaxDoc(this, "blog_getC", i);
		req.addParam("post_id", postId);
		var url = "/blog/get_comments_count.php";
		req.send(url, "POST");
	}
	
	function InsertCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('comment_div_display_'+ usr_word).innerHTML = text;
		document.getElementById('comment_'+ usr_word).value = "";
	
		blog_getCommentsCount(gPostId, usr_word);
	}
	
	function InsertComment(PostId, CommentBody, comment_div, comment_status, err_div, i, post_heading)
	{
		gPostId = PostId;
		if ( document.getElementById(comment_status).value == 0)
		{
			document.getElementById(err_div).innerHTML = "Pleas fill in a comment";
			//document.getElementById('popup_err_msg_blog').style.display = "block";
			return;
		}
		document.getElementById(comment_div).style.display = "none";
		this.Commentcallback = InsertCommentCallback;	
		var req = new JSAjaxDoc(this, "Commentcallback", i);
		req.addParam("post_id", PostId);
		req.addParam("comment_body",CommentBody);
		req.addParam("post_heading",post_heading);
		var url = "/blog/insert_comment.php";
		req.send(url, "POST");
	}
	
	function blog_markComment(comment_status)
	{
		document.getElementById(comment_status).value = 1;
	}
	
	
	function SetCategoriesCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}		
	}
	
	function SetCategories()
	{
		this.Categoriescallback =SetCategoriesCallback;	
		var req = new JSAjaxDoc(this, "Categoriescallback");
		var url = "/blog/set_categories.php";
		req.send(url, "POST");
	}

	function SortBlog()
	{
		if (document.getElementById('post_num').value != "")
		{
			ShowPosts(2,document.getElementById('post_num').value,9);
		}
		else
			ShowPosts(3,document.getElementById('writer').value,9);	
	}
	
	function OpenCommentBody(div_father,div_name)
	{
		if (document.getElementById(div_name).style.display == "none")
		{
			document.getElementById(div_name).style.display = "block";
			document.getElementById(div_father).style.color = "#3195ED";
		}
		else
		{
			document.getElementById(div_name).style.display = "none";
			document.getElementById(div_father).style.color = "#7E7E7E";
		}
		
	}
	
	function AddComment(div_name)
	{
		if (document.getElementById(div_name).style.display == "none")
			document.getElementById(div_name).style.display="block";
		else
			document.getElementById(div_name).style.display="none";
	}
	
	function blogCheckKey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			SortBlog();
		}
	}
	
	function getCalenderCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{
			return;
		}	
		document.getElementById('div_left_cal').innerHTML = text;
	}
			
	function getCalender(year, month)
	{
		this.getCcallback = getCalenderCallback;	
		var req = new JSAjaxDoc(this, "getCcallback");
		req.addParam("year", year);
		req.addParam("month", month);
		var url = "/blog/get_cal.php";
		req.send(url, "POST");
	}
	
	function blog_viewComments(i)
	{
		//alert(i);
		if ( document.getElementById('comment_div_display_' + i).style.display == "none" )
		{
			document.getElementById('comment_div_display_' + i).style.display = "block";
			document.getElementById('comment_view_' + i).innerHTML = 'Hide';
			
		}
		else
		{
			document.getElementById('comment_div_display_' + i).style.display = "none";
			document.getElementById('comment_view_' + i).innerHTML = 'View';
		}
	}
	
	
	function blogInit()
	{
		gFunZoneStatus = 1;
		loadLeftPanel('/blog/blog_left.php');		
		mp_initPlayer();
	}
		
	//			Favorites js
	function getFavoritesCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{
			return;
		}
				
		document.getElementById('favorites_div').innerHTML = text;
	}

	function getFavorites(type, offset)
	{	
		if (document.getElementById('search') != null)
			searchValue = document.getElementById('search').value;
		else
			searchValue = "";
		searchValue = searchValue.toLowerCase();
		this.getFavcallback = getFavoritesCallback;	
		var req = new JSAjaxDoc(this, "getFavcallback");
		req.addParam("offset", offset);
		req.addParam("type", type);
		req.addParam("search_value", searchValue);
		var url = "/favorites/get_favorites.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function favorites_getVideosCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{
			return;
		}
				
		document.getElementById('favorites_div').innerHTML = text;
	}
	
	function favorites_getVideos(offset)
	{
		if (document.getElementById('search') != null)
			searchValue = document.getElementById('search').value;
		else
			searchValue = "";
		searchValue = searchValue.toLowerCase();
		this.getFavcallback = getFavoritesCallback;	
		var req = new JSAjaxDoc(this, "getFavcallback");
		req.addParam("offset", offset);
		req.addParam("search_value", searchValue);
		var url = "/favorites/favorites_get_videos.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function getFavEraGenCallback(text, xml, status, usr_word)
	{		
		if ( status != STATUS_READY )
		{			
			return;
		}
	
		document.getElementById('fav_era_genr_div').innerHTML = text;
	}

	function getFavEraGen()
	{	
		this.getFavE = getFavEraGenCallback;	
		var req = new JSAjaxDoc(this, "getFavE");
		var url = "/favorites/favorites_get_era_genre.php";
		req.send(url, "GET");
	}
	
	function favCreateStation(trackId)
	{	
		callApp("app_createStationByTrackId("+trackId+")", 1);
	}
	
	function favCreateStationByArtist(ArtistId)
	{	
		callApp("MeeMixPlayer.createStationByArtistId("+ArtistId+")", 1);
	}
	
	function createStationByVideo(yt_id)
	{
		callApp('MeeMixPlayer.createStationByVideoId('+ yt_id +')', 1);
	}
	function favDeleteCallback(text, xml, status, usr_word)
	{
		
		if ( status != STATUS_READY )
		{		
			return;
		}
		getFavorites(text,0);
	}

	function favDelete(trackId, stationId, uid, search)
	{	
		this.favD = favDeleteCallback;	
		var req = new JSAjaxDoc(this, "favD");
		req.addParam("track_id", trackId);
		req.addParam("station_id", stationId);
		req.addParam("uid", uid);
		req.addParam("search", search);
		var url = "/favorites/favorite_delete.php";
		req.send(url, "POST");
	}
	
	var gIsSent = false;
	function favorites_updateCallback(text, xml, status, usr_word)
	{
		gIsSent = false;
		document.getElementById('update').style.cursor='hand';
		if ( status != STATUS_READY )
		{			
			return;
		}
		
		document.getElementById('popup_msg_favorites_body').innerHTML = text;
		document.getElementById('popup_msg_favorites').style.display = "block";
	}
	
	function favorites_update()
	{
		if ( gIsSent )
		{
			return;
		}		
		document.getElementById('update').style.cursor='wait';
		this.UpdateFavcallback = favorites_updateCallback;	
		var req = new JSAjaxDoc(this, "UpdateFavcallback");
		req.addParam('favorite_genre', document.getElementById('favorite_genre').selectedIndex);
		req.addParam('favorite_era', document.getElementById('favorite_era').selectedIndex);
		var url = "/favorites/favorites_update.php";
		gIsSent = true;
		req.send(url, "POST");
	}
	
	function favoritesCheckkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			favorites_search();
		}
	}
	
	function getSearchFavorites()
	{
		for (i=1; i<=3; i++)
		{
			if (document.getElementById('div_'+i).style.fontWeight == "bold")
				getFavorites(i-1,0);
		}
	}
	
	function favorites_search()
	{
		var fav_view = document.getElementById('fav_mode_val').value;
		
		if ( fav_view == 1 ) {
			var audio_sort = document.getElementById('audio_sort_val').value;
			getFavorites(audio_sort,0);
		} else {
			favorites_getVideos(0);
		}
	}
	
	function changeDiv(div_name)
	{
		for (i=1; i<=3; i++)
		{
			document.getElementById('div_'+i).style.fontWeight = "normal";
		}
		document.getElementById(div_name).style.fontWeight = "bold";
		
		if (div_name == 'div_1')
			getFavorites(0,0);
		if (div_name == 'div_2')
			getFavorites(1,0);
		if (div_name == 'div_3')
			getFavorites(2,0);	
	}
	
	function favorites_switchTab(tab)
	{
		for ( i=0; i<=2; i++ ) {
			
			document.getElementById('audio_sort_' + i).style.fontWeight = 'normal';
		}
		document.getElementById('audio_sort_' + tab).style.fontWeight = 'bold';
		
		document.getElementById('audio_sort_val').value = tab;
		
		getFavorites(tab,0);	
	}
	
	function favorites_switchVideoView(row)
	{
		document.getElementById('video_unClick_' + row).style.display = 'none';
		document.getElementById('video_onClick_' + row).style.display = 'block';
	}
	
	function favorites_switchMode(tab)
	{
		for ( i=1; i<=2; i++ ) {
			document.getElementById('fav_mode_' + i).style.fontWeight = 'normal';
		}
		document.getElementById('fav_mode_' + tab).style.fontWeight = 'bold';
		document.getElementById('fav_mode_val').value = tab;
		
		if ( tab == 2 ) {
			favorites_getVideos(0);
			document.getElementById('fav_view').innerHTML = 'Video';
			document.getElementById('audio_sort').style.display = 'none';
		} else {
			getFavorites(0, 0);
			document.getElementById('fav_view').innerHTML = 'Audio';
			document.getElementById('audio_sort').style.display = 'block';
		}
	}
					
	function favoritesInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		setBarBold('favorites_bar');
		document.title = "Easy access to your top songs with Mee Favorites";
		rp_resetRightBottom();
		mp_initPlayer();
	}
	
	
	//
	//
	//
	//		Listeners js
	//
	//
	//
	
	function getListenersCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}
		if ( document.getElementById('listeners_div') != null )
		{
			document.getElementById('listeners_div').innerHTML = text;
			if (gStationOnlineStatus != 9)
			{
				if (gStationOnlineStatus == 1)
				{
					document.getElementById('listeners_all').style.fontWeight = "normal";
					document.getElementById('listeners_online').style.fontWeight = "bold";
				}
				else if (gStationOnlineStatus == 0)
				{
					document.getElementById('listeners_online').style.fontWeight = "normal";
					document.getElementById('listeners_all').style.fontWeight = "bold";
				}	
				
			}
		}
	}

	function getListeners(search, offset)
	{	
		if (document.getElementById('station_list') != null)
			document.getElementById('station_list').style.display='none';
		searchValue = "";
		if (document.getElementById('ma_search') != null )
		{
			searchValue = document.getElementById('ma_search').value;
			searchValue = searchValue.toLowerCase();
		}
		
		if (searchValue != "")
			gStationId = 0;
		
		
		this.listenerCallback = getListenersCallback;	
		var req = new JSAjaxDoc(this, "listenerCallback");
		req.addParam("offset", offset);
		req.addParam("search", search);		
		req.addParam("search_value", searchValue);
		req.addParam("station_id", gStationId);
		req.addParam("online_station", gStationOnlineStatus);
		if (document.getElementById('user_listeners') != null)
		{
			for (i=0; i< document.user_listeners.elements.length; i++)
			{
				if (document.user_listeners.elements[i].checked == true)
					req.addParam(document.user_listeners.elements[i].name, document.user_listeners[i].value);
			}
			req.addParam("length", document.user_listeners.elements.length);
		}
		else
		{
			req.addParam("length", 0);
		}
		
	
		if (document.getElementById('online_status') != null)
			req.addParam("online_status", document.getElementById('online_status').value);
		else
			req.addParam("online_status", 0);
	
		
		var url = "/listeners/get_listeners.php";
		
		req.send(url, "GET");
		
		return false;
	}
		
	function listenersCheckKey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			getListeners(0,0);
		}
	}
	
	function getListenersOnline(div)
	{
		gStationOnlineStatus = 9;
		document.getElementById('listeners_online').style.fontWeight = "normal";
		document.getElementById('listeners_all').style.fontWeight = "normal";
		document.getElementById(div).style.fontWeight = "bold";
		if (div == 'listeners_online')
			document.getElementById('online_status').value = 1;
		if (div == 'listeners_all')
			document.getElementById('online_status').value = 0;
		getListeners(0,0);
	}
	
	function listenersAppInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		setBarBold('listeners_bar');
		document.title = "See who is listening to your stations in Mee Audience";
		//if ( document.getElementById('top_div') == null && document.getElementById('right_top_div_5').style.display == 'none' && document.getElementById('right_top_div_4').style.display == 'none' )
		//	right_panel_init();
		//getListeners(0, 0);
	}
	
	function listenersInit(searchValue)
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		setBarBold('listeners_bar');
		document.title = "See who is listening to your stations in Mee Audience";
		//if ( document.getElementById('top_div') == null && document.getElementById('right_top_div_5').style.display == 'none' && document.getElementById('right_top_div_4').style.display == 'none' )
		//	right_panel_init();
		getListeners(0, 0);
		rp_resetRightBottom();
	}
	
	//
	//
	//		Profile Js
	//
	//
	//
	//
	
	function profileGetInfoCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('profile_div').innerHTML = text;
	}
	
	function profileGetInfo()
	{					
		this.profileGcallback = profileGetInfoCallback;			
		var req = new JSAjaxDoc(this, "profileGcallback");
		var url = "/profile/profile_get_info.php";
		req.send(url, "GET");
	}
	
	function profileGetBirthDaysCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}				
		eval(text);
	}
	
	function profileGetBirthDays()
	{	
		document.getElementById('DateOfbirthday').length = 1;				
		var year = document.getElementById('DateOfbirthyear').selectedIndex-1;
		var month = document.getElementById('DateOfbirthmonth').selectedIndex;
		this.profileGetBcallback = profileGetBirthDaysCallback;			
		var req = new JSAjaxDoc(this, "profileGetBcallback");
		req.addParam("year", year);
		req.addParam("month", month);
		var url = "/profile/profile_get_birthdays.php";
		req.send(url, "POST");
	}
	
	function deletePhotoCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		loadPhotos();
		document.getElementById('photo_msg').innerHTML = "";
		document.getElementById('current_photo').src = "/profile/img/photo_not_found.gif";
	}
	
	function deletePhoto()
	{
		this.deletePcallback = deletePhotoCallback;			
		var req = new JSAjaxDoc(this, "deletePcallback");
		req.addParam("photo_id", document.getElementById('photo_id').value);
		var url = "/profile/profile_delete_photo.php";
		req.send(url, "POST");
	}
	
	function loadPhotosCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('photos_div').innerHTML = text;
	}
	
	function loadPhotos()
	{
		this.loadPcallback = loadPhotosCallback;			
		var req = new JSAjaxDoc(this, "loadPcallback");
		var url = "/profile/profile_load_photos.php";
		req.send(url, "GET");
	}
	
	function ProfileGetStatesCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		eval(text);
		ProfileGetCities();
	}
	
	function ProfileGetStates()
	{	
		document.getElementById('states').length = 0;
		document.getElementById('city').length = 0;		
		var country = document.getElementById('country').value;
		this.ProfileGetScallback = ProfileGetStatesCallback;			
		var req = new JSAjaxDoc(this, "ProfileGetScallback");
		req.addParam("country", country);
		var url = "/profile/profile_get_states.php";
		req.send(url, "POST");
	}
	
	function ProfileGetCitiesCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		
		eval(text);
//		element = document.getElementById('start_search_div');
//		element.attachEvent('onClick',members_startSearch());
//		element.addEventListener('onClick',members_startSearch(),true)
//		element.onclick = members_startSearch();
//		if (element.captureEvents) element.captureEvents(Event.CLICK);

	}
	
	function ProfileGetCities()
	{	
		document.getElementById('city').length = 0;	
		var country = document.getElementById('country').value;
		var state = document.getElementById('states').value;
		this.ProfileGetCcallback = ProfileGetCitiesCallback;			
		var req = new JSAjaxDoc(this, "ProfileGetCcallback");
		req.addParam("country", country);
		req.addParam("state", state);
		var url = "/profile/profile_get_city.php";
//		element = document.getElementById('start_search_div');
//		element.detachEvent('onClick',members_startSearch());
///		element.removeEventListener('onClick',members_startSearch(),true)
		req.send(url, "POST");
	}
	
	var gIsSent = false;
		
	function profile_getTabCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('profile_div').innerHTML = text;
	}
	
	function profile_getTab(tab, file_name)
	{	
		for( i=1; i<=6; i++ ) {
			document.getElementById('profile_tab_' + i).style.fontWeight = 'normal';
		}
		document.getElementById('profile_tab_' + tab).style.fontWeight = 'bold';
		this.profile_getT = profile_getTabCallback;			
		var req = new JSAjaxDoc(this, "profile_getT");
		var url = "/profile/"+ file_name;
		req.send(url, "GET");
	}
	
	function profile_load_after_avatar()
	{
		if ( document.getElementById('right_top_div_1').style.display == 'block' ) {
			
			loadRightPanel('you/load_you_top.php','right_top_div_1');
		}
		profile_getTab(3, 'profile_media_style.php');
		
	}
	
	function profile_updateAboutMeeCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		profile_getTab(2, 'profile_picture.php');
	}
	
	function profile_updateAboutMee()
	{
		this.profile_updateA = profile_updateAboutMeeCallback;			
		var req = new JSAjaxDoc(this, "profile_updateA");
		//alert(valueRadio(document.getElementsByName('sex')));
		req.addParam("gender", valueRadio(document.getElementsByName('sex')));
		
		for (i=0; i <= document.about_mee_form.elements.length-1; i++)
		{
			req.addParam(document.about_mee_form.elements[i].name, document.about_mee_form[i].value);
		}
		var url = "/profile/profile_about_mee_update.php";
		req.send(url, "POST");
	}
	
	function profile_updateMediaStyleCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		profile_getTab(4, 'profile_lifestyle.php');
	}
	
	function profile_updateMediaStyle()
	{
		this.profile_updateM = profile_updateMediaStyleCallback;			
		var req = new JSAjaxDoc(this, "profile_updateM");
		
		for (i=0; i <= document.media_style_form.elements.length-1; i++)
		{
			req.addParam(document.media_style_form.elements[i].name, document.media_style_form[i].value);
		}
		
		var url = "/profile/profile_media_style_update.php";
		req.send(url, "POST");
	}
	
	function profile_updateLifestyleCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		profile_getTab(5, 'profile_interests.php');
	}
	
	function profile_updateLifestyle()
	{
		this.profile_updateL = profile_updateLifestyleCallback;			
		var req = new JSAjaxDoc(this, "profile_updateL");
		
		for (i=0; i < document.lifestyle_form.elements.length; i++)
		{
			req.addParam(document.lifestyle_form.elements[i].name, document.lifestyle_form[i].value);
		}
		req.addParam("marital_status", valueRadio(document.getElementsByName('marital_status')));
		req.addParam("smoking", valueRadio(document.getElementsByName('smoke_status')));
		req.addParam("drinking", valueRadio(document.getElementsByName('drink_status')));
		req.addParam("sexual", valueRadio(document.getElementsByName('sex_status')));
		req.addParam("childrens", valueRadio(document.getElementsByName('children_status')));
		
		var url = "/profile/profile_lifestyle_update.php";
		req.send(url, "POST");
	}
	
	function profile_updateInterestsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		profile_getTab(6, 'profile_settings.php');
	}
	
	function profile_updateInterests()
	{
		this.profile_updateI = profile_updateInterestsCallback;			
		var req = new JSAjaxDoc(this, "profile_updateI");
		
		for (i=0; i < document.interests_form.elements.length-1; i++)
		{
			//alert(document.media_style_form.elements[i].name+" "+document.media_style_form[i].value);
			req.addParam(document.interests_form.elements[i].name, document.interests_form[i].value);
		}
		
		var url = "/profile/profile_interests_update.php";
		req.send(url, "POST");
	}
	
	function profile_updateSettingsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
	}
	
	function profile_updateSettings()
	{
		this.profile_updateS = profile_updateSettingsCallback;			
		var req = new JSAjaxDoc(this, "profile_updateS");
		
		
		for ( i=0; i<3; i++ )
		{
			if ( document.settings_form.unsubscribe_radio[i].checked == true )
				req.addParam('unsub_type', document.settings_form.unsubscribe_radio[i].value);
		}		
		req.addParam("privacy", valueRadio(document.getElementsByName('privacy')));
		req.addParam("email", document.getElementById('email').value);
		
		var url = "/profile/profile_settings_update.php";
		req.send(url, "POST");
	}
		
	
	function profileUpdateCallback(text, xml, status, usr_word)
	{
		gIsSent = false;
		document.getElementById('update').style.cursor='pointer';
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('popup_msg_profile_frame').style.display = "block";
		
		/*if (document.getElementById('right_top_div_1').style.display == "block")
		{
			right_panel_init();
		}*/
		callApp('checkRightPanel()', 0, 0);
	}

	function profileUpdate()
	{		
		if ( gIsSent )
		{
			return;
		}		
		document.getElementById('update').style.cursor='wait';
		this.profileUcallback = profileUpdateCallback;	
		val = document.getElementById('states').selectedIndex;
		var req = new JSAjaxDoc(this, "profileUcallback");
		req.addParam("gender", valueRadio(document.getElementsByName('sex')));
		req.addParam("marrige_status", valueRadio(document.getElementsByName('marital_status')));
		req.addParam("smoking", valueRadio(document.getElementsByName('smoke_status')));
		req.addParam("drinking", valueRadio(document.getElementsByName('drink_status')));
		req.addParam("sexual", valueRadio(document.getElementsByName('sex_status')));
		req.addParam("childrens", valueRadio(document.getElementsByName('children_status')));
		for (i=0; i < document.user_profile.elements.length-1; i++)
		{
			req.addParam(document.user_profile.elements[i].name, document.user_profile[i].value);
		}
		for ( i=0; i<3; i++)
		{
			if ( document.user_profile.unsubscribe_radio[i].checked == true )
				req.addParam('unsub_type', document.user_profile.unsubscribe_radio[i].value);
		}		
		
		req.addParam("privacy", valueRadio(document.getElementsByName('privacy')));
		var url = "/profile/profile_update.php";
		gIsSent = true;
		req.send(url, "POST");
	}
	
	function OnAvatarPageLoaded(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		
		document.getElementById('Avatars').innerHTML = text;
	}
	
	function changeAvatar(avatar_name)
	{
		if (document.getElementById(avatar_name).src != '/profile/img/avatar.gif')
			document.getElementById('chosenAvatar').src = document.getElementById(avatar_name).src;
		setAvatar();
	}
	
	function switchAvatarDiv(theme, page)
	{
		this.switchAvatacallback = OnAvatarPageLoaded;			
		var req = new JSAjaxDoc(this, "switchAvatacallback");
		
		req.addParam("theme", document.getElementById('Theme').selectedIndex);		
		req.addParam("page", page);

		
		var url = "/profile/avatar_page.php";
		req.send(url, "GET");
		return false;
	}
	
	function updateAll()
	{
		profileUpdate();
		document.user_profile.submit();
	}
	
	function uploadPhoto()
	{
		//profile_disablePhotoUpload()
		document.user_profile.submit();
	}
	
	function profile_disablePhotoUpload()
	{
		if ( document.getElementById('upload_photo_btn') != null && document.getElementById('upload_photo_btn_disable') != null )
		{
			document.getElementById('upload_photo_btn').style.display = "none";
			document.getElementById('upload_photo_btn_disable').style.display = "block";
		}
	}
	
	function profile_enablePhotoUpload()
	{
		if ( document.getElementById('upload_photo_btn') != null && document.getElementById('upload_photo_btn_disable') != null )
		{
			document.getElementById('upload_photo_btn').style.display = "block";
			document.getElementById('upload_photo_btn_disable').style.display = "none";
		}
	}
	
	function profile_timeOutLoadPhotos()
	{
		setTimeout('loadPhotos()', 400);
	}
	
	function checkField(fieldName,fieldLength)
	{
		var fieldValue = document.getElementById(fieldName).value;
		if ((fieldValue.length) > fieldLength) 
		{
			//alert ("Field is too big");
		}
		
		if (fieldName == 'bloglink')
			if (document.getElementById(fieldName).value != "")
				if (!isURL(document.getElementById(fieldName).value))
					alert("Please enter valid URL");
	}
	
	function isURL(argvalue) 
	{
	  if (argvalue.indexOf(" ") != -1)
	    return false;
	  else if (argvalue.indexOf("http://") == -1)
	    return false;
	  else if (argvalue == "http://")
	    return false;
	  else if (argvalue.indexOf("http://") > 0)
	    return false;
	
	  argvalue = argvalue.substring(7, argvalue.length);
	  if (argvalue.indexOf(".") == -1)
	    return false;
	  else if (argvalue.indexOf(".") == 0)
	    return false;
	  else if (argvalue.charAt(argvalue.length - 1) == ".")
	    return false;
	
	  if (argvalue.indexOf("/") != -1) {
	    argvalue = argvalue.substring(0, argvalue.indexOf("/"));
	    if (argvalue.charAt(argvalue.length - 1) == ".")
	      return false;
	  }
	
	  if (argvalue.indexOf(":") != -1) {
	    if (argvalue.indexOf(":") == (argvalue.length - 1))
	      return false;
	    else if (argvalue.charAt(argvalue.indexOf(":") + 1) == ".")
	      return false;
	    argvalue = argvalue.substring(0, argvalue.indexOf(":"));
	    if (argvalue.charAt(argvalue.length - 1) == ".")
	      return false;
	  }
  		return true;
	}
	
	function profileCurrentImage(photo_src,target)
	{		
		document.getElementById(target).src = photo_src;	
		document.getElementById('avatar_refresh').value = 1;		
	}
	
	function editImage(photo_src,target,desc,photo_id)
	{
		profileCurrentImage(photo_src,target);
		document.getElementById('photo_desc').value = desc;
		document.getElementById('delete_photo_btn').style.display = "block";
		document.getElementById('photo_id').value = photo_id;		
		document.getElementById('photo_btn').innerHTML = "Update";
	}
	
	function newPhoto()
	{
		if (document.getElementById('photo_count').value != '12')
		{
			profileCurrentImage('/profile/img/photo_not_found.gif','current_photo');
			document.getElementById('photo_desc').value = "";
			document.getElementById('photo_id').value = "";			
			document.getElementById('photo_msg').innerHTML = "";
		}
		else
			document.getElementById('photo_msg').innerHTML = "You can't upload more than 12 photos";
		
	}
	
	function setAvatar() 
	{
		document.getElementById('avatar_image').src = document.getElementById('chosenAvatar').src;
		document.getElementById('avatar_id').value = document.getElementById('chosenAvatar').src;
		document.getElementById('avatar_refresh').value = 0;
	}
	
	function valueCheckbox(id)
	{
		if (document.getElementById(id).checked == true)
		{
			document.getElementById(id).value=1;
		}
		else
		{
			document.getElementById(id).value=0;
		}
	}
	
	function valueRadio(radioObj)
	{
		radioLength = radioObj.length
		for(var i = 0; i < radioLength; i++) 
		{
			if(radioObj[i].checked) 
			{
				return radioObj[i].value;
			}
		}
	}
	
	function switchAvatarPage(div)
	{
		document.getElementById('div_2').style.display = "none";
		document.getElementById('div_7').style.display = "none";
		document.getElementById(div).style.display = "block";
		document.getElementById('chosenAvatar').src = document.getElementById('avatar_image').src;
		switchAvatarDiv(0, 0);
	}
	

	function profile_outLink(id, box_id)
	{
		if ( document.getElementById(box_id).style.display == 'block' ) {
			document.getElementById(id).className = 'inner_link_chosen';
		} else {
			document.getElementById(id).className='inner_link';
		}
	}
	
	function switchMusicStyleDiv(num)
	{
		for (i=1; i<=3; i++)
		{
			document.getElementById("music_style_" + i).style.display = "none";
			document.getElementById("music_style_other_" + i).style.display = "none";
			document.getElementById("music_style_bul_sel_" + i).style.display = "block";
			document.getElementById("music_style_bul_" + i).style.display = "none";
			document.getElementById("music_style_title_" + i).className='inner_link';
		}
		document.getElementById("music_style_" + num).style.display = "block";
		document.getElementById("music_style_other_" + num).style.display = "block";
		document.getElementById("music_style_bul_sel_" + num).style.display = "none";
		document.getElementById("music_style_bul_" + num).style.display = "block";
		document.getElementById("music_style_title_" + num).className = 'inner_link_chosen';
		
	}
	
	function switchLifestyleEle(div, name)
	{
		for (i=1; i<=2; i++)
		{	
			document.getElementById(name + "life_" + i).style.display = "none";
		}
		document.getElementById(div).style.display = "block";
	}
	
	function switch_photo_page(div, next)
	{
		for (i=1; i<=2; i++)
		{
			document.getElementById("photo_page_" + i).style.display = "none";
			document.getElementById("photo_next_" + i).style.display = "none";
		}
		document.getElementById(div).style.display = "block";
		document.getElementById(next).style.display = "block";
	}
	
	function switchLifeStyleDiv(num)
	{
		for (i=1; i<=12; i++)
		{
			document.getElementById("life_style_title_" + i).className='inner_link';
			document.getElementById("life_style_" + i).style.display = "none";
			document.getElementById("life_style_other_" + i).style.display = "none";
			document.getElementById("life_style_bul_sel_" + i).style.display = "block";
			document.getElementById("life_style_bul_" + i).style.display = "none";
		}
		
		document.getElementById("life_style_title_" + num).className='inner_link_chosen';
		document.getElementById("life_style_" + num).style.display = "block";
		document.getElementById("life_style_other_" + num).style.display = "block";
		document.getElementById("life_style_bul_sel_" + num).style.display = "none";
		document.getElementById("life_style_bul_" + num).style.display = "block";
	}
	
	function profileSwitch_div(div_name,link_name) // Create Divs
	{
		document.getElementById('div_7').style.display = "none";
		//if (div_name == 'div_2')
		//	loadPhotos();
		for ( i = 1; i <= 6; i++ )
		{
			document.getElementById('div_' + i).style.display = "none";
			document.getElementById('link_' + i).style.fontWeight = "normal";
		}
		document.getElementById(div_name).style.display = "block";
		document.getElementById(link_name).style.fontWeight = "bold";
	}
	
	function switchInterestDiv(num, div_name,checkBox_name)
	{
		for (i=1; i<=12; i++)
		{
			document.getElementById("interestCheckbox_" + i).style.display = "none";
			document.getElementById("checkbox_" + i).className = "inner_link";
			document.getElementById("category_bul_" + i).style.display = "none";
			document.getElementById("category_bul_sel_" + i).style.display = "block";
		}
		document.getElementById(div_name).style.display = "block";
		document.getElementById("checkbox_" + num).className = "inner_link_chosen";
		document.getElementById("category_bul_" + num).style.display = "block";
		document.getElementById("category_bul_sel_" + num).style.display = "none";
	}
	
	function display_passwd_div(div)
	{
		for (i=1; i<=2; i++)
		{
			document.getElementById('passwd_div_' +i).style.display = "none";
		}
		document.getElementById(div).style.display = "block";
	}
	
	function profile_initSwitch(tab_value)
	{
		profileInit();
		profileSwitch_div('div_'+tab_value ,'link_'+tab_value);
	}
	
	function profile_getInitSwitch(tab_value)
	{
		loadMiddlePanel('/profile/profile.php','profile_initSwitch(2)');
		//profileInit();
		//profileSwitch_div('div_'+tab_value ,'link_'+tab_value);
	}
	
	
	function profileInit() 
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		setBarBold('profile_bar');
		document.title = "Your profile in MeeMix Internet radio community";
		rp_resetRightBottom();
		profile_enablePhotoUpload();
		//profileGetInfo();
	}
	
	//
	//
	//		Stations Js
	//
	//
	//
	//
	
	function getMostStationsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}				
		
		document.getElementById('div_1').innerHTML = text;
	}
	
	//			* onlineStatus *
	//
	//	All - user is offline - value - 0 
	//
	//	Online - user is online - value - 1 
	//
	var gStationOrder = "";
	
	
	function getMostStations()
	{					
		if(document.getElementById('stations_all') != null)
		{
			if (document.getElementById('stations_all').style.fontWeight == "bold")
				onlineStatus = 0;
			if (document.getElementById('stations_online').style.fontWeight == "bold")
				onlineStatus = 1;
		}
		else
			onlineStatus = 0;
		
		if(document.getElementById('current_page') != null)
			document.getElementById('current_page').value = 0;
		
		this.getMostScallback = getMostStationsCallback;			
		var req = new JSAjaxDoc(this, "getMostScallback");
		req.addParam("online_status", onlineStatus);		
		var url = "/stations/get_most_stations.php";
		req.send(url, "GET");
	}
	
	function getStationsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('div_1').innerHTML = text;
	}
		
	function getStations(offset,order,onlineStatus,station_genre)
	{	
		
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('station_bar');
		loadLeftPanel('/fun_zone/fun_zone.php');
		if (station_genre == "")
			station_genre = 0;
		if (document.getElementById('stations_all').style.fontWeight == "bold")
			onlineStatus = 0;
		if (document.getElementById('stations_online').style.fontWeight == "bold")
			onlineStatus = 1;
		document.getElementById('current_page').value = 1;
		document.getElementById('order').value = order;
		if (order == 4)
			document.getElementById('genre').value = station_genre;
		else
			document.getElementById('genre').value = "";
		this.getScallback = getStationsCallback;			
		var req = new JSAjaxDoc(this, "getScallback");
		req.addParam("offset", offset);	
		req.addParam("order", order);	
		req.addParam("search_value", document.getElementById('search').value.toLowerCase());
		req.addParam("online_status", onlineStatus);
		req.addParam("genre", station_genre);	
		station_getOrder(order, station_genre, document.getElementById('search').value.toLowerCase());	
		var url = "/stations/get_stations.php";
		req.send(url, "GET");
	}
	
	function station_getOrderCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('station_order').innerHTML = text;
	}
	
	function station_getOrder(order, station_genre, search_value)
	{
		this.station_getO = station_getOrderCallback;			
		var req = new JSAjaxDoc(this, "station_getO");
		req.addParam("order", order);	
		req.addParam("genre", station_genre);	
		req.addParam("search_value", search_value);	
		var url = "/stations/stations_get_order.php";
		req.send(url, "GET");
	}
	
	function station_change_div(div)
	{
		if (div == 'stations_all')
		{
			if (document.getElementById('stations_all').style.fontWeight != "bold")
			{
				document.getElementById('stations_all').style.fontWeight = "bold";
				document.getElementById('stations_online').style.fontWeight = "normal";
				if (document.getElementById('current_page').value == 0)
				{
					getMostStations();
				}
				if (document.getElementById('current_page').value == 1)
				{
					getStations(0,document.getElementById('order').value,0,document.getElementById('genre').value);
				}
			}
		}
		if (div == 'stations_online')
		{
			if (document.getElementById('stations_online').style.fontWeight != "bold")
			{
				document.getElementById('stations_all').style.fontWeight = "normal";
				document.getElementById('stations_online').style.fontWeight = "bold";
				if (document.getElementById('current_page').value == 0)
				{
					getMostStations();
				}
				if (document.getElementById('current_page').value == 1)
				{
					getStations(0,document.getElementById('order').value,0,document.getElementById('genre').value)
				}
			}
		}
	}
	
	function station_chosen(bgImage, stationTextColor, stationPlay)
	{
		document.getElementById(bgImage).src = "/stations/img/blue_bg.gif";
		document.getElementById(stationTextColor).style.color = "#3296EE";
		//document.getElementById(stationPlay).style.display = "block";
	}
	
	function station_unchosen(bgImage, stationTextColor, stationPlay)
	{
		document.getElementById(bgImage).src = "/stations/img/grey_bg.gif";
		document.getElementById(stationTextColor).style.color = "#7E7E7E";
		//document.getElementById(stationPlay).style.display = "none";
	}
	
	function stationsSetGenre(genre)
	{
		document.getElementById('genre').value = genre;
		getStations(0,4,0);
	}
	
	function stationsCheckkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			getStations(0,1);
		}
	}
	
	function stations_getPageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}				
		
		document.getElementById('div_1').innerHTML = text;
	}
	
	function stations_getPage(offset)
	{					
		this.stations_getP = stations_getPageCallback;			
		var req = new JSAjaxDoc(this, "stations_getP");
		req.addParam("offset", offset);		
		req.addParam("sort", document.getElementById('sp_sort').value);		
		req.addParam("genre", document.getElementById('sp_selected_genre').value);	
		req.addParam("online_status", document.getElementById('sp_online_status').value);	
		req.addParam("search", document.getElementById('sp_search').value);	
		var url = "/stations/stations_get_page.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function stations_switchGenres(num, chosen, value, value_text)
	{
		for ( i=0; i<num; i++ )
		{
			if ( document.getElementById('sp_genre_' + i) != null ) 
				document.getElementById('sp_genre_' + i).style.fontWeight = "normal";
		}
		document.getElementById('sp_selected_genre').value = value;		
		document.getElementById('sp_genre_' + chosen).style.fontWeight = "bold";		
		document.getElementById('chosen_genre').innerHTML = value_text;		
	}
	
	function stations_switchSort(num)
	{
		for ( i=1; i<=3; i++ )
		{
			if ( document.getElementById('sp_sort_' + i) != null )
				document.getElementById('sp_sort_' + i).style.fontWeight = "normal";
		}
		document.getElementById('sp_sort').value = num;
		document.getElementById('sp_sort_' + num).style.fontWeight = "bold";
	}
	
	function stations_switchOnline(num)
	{
		for ( i=0; i<=1; i++ )
		{
			document.getElementById('sp_online_' + i).style.fontWeight = "normal";
		}
		document.getElementById('sp_online_status').value = num;
		document.getElementById('sp_online_' + num).style.fontWeight = "bold";	
	}
	
	function stations_reset()
	{
		stations_switchGenres(9,0 ,0 ,'All');
		stations_switchSort(1);
		stations_switchOnline(0);
	}
	
	function stations_checkkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			stations_reset();
			stations_getPage(0);
		}
	}
	
	
	function stationsInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('station_bar');
		document.title = "Find the latest - and the greatest - stations at MeeMix";
		rp_resetRightBottom();	
		//getMostStations();
	}
	
	
	//
	//
	//	Source JS
	//
	//
	function loadTheSourceCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}				
		document.getElementById('div_1').innerHTML = text;
	}
	
	function loadTheSource()
	{
		this.loadTheScallback = loadTheSourceCallback;	
		var req = new JSAjaxDoc(this, "loadTheScallback");
		var url = "/source/load_the_source.php";
		req.send(url, "GET");
	}
	
	function loadTheSourceExampleCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}				
		document.getElementById('div_1').innerHTML = text;
	}
	
	function loadTheSourceExample(link)
	{
		this.loadTheSourceEcallback = loadTheSourceExampleCallback;	
		var req = new JSAjaxDoc(this, "loadTheSourceEcallback");
		var url = "/source/"+link;
		req.send(url, "GET");
	}
	
	function loadTheSourceCodeCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}		
		document.getElementById('div_1').innerHTML = text;
	}
	
	function loadTheSourceCode()
	{
		this.loadTheSourceCcallback = loadTheSourceCodeCallback;	
		var req = new JSAjaxDoc(this, "loadTheSourceCcallback");
		var url = "/source/load_the_source.php";
		req.send(url, "POST");
	}
	
	function SourceTurnOnBarColor(img)
	{
		document.getElementById(img).src = "/source/img/"+img+"_on.gif";
	}
	
	function SourceTurnOffBarColor(img)
	{
		document.getElementById(img).src = "/source/img/"+img+"_off.gif";
	}
	
	var gSourceCode = ""
	
	function source_generateCodeCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		if ( usr_word != 1 ) {
			document.getElementById('meemix_widget_form').reset();
		}
		document.getElementById(gSourceCode).innerHTML = text;	
		document.getElementById(gSourceCode).select();
	}
	
	function source_generateCode(div, sourceType)
	{
		gSourceCode = div+"code";
		document.getElementById(div+"div").style.display = "block";
		this.source_generateC = source_generateCodeCallback;	
		
		if ( document.getElementById('chosen_station_0') != null ) {
			var req = new JSAjaxDoc(this, "source_generateC", 1);
			for ( var i=0; i<10; i++ ) {
				if ( document.getElementById('chosen_station_' + i) != null ) {
					if ( document.getElementById('chosen_station_' + i).checked ) {
						req.addParam("station_id", document.getElementById('chosen_station_' + i).value);
					}
				}
			}
		} else {
			var req = new JSAjaxDoc(this, "source_generateC", 0);
		}
		
		req.addParam("source_type", sourceType);
		var url = "/source/source_generate_code.php";
		req.send(url, "POST");
	}

	function source_generateMySpaceCodeCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		if ( usr_word != 1 ) {
			document.getElementById('meemix_widget_form').reset();
		}
		document.getElementById(gSourceCode).innerHTML = text;		
		document.getElementById(gSourceCode).select();
	}
	
	function source_generateMySpaceCode(div, sourceType)
	{
		gSourceCode = div+"code";
		document.getElementById(div+"div").style.display = "block";
		this.source_generateM = source_generateMySpaceCodeCallback;	
		if ( document.getElementById('chosen_station_0') != null ) {
			var req = new JSAjaxDoc(this, "source_generateM", 1);
			for ( var i=0; i<10; i++ ) {
				if ( document.getElementById('chosen_station_' + i) != null ) {
					if ( document.getElementById('chosen_station_' + i).checked ) {
						req.addParam("station_id", document.getElementById('chosen_station_' + i).value);
					}
				}
			}
		} else {
			var req = new JSAjaxDoc(this, "source_generateM", 0);
		}
		req.addParam("source_type", sourceType);
		var url = "/source/source_ms_generate_code.php";
		req.send(url, "POST");
	}
	
	function widgets_getVideoStationCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		document.getElementById('video_station_demo').innerHTML = text;
	}
	
	function widgets_getVideoStation(countStation)
	{
		document.getElementById('click_play_img').style.display='block';
		this.widgets_getV = widgets_getVideoStationCallback;	
		var req = new JSAjaxDoc(this, "widgets_getV");
		for ( var i=0; i<countStation; i++ ) {
			if ( document.getElementById('chosen_station_' + i).checked ) {
				req.addParam("station_id", document.getElementById('chosen_station_' + i).value);
			}
		}
		var ts = new Date().getTime();
		var url = "/source/widgets/widget_get_video_station.php?ts=" + ts;
		req.send(url, "GET");
	}
	
	function widgets_getVideoFavoritesCB(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		document.getElementById('video_favorite_demo').innerHTML = text;
	}
	
	function widgets_getVideoFavorites()
	{
		document.getElementById('click_playFav_img').style.display='block';
		this.widgets_getVideoF = widgets_getVideoFavoritesCB;	
		var req = new JSAjaxDoc(this, "widgets_getVideoF");
		var ts = new Date().getTime();
		var url = "/source/widgets/widget_get_video_favorite.php?ts=" + ts;
		req.send(url, "GET");
	}
	
	function source_switchThumbnail(widget, skin, widget_id)
	{
		for ( i=1; i<=2; i++ )
			document.getElementById('widget_' + widget + '_' + i).style.display = "none";
			
		document.getElementById('widget_' + widget + '_' + skin).style.display = "block";
		document.getElementById(widget + '_skin').value = widget_id;
		document.getElementById('widget_' + widget + '_div').style.display = "none";
	}
	
	function widget_getArtistsCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY) {
			return;
		} 
		document.getElementById('div_1').innerHTML = text;
	}
	
	function widget_getArtists()
	{
		this.widget_getACB = widget_getArtistsCB;
		var req = new JSAjaxDoc(this, "widget_getACB");
		var url = '/source/widgets/widgets_get_artist.php';
		req.send(url, "GET");
	}
	
	var widget_run = 0;
	
	function widget_getMeeMixCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY) {
			return;
		} 
		document.getElementById('div_1').innerHTML = text;
	}
	
	function widget_getMeeMix()
	{
		this.widget_getMMCB = widget_getMeeMixCB;
		var req = new JSAjaxDoc(this, "widget_getMMCB");
		var url = '/source/widgets/widgets_get_meemix.php?widget_run=';
		req.send(url, "GET");
	}
	
	function widget_getVideosCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY) {
			return;
		} 
		document.getElementById('div_1').innerHTML = text;
	}
	
	function widget_getVideos()
	{
		this.widget_getVCB = widget_getVideosCB;
		var req = new JSAjaxDoc(this, "widget_getVCB");
		var url = '/source/widgets/widgets_get_video.php';
		req.send(url, "GET");
	}
	
	function widget_getFavoriteVideosCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		$("favorite_box_container").innerHTML= text;
		$("favorite_box_container").style.top = getScrollY();
		$("favorite_box_container").style.display = 'block';
	}
	
	function widget_getFavoriteVideos(offset)
	{
		this.widget_getF = widget_getFavoriteVideosCB;
		var req = new JSAjaxDoc(this, "widget_getF");
		offset = typeof offset == "undefined" ? 0 : offset; 
		req.addParam("offset", offset);
		var url = "/source/widgets/videos/get_favorite_videos.php";
		req.send(url, "POST");
	}
	
	function widget_getAllFavoriteVideosCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
	}
	
	function widget_getAllFavoriteVideos()
	{
		this.widget_getAllF = widget_getAllFavoriteVideosCB;
		var req = new JSAjaxDoc(this, "widget_getAllF");
		var url = "/source/widgets/videos/save_all_favorites.php";
		req.send(url, "POST");
	}
	
	function widgets_orderTab(tab)
	{
		for (i=1; i<=3; i++)
		{
			document.getElementById('widget_tab_' + i).style.fontWeight = "normal";
		}
		document.getElementById('widget_tab_' + tab).style.fontWeight = "bold";
	}
	

	function widget_checkVideoRadio()
	{
		var chosenVal;
		for ( var i=0; i<=1; i++ ) {
			if ( document.getElementById('video_fav_choose_' + i).checked ) {
				chosenVal = i;
			}
		}
		if ( chosenVal == 0 ) {
			widget_getAllFavoriteVideos();
		}
	}
	
	function widget_saveFavoritesCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
	}
	
	function widget_saveFavorites(checkCount, offset, totalVideos)
	{	
		this.widget_saveF = widget_saveFavoritesCB;
		var req = new JSAjaxDoc(this, "widget_saveF");
		var checkedNumber = 0;
		var unCheckedNumber = 0;
		for ( var i=0; i<checkCount; i++ ) {
			if ( document.getElementById('video_' + i).checked ) {
				req.addParam("video_" + checkedNumber, document.getElementById('video_' + i).value);
				checkedNumber++;
			} else {
				req.addParam("video_dis_" + unCheckedNumber, document.getElementById('video_' + i).value);
				unCheckedNumber++;
			}
		}
		
		req.addParam("checked_num", checkedNumber);
		req.addParam("unchecked_num", unCheckedNumber);
		var url = "/source/widgets/videos/save_favorites.php";
		req.send(url, "POST");
		
		if ( totalVideos < 9 ) {
			document.getElementById('favorite_box_container').innerHTML = '';
		} else {
			if ( checkCount == 9 ) {
				widget_getFavoriteVideos(offset + 9);
			} else {
				widget_getFavoriteVideos(0);
			}
		}
	}
	
	function widget_showStationPreview(chosen, stationCount)
	{
		document.getElementById('video_station_div').style.display='none';
		for ( var i=0; i<stationCount; i++ ) {
			document.getElementById('station_preview_' + i).style.display='none';
		}
		document.getElementById('station_preview_' + chosen).style.display='inline';
	}
	
	function widget_showFavoritePreview(chosen)
	{
		for ( var i=0; i<=1; i++ ) {
			document.getElementById('favorite_preview_' + i).style.display='none';
		}
		document.getElementById('favorite_preview_' + chosen).style.display='inline';
	}
	
	function sourceInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_source_bar', 'mee_source_div');
		setBarBold('widgets_bar');
		document.title = "Add these free music widgets to your blog or website | MeeMix Internet Radio";
		rp_resetRightBottom();
	}
	
	
	//
	//
	//	Banners / Logo
	//
	//
	
	function banners_generateCode(innerDiv, img, width, height, url)
	{
		var code = "<a href='http://"+url+"/?banner="+img+"'><img border='0' width='"+width+"' height='"+height+"' src='http://"+url+img+"'></a>";
		document.getElementById(innerDiv).value = code;
		document.getElementById(innerDiv).select();
	}
	
	function bannersInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_source_bar', 'mee_source_div');
		setBarBold('banners_bar');
		document.title = "Free widgets to add to your blog or website - www.meemix.com";
		rp_resetRightBottom();
	}
	
	function logoInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_source_bar', 'mee_source_div');
		setBarBold('logo_bar');
		document.title = "Free widgets to add to your blog or website - www.meemix.com";
		rp_resetRightBottom();
	}
	
	//
	//
	//	Help Screens
	//
	//
	
	function OverJoinBtn()
	{
		document.getElementById('join_the_magic').style.display = "none";
		document.getElementById('join_the_magic_over').style.display = "block";
		//document.getElementById(img).src = "/listeners/help/img/join_btn_over.gif";
	}
	
	function OutJoinBtn()
	{
		document.getElementById('join_the_magic').style.display = "block";
		document.getElementById('join_the_magic_over').style.display = "none";
	}
	
	//	top 100 page
	
	function topGetTracksCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function topGetTracks(genre, offset)
	{
		this.topG = topGetTracksCallback;	
		var req = new JSAjaxDoc(this, "topG");
		
		if ( typeof offset == 'undefined' || offset  == null ) {
			offset = 0;
		}
		req.addParam("offset", offset);
				
		if (document.getElementById('t1_genre') != null)
			req.addParam("genre", document.getElementById('t1_genre').value);
		else
			req.addParam("genre",0);
		
		if (document.getElementById('t1_filter') != null)
			req.addParam("filter", document.getElementById('t1_filter').value);
		else
			req.addParam("filter",0);

		if (document.getElementById('artist_search') != null)
			req.addParam("searchValue", document.getElementById('artist_search').value.toLowerCase());
		else
			req.addParam("searchValue","");
		
		var url = "/top_100/top_get_tracks.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function top100_switchGenresCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}

	function top100_switchGenres(count, j, genre, key)
	{
		this.topSG = top100_switchGenresCallback;	
		var req = new JSAjaxDoc(this, "topSG");

		for ( i=0; i<count; i++ )
		{
			if ( document.getElementById('top100_genre_' + i) != null ) 
				document.getElementById('top100_genre_' + i).style.fontWeight = "normal";
		}
		document.getElementById('top100_genre_' + j).style.fontWeight = "bold";		
		document.getElementById("t1_genre").value = genre;
		document.getElementById('chosen_genre').innerHTML = key;
		
		if (document.getElementById('t1_filter') != null)
			req.addParam("filter", document.getElementById('t1_filter').value);
		else
			req.addParam("filter",2);
		req.addParam("offset", 0);
		req.addParam("genre", genre);
		if (document.getElementById('artist_search') != null)
			req.addParam("searchValue", document.getElementById('artist_search').value.toLowerCase());
		else
			req.addParam("searchValue","");
			
		var url = "/top_100/top_get_tracks.php";
		req.send(url, "GET");
		
	}

	function top100_switchFilter(filter)
	{
		this.topSF = top100_switchGenresCallback;	
		var req = new JSAjaxDoc(this, "topSF");

		for ( i=0; i<5; i++ )
		{
			if ( document.getElementById('top_tab_' + i) != null ) 
				document.getElementById('top_tab_' + i).style.fontWeight = "normal";
		}
		document.getElementById('top_tab_' + filter).style.fontWeight = "bold";		
		
		var myDate=new Date();
		
		if (filter == 0) {
			myDate.setDate(myDate.getDate()-1);
			myDate = (myDate.getMonth()+1)+'.'+myDate.getDate()+'.'+myDate.getFullYear();
		}
		else if (filter == 1) {
			myDate.setDate(myDate.getDate()-7);
			myDate = (myDate.getMonth()+1)+'.'+myDate.getDate()+'.'+myDate.getFullYear();
		}
		else if (filter == 2) {
			myDate.setDate(myDate.getDate()-30);
			myDate = (myDate.getMonth()+1)+'.'+myDate.getDate()+'.'+myDate.getFullYear();
		}
		else {
			myDate = '';
		}
		document.getElementById('top_100_date').innerHTML = myDate;
		document.getElementById('t1_filter').value = filter;
		req.addParam("filter", filter);
		if (document.getElementById('t1_genre') != null)
			req.addParam("genre", document.getElementById("t1_genre").value);
		else
			req.addParam("genre",0);
		req.addParam("searchValue", "");
		req.addParam("offset", 0);
		if (document.getElementById('artist_search') != null)
			req.addParam("searchValue", document.getElementById('artist_search').value.toLowerCase());
		else
			req.addParam("searchValue","");
			
		var url = "/top_100/top_get_tracks.php";
		req.send(url, "GET");
		
	}

	function top_100AddThoughtCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}	
		document.getElementById('middle_content').innerHTML = text;
		thoughts_changeTextArea(2);
	}

	function top_100AddThought(album_id, type)
	{
		this.topAT = top_100AddThoughtCallback;	
		var req = new JSAjaxDoc(this, "topAT");
		req.addParam("album_id", album_id);
		req.addParam("type", type);
		var url = "/thoughts/thoughts_add_new_thought.php";
		req.send(url, "GET");		
	}

	function top_100_getMeepsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('middle_content').innerHTML = text;
		meeps_init();
	}
	
	function top_100_getMeeps(artist_id, meeps_count)
	{
		this.meeps_getTM = top_100_getMeepsCallback;			
		var req = new JSAjaxDoc(this, "meeps_getTM");
		
		req.addParam("artist_id", artist_id);
		req.addParam("meeps_count", meeps_count);
		
		var url = "/meeps/meeps.php";
		req.send(url, "GET");
	}
	
	function topGetGeneresCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}	
		eval(text);
	}
	
	function top100Checkkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (keynum == 13 && whichArtist == -1)
		{
			targ.blur();
			topGetTracks(0, 0);
		}
		else if ( keynum != 38 && keynum != 40 && keynum != 13 && keynum != 17 && keynum != 18 && keynum != 16 && keynum != 37)
		{
			suggestArtists(targ.id, 'top_100_suggestions', 0, topGetTracks);
		}
		else
		{
			chooseArtist(targ.id, 'top_100_suggestions', keynum, topGetTracks);
		}
	}
	
	function top100Init()
	{
		updateSuggestions = true;
		loadLeftPanel('/fun_zone/fun_zone.php');
		//document.getElementById('genre_sort').value = 0;
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('top_100_bar');
		document.title = "The Top 100 rated songs at MeeMix";
		rp_resetRightBottom();
		mp_initPlayer();
		whichArtist = -1;
		page = 1;
		//topGetGeneres();
		//topGetTracks(0);
	}
	
	//
	//
	//	Member search
	//
	//
	
	function memberGetMembersByTrack(trackId)
	{
		memberResetSearch(false);
		searchTrackId = trackId;
		loadMiddlePanel('/member_search/member_search.php?init=0&track_id='+searchTrackId,'memberSearchInit()');
	}

	function memberGetMembersByArtist(artistId)
	{
		memberResetSearch(false);
		searchArtistId = artistId;
		loadMiddlePanel('/member_search/member_search.php?init=0&artist_id='+searchArtistId,'memberSearchInit()');
	}
	
	function memberGetMembersCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}	
		document.getElementById('div_1').innerHTML = text;
		if (gMemberUid != 0)
		{
			document.getElementById('member_uid').value = gMemberUid;
		}
		if (gNewArrivalMember == 1)
		{
			document.getElementById('link_1').style.fontWeight = "normal"; 
			document.getElementById('link_3').style.fontWeight = "bold"; 
			document.getElementById('tab_value').value = 3;
		}
		if (gMemberToView != null)
			document.getElementById('member_search_type').innerHTML = "> Members who viewed your profile";
		else if (gMemberViews != null)
			document.getElementById('member_search_type').innerHTML = "> Members I Visited";
		else if (gMemberSimilars != null)
			document.getElementById('member_search_type').innerHTML = "> Music Soulmates";
		else if (gMemberStationId != null)
			document.getElementById('member_search_type').innerHTML = "> People with similar stations";
			
		//else document.getElementById('member_search_type').innerHTML = "";
		gMemberUid = 0;
		members_resetValues();
	}
	
		var ran_unrounded = Math.random()*10;
		var gRandom = Math.floor(ran_unrounded);
		if ( gRandom == 0 )
			gRandom = 1;
		
	function memberGetMembers(offset, method)
	{
		var lRandom = gRandom;
		
		if ( document.getElementById('member_search_type') != null && searchArtistId == 0 && searchTrackId == 0)
			document.getElementById('member_search_type').innerHTML = "";
		
		if ( document.getElementById('ms_sex') != null )
		{
			for (i=0; i< document.getElementsByName("ms_sex").length; i++)
			{
				if (document.advanced_search_form.ms_sex[i].checked == true)
					sex_value = document.advanced_search_form.ms_sex[i].value;
			}	
		}
		else
			sex_value = 0;
		this.memberGetM = memberGetMembersCallback;	
		var req = new JSAjaxDoc(this, "memberGetM");
		
		req.addParam("offset", offset);	
		req.addParam("random_number", lRandom);	
	
		
		if (gNewArrivalMember == 1)
		{
			req.addParam("tab_value",3);
		}
		else
		{
			if (document.getElementById('tab_value') != null)
			{
				req.addParam("tab_value", document.getElementById('tab_value').value);	
			}
			else
			{
				req.addParam("tab_value",0);
			}
		}
		if (gCountryCode != null)
		{
			req.addParam("country",gCountryCode);
		}
		else
		{
			if (document.getElementById('ms_country') != null)
			{
				req.addParam("country", document.getElementById('ms_country').value);
			}	
			else
				req.addParam("country",0);
		}
		if (document.getElementById('ms_states') != null)
			req.addParam("states", document.getElementById('ms_states').value);	
		else
			req.addParam("states",0);
		req.addParam("sex", sex_value);
		if (document.getElementById('ms_start_age') != null)
			req.addParam("start_age", document.getElementById('ms_start_age').value);	
		else
			req.addParam("start_age",0);
		if (document.getElementById('ms_end_age') != null)	
			req.addParam("end_age", document.getElementById('ms_end_age').value);	
		else
			req.addParam("end_age",0);
		
		if (gMemberUid != 0)
		{
			req.addParam("member_uid", gMemberUid.toLowerCase());
		}
		else
		{
			if (document.getElementById('member_uid') != null)
				req.addParam("member_uid", document.getElementById('member_uid').value.toLowerCase());	
			else
				req.addParam("member_uid","");
		}
		if (document.getElementById('ms_genre_num') != null)	
		{
			for (i=1; i<=document.getElementById('ms_genre_num').value; i++)
			{
				if (document.getElementById('ms_genre_'+i).checked==true)
					req.addParam('genre_'+i,document.getElementById('ms_genre_'+i).value);
			}
			req.addParam("genre_num", document.getElementById('ms_genre_num').value);	
		}
		
		if (searchTrackId != null)
			req.addParam("track_id", searchTrackId);
		if (searchArtistId != null)
			req.addParam("artist_id", searchArtistId);
		if (gMemberBroadcast == 1)
			req.addParam("broadcast_search", 1);
		else
			req.addParam("broadcast_search", 0);
		
		if ( document.getElementById('member_viewers') != null )	
			if ( document.getElementById('member_viewers').value != 0 )
				gMemberToView = document.getElementById('member_viewers').value;
		if ( document.getElementById('member_views') != null )	
			if ( document.getElementById('member_views').value != 0 )
				gMemberViews = document.getElementById('member_views').value;
		if ( document.getElementById('member_similars') != null )	
			if ( document.getElementById('member_similars').value != 0 )
				gMemberSimilars = document.getElementById('member_similars').value;
		if ( document.getElementById('member_station_id') != null )	
			if ( document.getElementById('member_station_id').value != 0 )
				gMemberStationId = document.getElementById('member_station_id').value;		
		if (gMemberToView != null) req.addParam("member_viewers", gMemberToView);	
		if (gMemberViews != null) req.addParam("member_views", gMemberViews);
		if (gMemberSimilars != null) req.addParam("member_similars", gMemberSimilars);	
		if (gMemberStationId != null) req.addParam("member_station_id", gMemberStationId);	
		var url = "/member_search/member_get_members.php";
		
		method = typeof method == "undefined" ? "GET" : method; 
		req.send(url, method);
		
		return false;
	}
	
	function member_chosen(bgImage_over, div)
	{
		//document.getElementById(bgImage).style.display = "none";
		document.getElementById(bgImage_over).style.display = "block";
		document.getElementById(div).style.borderColor = "#434343";
	}
	
	function member_unchosen(bgImage_over, div)
	{
		document.getElementById(bgImage_over).style.display = "none";
		document.getElementById(div).style.borderColor = "#BABABA";
		//document.getElementById(bgImage).style.display = "block";
	}
	
	function memberChangeTab(div,tab_value)
	{
		gNewArrivalMember = 0;
		for (i=1; i<=4; i++)
		{
			document.getElementById('link_'+i).style.fontWeight = "normal"; 
		}
		document.getElementById(div).style.fontWeight = "bold"; 
		document.getElementById('tab_value').value = tab_value; 
		if (tab_value == 1)
			memberResetSearch(false);
		memberGetMembers(0);
	}
	
	function memberCheckkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			memberGetMembers(0);
		}
	}
	
	function MemberGetStatesCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		eval(text);
		var length = document.getElementById('ms_states').length;
		document.getElementById('ms_states').options[length] = new Option('Never Mind', '0', true, true);
	}
	
	function MemberGetStates()
	{	
		document.getElementById('ms_states').length = 0;
		var country = document.getElementById('ms_country').value;
		gCountryCode = country;
		if (country != "0")
		{
			this.MemberGetS = MemberGetStatesCallback;			
			var req = new JSAjaxDoc(this, "MemberGetS");
			req.addParam("country", country);
			req.addParam("field", 'ms_states');
			var url = "/profile/profile_get_states.php";
			req.send(url, "POST");
		}
		else
		{
			document.getElementById('ms_states').options[length] = new Option('Never Mind', '0');
		}
	}
	
	function memberResetSearch(init)
	{
		if (document.getElementById('member_search_type') != null)
			document.getElementById('member_search_type').innerHTML = "";
		if (document.getElementById('ms_country') != null)
			document.getElementById('ms_country').selectedIndex = document.getElementById('ms_country').length-1;
		if (document.getElementById('ms_states') != null)
			document.getElementById('ms_states').selectedIndex = document.getElementById('ms_states').length-1;
		if (document.getElementById('ms_start_age') != null)
			document.getElementById('ms_start_age').selectedIndex = 0;
		if (document.getElementById('ms_end_age') != null)
			document.getElementById('ms_end_age').selectedIndex = 0;
		if (document.getElementById('ms_sex') != null)
			document.advanced_search_form.ms_sex[0].checked = true;
		if (document.getElementById('ms_genre_num') != null)	
			for (i=1; i<=document.getElementById('ms_genre_num').value; i++)
				document.getElementById('ms_genre_'+i).checked = false;
		if (document.getElementById('member_uid') != null)
			document.getElementById('member_uid').value = "";
		if (document.getElementById('tab_value') != null)
			document.getElementById('tab_value').value = 1;
		if (document.getElementById('member_viewers') != null)	
			document.getElementById('member_viewers').value = 0;
		if (document.getElementById('member_views') != null)	
			document.getElementById('member_views').value = 0;
		if (document.getElementById('member_similars') != null)	
			document.getElementById('member_similars').value = 0;
		if (document.getElementById('member_station_id') != null)	
			document.getElementById('member_station_id').value = 0;
		searchArtistId = 0;
		gMemberBroadcast = 0;
		gNewArrivalMember = 0;
		
		gCountryCode = null;
		gMemberToView = null;
		gMemberViews = null;
		gMemberSimilars = null;
		gMemberStationId = null;
		if (init != false)
		{
			memberChangeTab('link_1',1)
		}
		
	}
	
	function members_resetValues()
	{
		//searchArtistId = 0;
		gMemberBroadcast = 0;
		gNewArrivalMember = 0;
		//gCountryCode = null;
		//gMemberToView = null;
	}
	
	function members_startSearch()
	{
		memberGetMembers(0);
	}	
		
	function memberSearchPageInit()
	{
		gFunZoneStatus = 1;
		loadLeftPanel('/member_search/member_search_left.php');
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('member_search_bar');
		document.title = "Search for your musical soul mates.  Find people, meet people.";
		rp_resetRightBottom();
	}
	
	function memberSearchInit()
	{
		gFunZoneStatus = 1;
		loadLeftPanel('/member_search/member_search_left.php');
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('member_search_bar');
		document.title = "Search for your musical soul mates.  Find people, meet people.";
		rp_resetRightBottom();
		memberGetMembers(0, "POST");
	}
	
	//
	//
	//	New Releases
	//
	//
	
	function new_releases_switchGenres(count, j, genre, key)
	{
		this.topSG = top100_switchGenresCallback;	
		var req = new JSAjaxDoc(this, "topSG");

		for ( i=0; i<count; i++ )
		{
			if ( document.getElementById('new_releases_genre_' + i) != null ) 
				document.getElementById('new_releases_genre_' + i).style.fontWeight = "normal";
		}
		document.getElementById('new_releases_genre_' + j).style.fontWeight = "bold";		
		document.getElementById("n1_genre").value = genre;
		document.getElementById('new_chosen_genre').innerHTML = key;
		
		req.addParam("offset", 0);
		req.addParam("genre", genre);
		if (document.getElementById('artist_search') != null)
			req.addParam("searchValue", document.getElementById('artist_search').value.toLowerCase());
		else
			req.addParam("searchValue","");
			
		var url = "/new_releases/releases_get_releases.php";
		req.send(url, "GET");
		
	}

	function ReleasesGetReleasesCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}				
		document.getElementById('div_1').innerHTML = text;
	}
	
	function ReleasesGetReleases(offset)
	{
		this.ReleasesGetR = ReleasesGetReleasesCallback;	
		var req = new JSAjaxDoc(this, "ReleasesGetR");
		if ( offset == null || typeof offset == 'undefined' ) {
			offset = 0;
		}
		req.addParam("offset", offset);

		if (document.getElementById('n1_genre') != null)
			req.addParam("genre", document.getElementById('n1_genre').value);
		else
			req.addParam("genre",0);
		if (document.getElementById('artist_search') != null)
			req.addParam("searchValue", document.getElementById('artist_search').value.toLowerCase());
		else
			req.addParam("searchValue","");
		var url = "/new_releases/releases_get_releases.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function releaseCheckkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (keynum == 13 && whichArtist == -1)
		{
			targ.blur();
			ReleasesGetReleases(0);
		}
		else if ( keynum != 38 && keynum != 40 && keynum != 13 && keynum != 17 && keynum != 18 && keynum != 16 && keynum != 37)
		{
			suggestArtists(targ.id, 'new_releases_suggestions', 0, ReleasesGetReleases);
		}
		else
		{
			chooseArtist(targ.id, 'new_releases_suggestions', keynum, ReleasesGetReleases);
		}
	}
	
	function newReleasesInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('new_releases_bar');
		document.title = "Check out the newest releases at MeeMix";
		rp_resetRightBottom();
		mp_initPlayer();
		updateSuggestions = true;
		whichArtist = -1;
		page = 1;
	}
	
	//
	//
	//	Audience
	//
	//
	
	function getAudiencesCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}
				
		document.getElementById('audience_div').innerHTML = text;
		if (gStationOnlineStatus != 9)
		{
			if (gStationOnlineStatus == 1)
			{
				document.getElementById('audience_1').style.fontWeight = "normal";
				document.getElementById('audience_2').style.fontWeight = "bold";
			}
			else if (gStationOnlineStatus == 0)
			{
				document.getElementById('audience_2').style.fontWeight = "normal";
				document.getElementById('audience_1').style.fontWeight = "bold";
			}	
			
		}
	}
	
	function getAudiences(member, offset)
	{	
		this.getA = getAudiencesCallback;	
		var req = new JSAjaxDoc(this, "getA");
		if (document.getElementById('online_status') != null)
			req.addParam("online_status", document.getElementById('online_status').value);
		else
			req.addParam("online_status",0);
		if (document.getElementById('search') != null)
		{
			req.addParam("searchValue",document.getElementById('search').value);
			if (document.getElementById('search').value != "")
				gStationId = 0;
		}
		else
			req.addParam("searchValue",0);
		if (document.getElementById('user_listeners') != null)
		{
			for (i=0; i< document.user_listeners.elements.length; i++)
			{
				if (document.user_listeners.elements[i].checked == true)
				{
					req.addParam(document.user_listeners.elements[i].name, document.user_listeners[i].value);
				}		
			}
			req.addParam("length", document.user_listeners.elements.length);
		}
		else
		{
			req.addParam("length", 0);
		}
		if (gStationUid != null)
			member = gStationUid;
		req.addParam("member",member);
		req.addParam("offset",offset);
		req.addParam("station_id", gStationId);
		req.addParam("online_station", gStationOnlineStatus);
		var url = "/audience/get_audience.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function AudienceSelectAll()
	{
		for (i=0; i< document.user_listeners.elements.length; i++)
		{
			document.user_listeners.elements[i].checked = true;
		}
	}
	
	function audienceGetOnline(div, onlineStatus)
	{
		gStationOnlineStatus = 9;
		for (i=1; i<=2; i++)
		{
			document.getElementById('audience_'+i).style.fontWeight = "normal";
		}
		document.getElementById(div).style.fontWeight = "bold";
		document.getElementById('online_status').value = onlineStatus;
		getAudiences('0', 0);
	}
	
	function audienceCheckKey(e, member)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			getAudiences(member, 0);
		}
	}
	
	function audiencePageInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('audience_bar');
		document.title = "Meet the crowd - The MeeMix Audience ";
		rp_resetRightBottom();
	}
	
	function audienceInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('audience_bar');
		document.title = "Meet the crowd - The MeeMix Audience ";
		getAudiences('0', 0);
		rp_resetRightBottom();
	}
	
	//
	//
	//	Thought 
	//
	//
	var gThoughtId = 0;
	
	
	function thoughts_orderTab(div, order_type)
	{
		for (i=1; i<=5; i++)
		{
			document.getElementById('thought_tab_' + i).style.fontWeight = "normal";
		}
		document.getElementById(div).style.fontWeight = "bold";
		document.getElementById('thoughts_order').value = order_type;
		thoughts_getThoughts(0);
	}
	
	function thoughts_typeChange(type)
	{
		document.getElementById('thoughts_type').value = type;
		thoughts_getThoughts(0);
	}
	
	function thoughts_getThoughtsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('thoughts_div').innerHTML = text;
	}
	
	function thoughts_getThoughts(offset)
	{	
		this.thoughts_getT = thoughts_getThoughtsCallback;			
		var req = new JSAjaxDoc(this, "thoughts_getT");
		
		if (document.getElementById('thoughts_order') != null)
			req.addParam("order", document.getElementById('thoughts_order').value);
		else
			req.addParam("order", 0);
			
		if (document.getElementById('thoughts_type') != null)
			req.addParam("type", document.getElementById('thoughts_type').value);
		else
			req.addParam("type", 0);

		if (document.getElementById('thought_search') != null)
			req.addParam("search", document.getElementById('thought_search').value.toLowerCase());
		else
			req.addParam("search", "");
		
/*		if (type != null)
			gThoughtType = type;
		else
			gThoughtType = 0;
*/			
//		req.addParam("type", gThoughtType);		
			
		/*if (gThoughtType != 0)
		{
			req.addParam("type", gThoughtType);	
			//document.getElementById('thought_type').value = gThoughtType;	
		}
		else
		{
			if (document.getElementById('thought_type') != null)
				req.addParam("type", document.getElementById('thought_type').value);
			else
				req.addParam("type", 0);
		}*/	
		
		//gThoughtType = 0;	
		req.addParam("offset", offset);
		var url = "/thoughts/thoughts_get_thoughts.php";
		req.send(url, "GET");
		return false;
	}
	
	function thoughts_getMemberThoughtCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('middle_content').innerHTML = text;
	}
	
	function thought_getMemberSingleThought(thoughtId, thoughtUid, type, sort, offset)
	{
		gThoughtId = thoughtId;
		thoughts_getMemberThought(1, thoughtId, thoughtUid, null, type, sort, offset);
		return false;
	}
	
	function thoughts_getMemberThought(display_type, thoughtId, thoughtUid, albumId)
	{	
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('thoughts_bar');
		loadLeftPanel('/fun_zone/fun_zone.php');
		rp_resetRightBottom();
		this.thoughts_getM = thoughts_getMemberThoughtCallback;			
		var req = new JSAjaxDoc(this, "thoughts_getM");
		req.addParam("display_type", display_type);
		if (display_type == 1)
			req.addParam("thought_id", gThoughtId);
		else
			req.addParam("thought_id", thoughtId);
		req.addParam("thought_uid", thoughtUid);
		req.addParam("album_id", albumId);
		var url = "/thoughts/thoughts_get_member_thought.php";
		req.send(url, "GET");
	}
	
	function journey_getMemberSingleThought(thoughtId, thoughtUid, add)
	{	
		gThoughtId = thoughtId;
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('thoughts_bar');
		loadLeftPanel('/fun_zone/fun_zone.php');
		this.thoughts_getM = thoughts_getMemberThoughtCallback;			
		var req = new JSAjaxDoc(this, "thoughts_getM");
		req.addParam("display_type", 1);
		req.addParam("thought_id", gThoughtId);
		req.addParam("thought_uid", thoughtUid);
		if (add == true)
			req.addParam("add", true);
		var url = "/thoughts/thoughts_get_member_thought.php";
		req.send(url, "GET");
	}
	
	function thoughts_getMembersThoughtsByAlbum(display_type, albumId)
	{	
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('thoughts_bar');
		loadLeftPanel('/fun_zone/fun_zone.php');
		this.thoughts_getMembersT = thoughts_getMemberThoughtCallback;			
		var req = new JSAjaxDoc(this, "thoughts_getMembersT");
		req.addParam("display_type", display_type);
		req.addParam("album_id", albumId);
		var url = "/thoughts/thoughts_get_member_thought.php";
		req.send(url, "GET");
		
	}
	
	function thoughts_addNewThoughtCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		
		document.getElementById('middle_content').innerHTML = text;
	}
	
	function thoughts_addNewThought(albumId, rp_state)
	{			
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('thoughts_bar');
		loadLeftPanel('/fun_zone/fun_zone.php');
		rp_resetRightBottom();
		this.thoughts_addN = thoughts_addNewThoughtCallback;			
		var req = new JSAjaxDoc(this, "thoughts_addN");
		if (typeof rp_state != 'undefined') {
			req.addParam("rp_state", rp_state);
		}
		req.addParam("album_id", albumId);
		var url = "/thoughts/thoughts_add_new_thought.php";
		req.send(url, "GET");
	}
	
	function thoughts_rateThoughtCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}		
	}
	
	function thoughts_rateThought(thoughtId, totalRater, avgRank)
	{
		thoughts_disableRating();
		this.thoughts_rateT = thoughts_rateThoughtCallback;			
		var req = new JSAjaxDoc(this, "thoughts_rateT");
		var thoughtRating = 0;
		if (document.getElementById('thought_rating') != null)
		{
			for (i=0; i < document.get_thoughts_form.thought_rating.length; i++)
			{
				if (document.get_thoughts_form.thought_rating[i].checked==true)
					thoughtRating = document.get_thoughts_form.thought_rating[i].value;
			}	
		}
		else
			thoughtRating = 0;
		req.addParam("thought_id", thoughtId);
		req.addParam("total_rater", totalRater);
		req.addParam("avg_rank", avgRank);
		req.addParam("thought_rating", thoughtRating);
		var url = "/thoughts/thoughts_rate_thought.php";
		req.send(url, "POST");
	}
	
	function thoughts_disableRating()
	{
		document.getElementById('rate_button').style.display = "none";
		document.getElementById('rate_button_disable').style.display = "block";
	}
	
	function thoughts_addThought()
	{	
		//document.getElementById('thought_form').submit();
		document.thought_form.submit();
	}
	
	function thoughts_markBody()
	{
		document.getElementById('thought_body_insert').value = 1;
	}
	
	function thoughts_checkFields()
	{
		document.getElementById('thought_body_text').blur();
		if (document.getElementById('thought_body_insert').value == 0)
		{
			document.getElementById('thought_body_text').value = "";
		}
		if ( (document.getElementById('video_div').style.display == "block") && ( (document.getElementById('thought_link').value == 0) || (document.getElementById('thought_link').value == 'Paste the \'Embed\' code from the YouTube video here.')) )
		{
			document.getElementById('thought_msg').innerHTML = "Please check your youtube code";
			//document.getElementById('popup_msg_thoughts').style.display = "block";
		}
		else if (document.getElementById('thought_heading').value == "")
		{
			document.getElementById('thought_msg').innerHTML = "Please fill in 'In Short'";
			//document.getElementById('popup_msg_thoughts').style.display = "block";
		}
		else
		{
			thoughts_addThought()
			document.getElementById('add_enable').style.display = "none";
			document.getElementById('add_disable').style.display = "block";
		}
	}
	
	function thoughts_add_message(msg)
	{
		document.getElementById('thought_msg').innerHTML = msg;
		document.getElementById('add_enable').style.display = "block";
		document.getElementById('add_disable').style.display = "none";
	}
	
	function thoughts_closePopup()
	{
		document.getElementById('popup_msg_thoughts').style.display = "none";
	}
	
	function thoughts_outMedia(media_num)
	{
		if ( document.getElementById('thought_add_type').value != media_num ) {
			document.getElementById('media_btn_down_' + media_num).style.display = 'block';
			document.getElementById('media_btn_over_' + media_num).style.display = 'none';
		}
	}
	
	function thoughts_overMedia(media_num)
	{
		if ( document.getElementById('thought_add_type').value != media_num ) {
			document.getElementById('media_btn_down_' + media_num).style.display = 'none';
			document.getElementById('media_btn_over_' + media_num).style.display = 'block';
		}
	}
	
	function thoughts_changeDiv(div, type, button_on, button_off)
	{
		for (i=1; i<=3; i++)
		{
			document.getElementById("media_btn_over_"+i).style.display = "none";
			document.getElementById("media_btn_selected_"+i).style.display = "none";
			document.getElementById("media_btn_down_"+i).style.display = "block";
		}
		document.getElementById(button_off).style.display = "none";
		document.getElementById(button_on).style.display = "block";
		
		document.getElementById('thought_add_type').value = type;
		if (type == 3)
			document.getElementById('thought_desc').style.display = "none";
		else
			document.getElementById('thought_desc').style.display = "block";
		document.getElementById('image_div').style.display = "none";
		document.getElementById('video_div').style.display = "none";
		document.getElementById('album_div').style.display = "none";
		document.getElementById(div).style.display = "block";
	}
	
	function thoughts_changeResultDisplay(display, title)
	{
		document.getElementById('albums_display').style.display = "none";
		document.getElementById('artists_display').style.display = "none";
		document.getElementById('album_title').style.fontWeight = "normal";
		document.getElementById('artist_title').style.fontWeight = "normal";
		
		document.getElementById(display).style.display = "block";
		document.getElementById(title).style.fontWeight = "bold";
	}
	
	function thoughts_CheckKey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			thoughts_searchArtist();
		}
	}
	
	function thoughts_searchCheckKey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			thoughts_getThoughts(0);
		}
	}
	
	function thoughts_selectAlbum(name, id, artist_name)
	{
		document.getElementById('selected_album').innerHTML = name+" by "+artist_name;
		//document.getElementById('selected_artist').innerHTML = " by "+artist_name;
		document.getElementById('selected_album_cover').innerHTML = "<img width='175' height='175' src='/img/album_image-"+ id +".jpeg'>";
		document.getElementById('thought_album_id').value = id;
	}
	
	function thoughts_rateHotCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		//alert('9');	
		//document.getElementById('comments_count_'+usr_word).innerHTML = "("+text+")";
	}
	
	function thoughts_rateHot(thought_id, thought_rate)
	{
		if ( thought_rate == 1 ) {
			document.getElementById('change_rate_' + thought_id).style.display = 'inline';
			document.getElementById('rate_' + thought_id).style.display = 'none';
		}
		else if ( thought_rate == 0 ) {
			document.getElementById('rate_' + thought_id).style.display = 'inline';
			document.getElementById('change_rate_' + thought_id).style.display = 'none';
		}
	
		this.thoughts_rateH = thoughts_rateHotCallback;			
		var req = new JSAjaxDoc(this, "thoughts_rateH", thought_id);
		req.addParam("thought_id", thought_id);
		req.addParam("thought_rate", thought_rate);
		var url = "/thoughts/thought_rate.php";
		req.send(url, "POST");
	}
	
	function thoughts_getThoughtsCountCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('comments_count_'+usr_word).innerHTML = "("+text+")";
		document.getElementById('comments_count_container_'+usr_word).style.display = "inline";
	}
	
	function thoughts_getThoughtsCount(thought_id)
	{
		this.thoughts_getTh = thoughts_getThoughtsCountCallback;			
		var req = new JSAjaxDoc(this, "thoughts_getTh", thought_id);
		req.addParam("thought_id", thought_id);
		var url = "/thoughts/thoughts_get_comments_count.php";
		req.send(url, "POST");
	}
	
	function thoughts_getCommentsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('comments_'+usr_word).innerHTML = text;
		document.getElementById('comments_'+usr_word).style.display = 'block';
		thoughts_getThoughtsCount(usr_word);
	}
	
	function thoughts_getComments(thought_id)
	{
		this.thoughts_getC = thoughts_getCommentsCallback;			
		var req = new JSAjaxDoc(this, "thoughts_getC", thought_id);
		req.addParam("thought_id", thought_id);
		var url = "/thoughts/thoughts_get_comments.php";	
		req.send(url, "POST");
	}
	
	function thoughts_addCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		thoughts_getComments(text)
	}
	
	function thoughts_addComment(thoughtId, i, thoughtUid, thoughtHeading)
	{	
		document.getElementById('thought_id_hidden').value = thoughtId;
		document.getElementById('comment_box_' + i).style.display = "none";
		document.getElementById('add_comment_' + i).innerHTML = "Add a comment";
		this.thoughts_addC = thoughts_addCommentCallback;			
		var req = new JSAjaxDoc(this, "thoughts_addC");
		req.addParam("thought_id", thoughtId);
		req.addParam("thought_uid", thoughtUid);
		req.addParam("thought_heading", thoughtHeading);
		req.addParam("comment_heading", document.getElementById('comment_heading_' + i).value);
		if (document.getElementById('thought_comment_insert').value == 1)
		{
			document.getElementById('comment_body_' + i).blur();
			req.addParam("comment_body", document.getElementById('comment_body_' + i).value);
		}
		else
			req.addParam("comment_body", "");
		var url = "/thoughts/thoughts_add_comment.php";
		req.send(url, "POST");
	}
	
	function thoughts_markComment()
	{
		document.getElementById('thought_comment_insert').value = 1;
	}
	/*function thought_closeCommentMsg()
	{
		document.getElementById('thought_add_comment').style.display = "none";
	}*/
	
	function thoughts_commentBox(div, txtDiv)
	{
		if ( document.getElementById(div).style.display == 'none' ) {
			document.getElementById(div).style.display = 'block';
			document.getElementById(txtDiv).innerHTML = 'Close';
		} else {
			document.getElementById(div).style.display = 'none';
			document.getElementById(txtDiv).innerHTML = 'Add a comment';
		}
	}
	
	function thoughts_searchArtistCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	

		document.getElementById('album_div_res').innerHTML = text;
	}
	
	function thoughts_searchArtist()
	{	
		//document.getElementById('thought_chosen_album').style.display = "none";
		document.getElementById('album_div_res').style.display = "block";
		if (document.getElementById('search_by') != null)
		{
			for (i=0; i < document.thought_form.search_by.length; i++)
			{
				if (document.thought_form.search_by[i].checked==true)
				{
					search_by = document.thought_form.search_by[i].value;
				}
			}	
		}
		else
			search_by = 0;
		this.thoughts_searchA = thoughts_searchArtistCallback;	
		var req = new JSAjaxDoc(this, "thoughts_searchA");		
		req.addParam("thought_search", document.getElementById('thought_search').value);
		req.addParam("search_by", search_by);
		var url = "/thoughts/thoughts_get_similars.php";
		req.send(url, "POST");
			
	}
	
	function thoughts_getAlbumsByArtistCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			
			return;
		}	
		document.getElementById('album_div_res').innerHTML = text;
	}
	

	function thoughts_getAlbumsByArtist(artistId)
	{	
		document.getElementById('album_div_res').style.display = "block";
		this.thoughts_getA = thoughts_getAlbumsByArtistCallback;	
		var req = new JSAjaxDoc(this, "thoughts_getA");		
		req.addParam("artist_id", artistId);
		var url = "/thoughts/thoughts_get_albums_by_artist.php";
		req.send(url, "POST");
	}
	
	function thoughts_getPhotoCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			
			return;
		}
		eval(text);
	}
	
	function thoughts_getPhoto(thought_id)
	{
		this.thoughts_getP = thoughts_getPhotoCallback;
		var req = new JSAjaxDoc(this, "thoughts_getP");
		req.addParam("thought_id", thought_id);
		var url = "/thoughts/thought_get_photo.php";
		req.send(url, "POST");
	}
	
	function thoughts_deleteCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			
			return;
		}
		
		//thoughts_getThoughts(0, document.getElementById('thought_type').value);
		thoughts_getThoughts(0, gThoughtType);
	}
	
	function thoughts_delete(thought_id)
	{
		
		this.thoughts_d = thoughts_deleteCallback;
		var req = new JSAjaxDoc(this, "thoughts_d");
		req.addParam("thought_id", thought_id);
		var url = "/thoughts/thought_delete.php";
		req.send(url, "POST");
	}
	
	function thoughts_showComment(div)
	{
		if (document.getElementById(div).style.display == "none")
			document.getElementById(div).style.display = "block";
		else
			document.getElementById(div).style.display = "none";
	}
	
	function thoughts_popup(msg)
	{
		document.getElementById('popup_msg_thoughts_update_body').innerHTML = msg;
		document.getElementById('popup_msg_thoughts_update').style.display = "block";
	}
	
	function thoughts_closePopup()
	{
		document.getElementById('popup_msg_thoughts').style.display = "none";
	}
	

	function thoughts_changeTextArea(thought_type)
	{
		document.getElementById('thought_type').value = thought_type;
		if ( thought_type != 0 )
			document.getElementById('thought_display').style.display = "block"; 
		else
			document.getElementById('thought_display').style.display = "none";
			 
		if ( thought_type == 1 )
		{
			document.getElementById('thought_body_text').value = "Journal - Who did you meet, where did you go, what did you do? Every day matters. Start drafting your memoir.";
		}
		if ( thought_type == 2)
		{
			document.getElementById('thought_body_text').value = "Review - Heard any good music lately? Read any good books? Be a critique, write a review. ";
		}
		if (thought_type == 3)
		{
			document.getElementById('thought_body_text').value = "Hot potato - Think before you speak and speak what you think. Start a debate and play a political football.";
		}
		if (thought_type == 4)
		{
			document.getElementById('thought_body_text').value = "Dream - What were your childhood dreams and what are your dreams now? Do you remember your dream from last night? What do you think it means? Your dreams in all form, are projections of parts of yourself. Don't let them fade away; write them down. ";
		}
		if (thought_type == 5)
		{
			document.getElementById('mee_thought').style.display = "none";
			document.getElementById('thought_body').style.display = "none";
			document.getElementById('thought_body_text').value = "";
		}
		else
		{
			document.getElementById('thought_body').style.display = "block";
			document.getElementById('mee_thought').style.display = "block";
		}
		if (thought_type == 6)
		{
			document.getElementById('thought_body_text').value = "Secret - Don't keep secrets bottled up! Only your friends have access to your secrets. So breathe in and spit it out - it will feel good. ";
		}
	}
	
	function thoughts_switchAddPageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			
			return;
		}
		
		document.getElementById('member_thought_div').innerHTML = text;
	}
	
	function thoughts_switchAddPage(thought_id)
	{
		
		this.houghts_switchA = thoughts_switchAddPageCallback;
		var req = new JSAjaxDoc(this, "houghts_switchA");
		req.addParam("thought_id", thought_id);
		var url = "/thoughts/thought_switch_add.php";
		req.send(url, "POST");
	}
	
	
	
	function thoughts_init(type)
	{
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('thoughts_bar');
		loadLeftPanel('/fun_zone/fun_zone.php');
		document.title = "This space is for your thoughts.  Think, create, write, remember.";
		rp_resetRightBottom();
	}
	
	function thoughts_get_init(type)
	{
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('thoughts_bar');
		loadLeftPanel('/fun_zone/fun_zone.php');
		rp_resetRightBottom();
	}
	
	function mp_switchCommentAlertImage()
	{
		document.getElementById('you_blank_off').style.display = "block";
		document.getElementById('you_blank_on').style.display = "none";
		if ( document.getElementById('comment_anim').style.display == 'inline' )
		{
			document.getElementById('comment_anim').style.display = 'none';
			document.getElementById('comment_unread').style.display = 'inline';
			document.getElementById('comment_read').style.display = 'none';
		}
	}
	
	//
	//
	//	Mee People
	//
	//
	
	function mee_people_getPeopleCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			
			return;
		}		
		document.getElementById('mee_people_div').innerHTML = text;
	}
	
	function mee_people_getPeople()
	{	
		this.mee_people_getM = mee_people_getPeopleCallback;			
		var req = new JSAjaxDoc(this, "mee_people_getM");
		var url = "/mee_people/mee_people_get_people.php";
		req.send(url, "GET");
	}
	
	function mee_people_over_member(member_div, count_broadcaster, count_popular, count_new)
	{
		for (i=0; i < count_broadcaster; i++)
			document.getElementById('top_broadcaster_'+i).style.display = "none";
		for (i=0; i < count_popular; i++)
			document.getElementById('top_popular_'+i).style.display = "none";
		for (i=0; i < count_new; i++)
			document.getElementById('top_new_'+i).style.display = "none";
			
		document.getElementById(member_div).style.display = "block";
			
	}
	
	function mee_people_CheckKey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			mp_getMemberByName(document.getElementById('search_member').value);
		}
	}
	
	function mee_people_init()
	{
		gFunZoneStatus = 1;
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('mee_people_bar');
		loadLeftPanel('/mee_people/mee_people_left.php');
		document.title = "The Mee Community - Meet people. Find people. Connect.";
		rp_resetRightBottom();
	}
	
	//
	//
	//	Mee Tee
	//
	//
	
		function mee_tee_init()
		{
			loadLeftPanel('/fun_zone/fun_zone.php');
			//selectMeeBar('mee_community_bar', 'mee_community_div');
			//setBarBold('mee_tee_bar');
			document.title = "Mee Tees! Broadcast your style to the world.";
			rp_resetRightBottom();
			//mee_tee_getPage();
		}
	
	//
	//
	//	Site Map
	//
	//
	
		function siteMap_init()
		{
			loadLeftPanel('/fun_zone/fun_zone.php');
		}
		
		function siteMap_overLink(div)
		{
			document.getElementById(div).style.color = "0308FA";
		}
		
		function siteMap_outLink(div)
		{
			document.getElementById(div).style.color = "7E7E7E";
		}
		
		function siteMap_overSmallLink(div)
		{
			document.getElementById(div).style.color = "0308FA";
		}
		
		function siteMap_outSmallLink(div)
		{
			document.getElementById(div).style.color = "A4A4A4";
		}
		
		
	//
	//
	//	Quick Help
	//
	//
	
	function quickHelp_init()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		rp_resetRightBottom();
	}
	
	//
	//
	//	Gallery
	//
	//
	
	function gallery_getPhotosCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}		
		document.getElementById('gallery_div').innerHTML = text;
	}
	
	function gallery_getPhotos(order, offset)
	{	
		//document.getElementById('path').innerHTML = "";
		//if ( offset == 0 )
		//	document.getElementById('photo_uid').value = "";
		if ( order == 2 || order == 3 )
			document.getElementById('search').value = "";
		this.gallery_getP = gallery_getPhotosCallback;			
		var req = new JSAjaxDoc(this, "gallery_getP");
		req.addParam("offset", offset);
		req.addParam("order", order);
		req.addParam("search", document.getElementById('search').value);
		req.addParam("photo_uid", document.getElementById('photo_uid').value);
		var url = "/gallery/gallery_get_photos.php";
		req.send(url, "GET");
		
		for ( i=0; i<=3; i++ )
		{
			document.getElementById('gallery_'+i).style.fontWeight = "normal";
		}
		document.getElementById('gallery_'+order).style.fontWeight = "bold";
	}
	
	function gallery_reset(tab)
	{
		document.getElementById('path').innerHTML = "";
		document.getElementById('photo_uid').value = "";
		gallery_getPhotos(tab, 0);
	}
	
	function gallery_getAll()
	{
		document.getElementById('search').value = "";
		document.getElementById('photo_uid').value = "";
		gallery_getPhotos(0, 0);
	}
	
	function gallery_CheckKey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (keynum == 13)
		{
			gallery_getPhotos(0, 0)
		}
	}
	
	function gallery_init()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('gallery_bar');
		document.title = "Meet the people in the Mix - MeeMix photo gallery";
		rp_resetRightBottom();	
	}
	
	
	//
	//
	//	Photo
	//
	//
	var gPhotoId = 0;
	
	function photo_getPhotoCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}	
		document.getElementById('photo_div').innerHTML = text;
	}
	
	function photo_getPhoto(photo_id)
	{	
		
		this.photo_getP = photo_getPhotoCallback;			
		var req = new JSAjaxDoc(this, "photo_getP");
		req.addParam("photo_id", photo_id);
		var url = "/gallery/gallery_get_photo.php";
		req.send(url, "GET");
	}
	
	function photo_updatePhotoCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}	
		document.getElementById('photo_edit').style.display = 'none';
		document.getElementById('photo_description').style.display = 'block';
		document.getElementById('photo_description').innerHTML = "Description: "+text;
	}
	
	function photo_updatePhoto(photo_id)
	{	
		
		this.photo_updateP = photo_updatePhotoCallback;			
		var req = new JSAjaxDoc(this, "photo_updateP");
		req.addParam("photo_id", photo_id);
		req.addParam("photo_tags", document.getElementById('photo_tags').value);
		req.addParam("photo_desc", document.getElementById('photo_desc').value);
		var url = "/gallery/gallery_photo_update.php";
		req.send(url, "POST");
	}
	
	function mp_isFieldEmpty(field)
	{
		if ( document.getElementById(field).value == "")
			return true;
		else
			return false;
	}
	
	function photo_addCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}	
		document.getElementById('photo_comment_box').style.display = "none";
		document.getElementById('photo_comment_textarea').value = "";
		photo_getCommentList(gPhotoId);	
		photo_getCommentCount(gPhotoId);	
	}
	
	function photo_addComment(photo_id)
	{	
		if ( mp_isFieldEmpty('photo_comment_textarea') )
		{
			document.getElementById('photo_comment_message').innerHTML = "Please fill in comment";
			return;
		}
		gPhotoId = photo_id;
		this.photo_addC = photo_addCommentCallback;			
		var req = new JSAjaxDoc(this, "photo_addC");
		req.addParam("photo_id", photo_id);
		req.addParam("comment", document.getElementById('photo_comment_textarea').value);
		var url = "/gallery/gallery_add_comment.php";
		req.send(url, "POST");
	}
	
	function photo_getCommentListCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}	
		document.getElementById('comments_list').innerHTML = text;
	}
	
	function photo_getCommentList(photo_id)
	{	
		this.photo_getC = photo_getCommentListCallback;			
		var req = new JSAjaxDoc(this, "photo_getC");
		req.addParam("photo_id", photo_id);
		var url = "/gallery/gallery_get_comments.php";
		req.send(url, "POST");
	}
	
	function photo_deletePhotoCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}	
		//if ( text == 0 )
		//	loadMiddlePanel('/gallery/gallery.php' ,'gallery_init()');
		//else
			photo_getPhoto(text);
	}
	
	function photo_deletePhoto(photo_id, photo_next)
	{	
		this.photo_deleteP = photo_deletePhotoCallback;			
		var req = new JSAjaxDoc(this, "photo_deleteP");
		req.addParam("photo_id", photo_id);
		req.addParam("photo_next", photo_next);
		var url = "/gallery/gallery_delete_photo.php";
		req.send(url, "POST");
	}
	
	function photo_getCommentCountCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}	
		document.getElementById('photo_comments_count').innerHTML = text;
	}
	
	function photo_getCommentCount(photo_id)
	{	
		this.getCommentC = photo_getCommentCountCallback;			
		var req = new JSAjaxDoc(this, "getCommentC");
		req.addParam("photo_id", photo_id);
		var url = "/gallery/gallery_get_comments_count.php";
		req.send(url, "POST");
	}
	
	function photo_resetBox()
	{
		document.getElementById('photo_comment_message').innerHTML = "";
	}
	
	function photo_openCommentBox()
	{
		if ( document.getElementById('photo_comment_box').style.display == "none" )
			document.getElementById('photo_comment_box').style.display = "block";
		else
			document.getElementById('photo_comment_box').style.display = "none";
	}
	
	function photo_openEditBox()
	{
		document.getElementById('photo_edit').style.display='block';
		document.getElementById('photo_description').style.display='none';
	}
	
	function photo_init()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('gallery_bar');
		document.title = "Meet the people in the Mix - MeeMix photo gallery";
		rp_resetRightBottom();	
	}
	
	//
	//
	//	Add photo
	//
	//
	
	function add_p_resetMsg()
	{
		document.getElementById('photo_msg').innerHTML = "";
		document.getElementById('after_upload').innerHTML = "";
	}
	
	
	//
	//
	//	Feeds
	//
	//
	
	function profileCurrentImage(photo_src,target)
	{		
		document.getElementById(target).src = photo_src;		
		document.getElementById('avatar_refresh').value = 1;
	}
	
	function feeds_updateMoodCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('mood').value = "";
		document.getElementById('mood_msg').innerHTML = text;
	}
	
	function feeds_updateMood()
	{
		this.feeds_updateM = feeds_updateMoodCallback;			
		var req = new JSAjaxDoc(this, "feeds_updateM");
		req.addParam("mood", document.getElementById('mood').value);
		var url = "/feeds/feeds_update_mood.php";
		req.send(url, "POST");
	}
	
	function feeds_checkText()
	{
		//if ( document.getElementById('mood').value != "" )
		if ( document.getElementById('mood_changed').value == 1 && document.getElementById('mood').value != "")
			feeds_updateMood();
		else
			document.getElementById('mood_msg').innerHTML = "Please enter your mood.";
	}
	
	function feeds_changeMoodStatus()
	{
		document.getElementById('mood_changed').value = 1;
	}
	
	function feeds_mood_focus()
	{
		document.getElementById('mood').select();
		document.getElementById('mood_msg').innerHTML='';
	}
	
	function feeds_openAgg(div, open_div, close_div)
	{
		document.getElementById(div).style.display = "block";
		document.getElementById(open_div).style.display = "none";
		document.getElementById(close_div).style.display = "block";
	}
	
	function feeds_closeAgg(div, open_div, close_div)
	{
		document.getElementById(div).style.display = "none";
		document.getElementById(open_div).style.display = "block";
		document.getElementById(close_div).style.display = "none";
	}
	
	function feeds_loadRightPanelPm(uid, feed, date, feed_type)
	{
		loadRightPanel('profilez/main.php?profile_uid=' + uid,'right_top_div_2', 10, 'profilez/personal_msg.php?profilezUid='+uid+'&feed='+feed+'&date='+date+'&feed_type='+feed_type);
	}
	
	function feeds_init()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		setBarBold('feeds_bar');
		document.title = "See what's happening in the Mix & stay updated with Mee Feeds";	
		rp_resetRightBottom();
	}
	
	//
	//
	//	Station Page
	//
	//
	
	var gStationThoughtId = 0;
	
	function station_page_getThoughtCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('station_thoughts').innerHTML = text;
		document.getElementById('thought_loading').style.display = "none";
	}
	
	function station_page_getThought(station_id, offset)
	{
		document.getElementById('thought_loading').style.display = "block";
		this.station_page_getT = station_page_getThoughtCallback;			
		var req = new JSAjaxDoc(this, "station_page_getT");
		req.addParam("offset", offset);
		req.addParam("station_id", station_id);
		var url = "/station_page/station_page_get_thought.php";
		req.send(url, "POST");
	}
	
	function station_page_getAudienceCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('station_page_view_audience').innerHTML = text;
	}
	
	function station_page_getAudience(station_id, offset)
	{
		this.station_page_getAu = station_page_getAudienceCallback;			
		var req = new JSAjaxDoc(this, "station_page_getAu");
		req.addParam("offset", offset);
		req.addParam("station_id", station_id);
		var url = "/station_page/station_page_get_audience.php";
		req.send(url, "POST");
	}
	
	function station_page_getLovedAudienceCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('station_page_view_loved_audience').innerHTML = text;
	}
	
	function station_page_getLovedAudience(station_id, offset)
	{
		this.station_page_getLovedA = station_page_getLovedAudienceCallback;			
		var req = new JSAjaxDoc(this, "station_page_getLovedA");
		req.addParam("offset", offset);
		req.addParam("station_id", station_id);
		var url = "/station_page/station_page_get_loved_audience.php";
		req.send(url, "POST");
	}
	
	function station_page_switchAudienceDiv(num)
	{
		if ( num == 1 )
		{
			document.getElementById('station_page_view_audience').style.display='block'; 
			document.getElementById('station_page_view_loved_audience').style.display='none';
			document.getElementById('view_audience_head').style.color='#478CB3';
			document.getElementById('view_loved_audience_head').style.color='#7E7E7E';
		}
		else
		{
			document.getElementById('station_page_view_audience').style.display='none'; 
			document.getElementById('station_page_view_loved_audience').style.display='block';
			document.getElementById('view_audience_head').style.color='#7E7E7E';
			document.getElementById('view_loved_audience_head').style.color='#478CB3';
		}
	}
	
	function station_page_switchBroadcastDiv(j)
	{
		for ( i=1; i<=2; i++ )
		{
			document.getElementById('broadcast_tab_' + i).style.fontWeight = "normal";
			document.getElementById('broadcast_' + i).style.display = "none";
		}
		
		document.getElementById('broadcast_tab_' + j).style.fontWeight = "bold";
		document.getElementById('broadcast_' + j).style.display = "block";
	}
	
	function station_page_selectAll(number_of_friends)
	{
		for ( i=0; i<number_of_friends; i++ )
		{
			if ( document.getElementById('broadcast_checkbox_' + i) != null) 
				document.getElementById('broadcast_checkbox_' + i).checked = true;
		}
		document.getElementById('select_2').style.display = 'block';
		document.getElementById('select_1').style.display = 'none';
		document.getElementById('select_st_2').style.display = 'block';
		document.getElementById('select_st_1').style.display = 'none';
	}
	
	function station_page_deSelectAll(number_of_friends)
	{
		for ( i=0; i<number_of_friends; i++ )
		{
			if ( document.getElementById('broadcast_checkbox_' + i) != null) 
				document.getElementById('broadcast_checkbox_' + i).checked = false;
		}
		document.getElementById('select_2').style.display = 'none';
		document.getElementById('select_1').style.display = 'block';
		document.getElementById('select_st_2').style.display = 'none';
		document.getElementById('select_st_1').style.display = 'block';
	}
	
	
	function station_page_rateStationCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('station_rate_graph').innerHTML = text;
		document.getElementById('station_rate').style.display = "none";
		document.getElementById('station_rate_results').style.display = "block";
	}
	
	function station_page_rateStation(station_id, rate)
	{
		this.station_page_rateS = station_page_rateStationCallback;			
		var req = new JSAjaxDoc(this, "station_page_rateS");
		req.addParam("rate", rate);
		req.addParam("station_id", station_id);
		var url = "/station_page/station_page_rate_station.php";
		req.send(url, "POST");
	}
	
	function station_page_getMeepCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('myDiv').style.display = "none";
		document.getElementById('singleMeep').innerHTML = text;
		document.getElementById('singleMeep').style.display = "block";
		document.getElementById('back_meeps').style.display = "inline";
	}
	
	function station_page_getMeep(meep_id)
	{
		this.station_page_getM = station_page_getMeepCallback;			
		var req = new JSAjaxDoc(this, "station_page_getM");
		req.addParam("meep_id", meep_id);
		var url = "/station_page/station_page_get_meep.php";
		req.send(url, "POST");
	}
	
	function station_page_getCommentsCountCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('thought_comments_hide').innerHTML = 'Hide comments ('+text+')';
		document.getElementById('thought_comments_view').innerHTML = 'View comments ('+text+')';
		document.getElementById('thought_comments_hide').style.display = "inline";
		document.getElementById('thought_comments_view').style.display = "none";
	}
	
	function station_pageCommentsCount(meep_id)
	{
		this.station_pageCommentsC = station_page_getCommentsCountCallback;			
		var req = new JSAjaxDoc(this, "station_pageCommentsC");
		req.addParam("thought_id", meep_id);
		var url = "/station_page/station_page_get_comments_count.php";
		req.send(url, "POST");
	}
	
	function station_page_getThoughtCommentsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('th_comments_list').innerHTML = text;
		document.getElementById('th_comments_list').style.display = "block";
		//document.getElementById(gViewCommentsDiv).innerHTML = 'Hide comments ('+gCommentsCount+')';
		station_pageCommentsCount(gStationThoughtId);
	}
	
	function station_page_getThoughtComments(thought_id)
	{
		this.station_page_getThoughtC = station_page_getThoughtCommentsCallback;			
		var req = new JSAjaxDoc(this, "station_page_getThoughtC");
		req.addParam("thought_id", thought_id);
		var url = "/station_page/station_page_get_thought_comments.php";
		req.send(url, "POST");
	}
	
	function station_page_inviteFriendsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}			
	}
	
	function station_page_inviteFriends(station_id)
	{
		this.station_page_inviteF = station_page_inviteFriendsCallback;			
		var req = new JSAjaxDoc(this, "station_page_inviteF");
		req.addParam("station_id", station_id);
		var url = "/station_page/station_page_invite_friends.php";
		req.send(url, "POST");
	}
	
	function sp_broadcastDone()
	{
		//station_page_switchBroadcastDiv(1);
	}
	
	function station_page_BroadcastCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			alert("Error");
			return;
		}
		//document.getElementById('maindiv').innerHTML = text;
		
	}
	
	function station_page_BroadcastFriends(num, uid, station_id)
	{
		this.station_page_B = station_page_BroadcastCallback;	
		var req = new JSAjaxDoc(this, "station_page_B");
		req.addParam('msg_type', 3);
		req.addParam('station_id', station_id);

		var j = 0;
		for ( i=0; i<num; i++)
		{
			if ( document.getElementById('broadcast_checkbox_' + i) != null )
			{
				if ( document.getElementById('broadcast_checkbox_' + i).checked )
				{					
					req.addParam('to_uid_'+ i, document.getElementById('broadcast_checkbox_' + i).value);
					document.getElementById('broadcast_checkbox_' + i).checked = false;
					j++;
				}
			}
		}
		req.addParam('num', num);
		var url = "/station_page/station_page_broadcast.php";
		if ( j > 0 )
			req.send(url, "POST");
		
		if ( j == 0 )
		{
			document.getElementById('message_br_top').innerHTML = 'Please check the members you wish to broadcast your station to.';
			document.getElementById('message_br_bottom').innerHTML = 'Please check the members you wish to broadcast your station to.';
		}
		else
		{
			document.getElementById('message_br_top').innerHTML = uid + ', a broadcast of this station has been sent to the friends you checked...';
			document.getElementById('message_br_bottom').innerHTML = uid + ', a broadcast of this station has been sent to the friends you checked...';
		}
		document.getElementById('message_br_top').style.display = 'block';
		document.getElementById('message_br_bottom').style.display = 'block';
		
	}
	
	function station_page_checkBox(num)
	{
		document.getElementById('message_br_top').style.display = 'none'; 
		document.getElementById('message_br_bottom').style.display = 'none';
		
		var j = 0;
		for ( i=0; i<num; i++)
		{
			if ( document.getElementById('broadcast_checkbox_' + i) != null )
				if ( document.getElementById('broadcast_checkbox_' + i).checked )
					j++;
		}
		
		if ( j > 0 )
		{
			document.getElementById('br_top_dis').style.display = 'none';
			document.getElementById('br_top_en').style.display = 'block';
			document.getElementById('br_bottom_dis').style.display = 'none';
			document.getElementById('br_bottom_en').style.display = 'block';
		}
		else
		{
			document.getElementById('br_top_dis').style.display = 'block';
			document.getElementById('br_top_en').style.display = 'none';
			document.getElementById('br_bottom_dis').style.display = 'block';
			document.getElementById('br_bottom_en').style.display = 'none';
		}
	}
	
	function station_page_addCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('th_comment_textarea').value = "";
		document.getElementById('th_comment_heading').value = "";
		document.getElementById('th_comment_message').innerHTML = text;
		document.getElementById('thought_comment_box').style.display = "none";
		
		station_page_getThoughtComments(gStationThoughtId);
	}
	
	function station_page_addComment(thought_id, thought_uid, thought_heading)
	{
		gStationThoughtId = thought_id;
		if ( station_page_commentIsBlank() )
			return;
		this.station_page_addC = station_page_addCommentCallback;			
		var req = new JSAjaxDoc(this, "station_page_addC");
		req.addParam("thought_id", thought_id);
		req.addParam("thought_uid", thought_uid);
		req.addParam("thought_heading", thought_heading);
		req.addParam("comment_heading", document.getElementById('th_comment_heading').value);
		req.addParam("comment_body", document.getElementById('th_comment_textarea').value);
		var url = "/thoughts/thoughts_add_comment.php";
		req.send(url, "POST");
	}
	
	function station_page_addStationCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		eval(text);
		
		if ( succes == 1 )
			station_page_getStationComments(uid, station_id);
		else if ( succes == 0 )
			document.getElementById('station_comment_message').innerHTML = err; 
	}
	
	function station_page_addStationComment(station_id)
	{
		this.station_page_addS = station_page_addStationCommentCallback;			
		var req = new JSAjaxDoc(this, "station_page_addS");
		req.addParam("station_id", station_id);
		req.addParam("comment", document.getElementById('station_comment_textarea').value);
		var url = "/station_page/station_page_add_comment.php";
		req.send(url, "POST");
	}
	
	function station_page_getStationCommentsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('station_page_station_comments').innerHTML = text;
	}
	
	function station_page_getStationComments(uid, station_id)
	{
		this.station_page_getStationC = station_page_getStationCommentsCallback;			
		var req = new JSAjaxDoc(this, "station_page_getStationC");
		req.addParam("station_id", station_id);
		req.addParam("uid", uid);
		var url = "/station_page/station_page_get_station_comments.php";
		req.send(url, "POST");
	}
	
	function station_page_commentIsBlank()
	{
		if ( document.getElementById('th_comment_heading').value == "" )
		{
			document.getElementById('th_comment_message').innerHTML = "Fill in comment heading";
			return true;		
		}
		else
			return false;
	}
	
	function station_page_resetBox()
	{
		document.getElementById('th_comment_heading').value = "";
	}
	
	function station_page_loadStation(station_id)
	{
		callApp('app_playPublic('+station_id+')', 1);
		document.getElementById('text_container').style.display = "none";
		document.getElementById('chat_container').style.display = "block";
//			document.getElementById('chat_btn').style.display = "block";
		station_page_executeChat();
	}
	
	function station_page_changeDivRates()
	{
		document.getElementById('station_rate_results').style.display = "none";
		document.getElementById('station_rate').style.display = "block";
	}
	
	function station_page_changeDiv(j, station_id)
	{
		if ( j != 3 ) {
			for ( i=1; i<=3; i++ )
			{
				document.getElementById('station_tab_' + i).style.fontWeight = "normal";
				if (document.getElementById('station_' + i)) {
					document.getElementById('station_' + i).style.display = "none";
				}
			}
			document.getElementById('station_tab_' + j).style.fontWeight = "bold";
			if (document.getElementById('tab_select_1').style.display == 'none') {
				station_page_changeTabs(1);
			}
			document.getElementById('station_' + j).style.display = "block";
		} else {
			for ( i=1; i<=3; i++ )
			{
				document.getElementById('station_tab_' + i).style.fontWeight = "normal";
			}
			document.getElementById('station_tab_' + j).style.fontWeight = "bold";
			station_page_loadTopSongs(station_id);
		}
	}
	
	function station_page_loadTopSongsCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY) {
			return;
		}
		mp_initPlayer();
		$('tab_select_3').innerHTML = text;
		station_page_changeTabs(3);
	}
	
	function station_page_loadTopSongs(station_id)
	{
		this.station_page_TS = station_page_loadTopSongsCB;
		var req = new JSAjaxDoc(this, "station_page_TS");
		req.addParam("station_id", station_id);
		var url = "/station_page/get_top_songs.php";
		req.send(url, "GET");
	}
	
	function station_page_loadMainPageCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY) {
			return;
		}
		$('station_page_div').innerHTML = text;
		for ( i=1; i<=3; i++ )
		{
			if (document.getElementById('station_' + i)) {
				document.getElementById('station_' + i).style.display = "none";
			}
		}
//		document.getElementById('station_tab_' + usr_word).style.fontWeight = "bold";
		document.getElementById('station_' + usr_word).style.display = "block";
	}
	
	function station_page_chartChange(no, action)
	{
		mp_switchChildImage($('chart_img_left_'+no));
		mp_switchChildImage($('chart_img_right_'+no));
		switch (action)
		{
			case 1:
				$('chart_img_center_'+no).style.background = "url(/artists/img/chart_strip_center_over.gif)";
//				$('song_'+no+'_icons').style.display = 'block';
				break;
			case 0:
				$('chart_img_center_'+no).style.background = "url(/artists/img/chart_strip_center.gif)";
//				$('song_'+no+'_icons').style.display = 'none';
				break;
		}
	}
	
	function station_page_chartClick(no, count)
	{
		if (gStationPageOnButtons == true) {
			return;
		}
		switch ($('song_'+no+'_icons').style.display)
		{
			case 'none':
				for (var i =0; i < count; i++)
				{
					$('song_'+i+'_icons').style.display = 'none';
				}
				$('song_'+no+'_icons').style.display = 'block';
				break;
			case 'block':
				$('song_'+no+'_icons').style.display = 'none';
				break;
		}
	}
	
	function station_page_loadMainPage(station_id, div)
	{
		station_page_changeTabs(1);
		return;
		this.station_page_MP = station_page_loadMainPageCB;
		var req = new JSAjaxDoc(this, "station_page_MP", div);
		req.addParam("station_id", station_id);
		var url = "/station_page/get_main_page.php";
		req.send(url, "GET");
	}
	
	function station_page_changeTabs(tab)
	{
		for ( i=1; i<=3; i++ )
		{
			if ( i < 3 && tab != 3) document.getElementById('tab_' + i).style.display = "none";
			document.getElementById('tab_select_' + i).style.display = "none";
		}
		if ( tab != 3 ) document.getElementById('tab_' + tab).style.display = "block";
		document.getElementById('tab_select_' + tab).style.display = "block";
	}
	
	function station_page_executeChat()
	{
		//document.getElementById('chat_btn_anim').style.display = "none";
		try {		
			var station_page_chat = getFlashMovieObject("station_page_chat_box");
			station_page_chat.chatConnect();
		} catch(e) {};
	}
	
	var the_timeout;
	function move(stop)
	{
		var the_style = getStyleObject("myDiv");
		if (the_style) {
		
			var start = parseInt(the_style.top);
			var end = start ;
			moveDiv(end, 0, stop);
		}
	
	}
	
	function moveDiv(end, x, stop)
	{
	  // get the stylesheet
	  //
	  var the_style = getStyleObject("myDiv");
	  //if ( document.getElementById('myDiv').style.top == 0 )
	  	//document.getElementById('myDiv').style.top=650;
	  if (the_style)
	  {
	    // get the current coordinate and add 5
	    //
	    var current_top = parseInt(the_style.top);
	    var new_top = current_top - 1;
	
	    // set the left property of the DIV, add px at the
	    // end unless this is NN4
	    //
	    if (document.layers) 
	    {
	      the_style.top = new_top;
	    }
	    else 
	    {  
	      the_style.top = new_top + "px";
	    }
	    
	    // if we haven't gone to far, call moveDiv() again in a bit
	    // 
	    if ( current_top == stop )
	    {
	    	document.getElementById('myDiv').style.top=350;
	    	the_timeout=setTimeout('move('+ stop +');',10); return false;
	    }
	    if (new_top < end)
	    {	      
		  the_timeout = setTimeout('moveDiv(' + end + ',' + x + ', '+ stop +');',25);
	    }
	  }
	}
	
	
	function getStyleObject(objectId) {
	    // cross-browser function to get an object's style object given its
	    if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId).style;
	    } else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId).style;
	    } else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
	    } else {
		return false;
	    }
	} // getStyleObject
	
	function station_page_getCommentList()
	{
		document.getElementById('singleMeep').style.display = "none";
		document.getElementById('myDiv').style.display = "block";
	}
	
	function station_page_startMoving()
	{
		the_timeout=setTimeout('move();',5000); 
		return false;
	}
	
	function station_page_openBox(div)
	{	
		if ( document.getElementById(div).style.display == "none" )
		{
			document.getElementById(div).style.display = "block";
		}
		else
		{
			document.getElementById(div).style.display = "none";
		}
	}

	function station_page_openThoughtBox()
	{
		if ( document.getElementById('thought_comment_box').style.display == "none" )
			document.getElementById('thought_comment_box').style.display = "block";
		else
			document.getElementById('thought_comment_box').style.display = "none";
	}
	
	function station_page_viewThoughtComments()
	{
		document.getElementById('th_comments_list').style.display = "inline";
		document.getElementById('thought_comments_view').style.display = "none";
		document.getElementById('thought_comments_hide').style.display = "inline";
	}
	
	function station_page_hideThoughtComments()
	{
		document.getElementById('th_comments_list').style.display = "none";
		document.getElementById('thought_comments_view').style.display = "inline";
		document.getElementById('thought_comments_hide').style.display = "none";
	}
	
	/*function station_pageOverBar(out, over, text)
	{
		mp_overImage(out, over);
		document.getElementById(text).style.color = '3195ED';
	}
	
	function station_pageOutBar(out, over, text)
	{
		mp_outImage(out, over);
		document.getElementById(text).style.color = '7E7E7E';
	}*/
	
	
	function station_pageOverBar(out, over, text_out, text_over)
	{
		mp_overImage_inline(out, over);
		document.getElementById(text_out).style.display = 'none';
		document.getElementById(text_over).style.display = 'inline';
	}
	
	function station_pageOutBar(out, over, text_out, text_over)
	{
		mp_outImage_inline(out, over);
		document.getElementById(text_out).style.display = 'inline';
		document.getElementById(text_over).style.display = 'none';
	}
	
	
	function station_page_removeFooter()
	{
		if ( document.getElementById('middle-footer-d') != null )
			document.getElementById('middle-footer-d').style.display = "none";
		//if ( document.getElementById('meemix-loading-footer-d') != null )
		//	document.getElementById('meemix-loading-footer-d').style.display = "none";
	}
	
	function station_page_traveller_init()
	{
		gFunZoneStatus = 1;
		loadLeftPanel('/fun_zone/fun_zone.php');
		document.title = "Welcome to the Station Home | MeeMix Internet Radio Community ";	
		rp_resetRightBottom();
	}
	
	function station_page_init(station_id, discussion)
	{
		gFunZoneStatus = 1;
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('station_bar');
		document.title = "Welcome to the Station Home | MeeMix Internet Radio Community ";	
		if (discussion != true) {
			//loadLeftPanel('/station_page/station_page_left.php?station_id='+station_id+'');
			rp_loadBottomRightPanel('/station_page/station_page_right.php?station_id='+station_id);
		}
	}
	
	
	
	//
	//
	//	Meeps
	//
	//
	
	var meeps_i = null;
	var meeps_next = null;
	var gMeepId = null;
	var gCommentsDiv = null;
	var gViewCommentsDiv = null;
	var gCommentsCount = 0;
	var gMeepSort = 1;
	
	
	function meeps_getMeepsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('meeps_div').innerHTML = text;
	}
	
	function meeps_getMeeps(offset)
	{
		this.meeps_getM = meeps_getMeepsCallback;			
		var req = new JSAjaxDoc(this, "meeps_getM");
		
		req.addParam("offset", offset);
		req.addParam("sort", gMeepSort);
		req.addParam("meep_id", gSingleMeepId);
		req.addParam("station_id", gMeepStationId);
		req.addParam("gender", meeps_getSearchGender());
		req.addParam("country", meeps_getSearchCountry());
		req.addParam("state", meeps_getSearchState());

		if (document.getElementById('top_100_artist') != null)
			req.addParam("artist_id", document.getElementById('top_100_artist').value);
		if (document.getElementById('top_100_meeps_count') != null)
			req.addParam("meeps_count", document.getElementById('top_100_meeps_count').value);

		if (document.getElementById('meeps_genre_num') != null)	
		{
			for (i=1; i<=document.getElementById('meeps_genre_num').value; i++)
			{
				if (document.getElementById('meep_genre_'+i).checked==true)
					req.addParam('genre_'+i,document.getElementById('meep_genre_'+i).value);
			}
			req.addParam("genre_num", document.getElementById('meeps_genre_num').value);	
		}
		
		var url = "/meeps/meeps_get_meeps.php";
		req.send(url, "GET");
		return false;
	}
	
	function meeps_getMeepsByStationId(station_id)
	{
		gMeepStationId = station_id;
		loadMiddlePanel('/meeps/meeps.php?station_id='+ station_id,'meeps_init()');
	}
	
	function meeps_resetSearch()
	{
		if (document.getElementById('meeps_country') != null)
			document.getElementById('meeps_country').selectedIndex = document.getElementById('meeps_country').length-1;
		if (document.getElementById('states') != null)
			document.getElementById('states').selectedIndex = document.getElementById('states').length-1;
		if (document.getElementById('gender') != null)
			document.advanced_search_form.gender[0].checked = true;
		if (document.getElementById('meeps_genre_num') != null)	
			for (i=1; i<=document.getElementById('meeps_genre_num').value; i++)
				document.getElementById('meep_genre_'+i).checked = false;
		if (document.getElementById('top_100') != null)
			document.getElementById('top_100').value = null;
		gMeepStationId = 0;	
			
		meeps_getMeeps(0);
	}
	
	function meeps_getSearchCountry()
	{
		var country_value = 'A1';
		
		if (document.getElementById('meeps_country') != null)
			country_value = document.getElementById('meeps_country').value;	
	
		return country_value;
	}
	
	function meeps_getSearchState()
	{
		var state_value = 0;
		if (document.getElementById('states') != null)
			state_value = document.getElementById('states').value;	
		
		return state_value;
	}
	
	function meeps_getSearchGender()
	{
		var gender_value;
		if (document.getElementById('gender') != null)
		{
			for (i=0; i< document.getElementsByName("gender").length; i++)
			{
				if (document.advanced_search_form.gender[i].checked == true)
					gender_value = document.advanced_search_form.gender[i].value;
			}	
		}
		else
			gender_value = 0;
			
		return gender_value;
	}
	
	function meeps_changeTab(tab)
	{
		for ( i=1; i<=5; i++ )
		{
			document.getElementById('link_' + i).style.fontWeight = "normal";
		}
		document.getElementById('link_' + tab).style.fontWeight = "bold";
		
		gMeepSort = tab;
		if ( tab == 3 )
			meeps_resetSearch();
		else
			meeps_getMeeps(0);
	}
	
	function meeps_getMeepCommentsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		result = eval("("+text+")");
		document.getElementById(gCommentsDiv).innerHTML = result['div'];
		document.getElementById(gCommentsDiv).style.display = "block";
		document.getElementById(gViewCommentsDiv).innerHTML = 'Hide comments ('+result['count']+') ';
	}
	
	function meeps_getMeepComments(meep_id, page)
	{
		this.meeps_getMeepC = meeps_getMeepCommentsCallback;			
		var req = new JSAjaxDoc(this, "meeps_getMeepC");
		req.addParam("meep_id", meep_id);
		var url = "/meeps/meeps_get_meep_comments.php";	
		if ( page == "artists" ) {
			var url = "/artists/artists_get_meep_comments.php";	
		}
		req.send(url, "POST");
	}
	
	function meeps_getCommentsCountCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		if ( document.getElementById(gViewCommentsDiv) != null )
			document.getElementById(gViewCommentsDiv).innerHTML = 'Hide comments ('+text+')';
	}
	
	function meeps_getCommentsCount(meep_id)
	{
		this.meeps_getC = meeps_getCommentsCountCallback;			
		var req = new JSAjaxDoc(this, "meeps_getC");
		req.addParam("meep_id", meep_id);
		var url = "/meeps/meeps_get_meep_comments_count.php";
		req.send(url, "POST");
	}
	
	function meeps_addCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('comment_textarea_' + meeps_i).value = "";
		document.getElementById('comment_box_' + meeps_i).style.display = "none";
		//document.getElementById('comment_message_' + meeps_i).innerHTML = text;
		meeps_getMeepComments(gMeepId, usr_word);
	}
	
	
	function meeps_addComment(meep_id, i, comments_div, view_comments_div, comments_count, page)
	{
		meeps_i = i;
		gMeepId = meep_id;
		gCommentsDiv = comments_div;
		gViewCommentsDiv = view_comments_div;
		if ( meeps_commentIsBlank(i) )
			return;
		this.meeps_addC = meeps_addCommentCallback;		
		var req = new JSAjaxDoc(this, "meeps_addC", page);
		req.addParam("meep_id", meep_id);
		req.addParam("comment", document.getElementById('comment_textarea_' + i).value);
		var url = "/meeps/meeps_add_comment.php";
		req.send(url, "POST");
		document.getElementById('comment_textarea_' + i).value = "";
	}
	
	function meeps_commentIsBlank(i)
	{
		if ( document.getElementById('comment_textarea_' + i).value == "" )
		{
			document.getElementById('comment_message_' + i).innerHTML = "Fill in comment";
			return true;		
		}
		else
			return false;
	}
	
	function meeps_resetBox(i)
	{
		document.getElementById('comment_message_' + i).innerHTML = "";
	}
	
	function meeps_openBox(div, view_comments_div, comments_count)
	{
		if ( comments_count < gCommentsCount )
			comments_count = gCommentsCount;
			
		if ( document.getElementById(div).style.display == "none" )
		{
			document.getElementById(div).style.display = "block";
			document.getElementById(view_comments_div).innerHTML = 'Hide comments ('+comments_count+')';			
		}
		else
		{
			document.getElementById(div).style.display = "none";
			document.getElementById(view_comments_div).innerHTML = 'View comments ('+comments_count+')';			
		}
	}
	
	function meeps_GetStatesCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}				
		eval(text);
		var length = document.getElementById('states').length;
		document.getElementById('states').options[length] = new Option('Never Mind', '0', true, true);
	}
	
	function meeps_GetStates()
	{	
		document.getElementById('states').length = 0;
		var country = document.getElementById('meeps_country').value;
		if (country != "0")
		{
			this.meeps_GetS = meeps_GetStatesCallback;			
			var req = new JSAjaxDoc(this, "meeps_GetS");
			req.addParam("country", country);
			var url = "/profile/profile_get_states.php";
			req.send(url, "POST");
		}
		else
		{
			document.getElementById('states').options[length] = new Option('Never Mind', '0');
		}
	}

	function meeps_openTextBox(div, text_div)
	{
		if ( document.getElementById(div).style.display == "none" )
		{
			document.getElementById(div).style.display = "block";
			if ( document.getElementById(text_div) != null ) 
				document.getElementById(text_div).focus();
		}
		else {
			document.getElementById(div).style.display = "none";
		}
	}
	
	function meeps_init()
	{
		gFunZoneStatus = 1;
		loadLeftPanel('/meeps/meeps_left.php');
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('meeps_bar');
		document.title = "Got something on your mind? Meep it up at MeeMix!";	
		rp_resetRightBottom();
		mp_initPlayer();
	}
	
	//
	//
	//	Journey
	//
	//
	
	function journeyOpenItem(item)
	{
		if (document.getElementById(item).style.display == 'none')
			document.getElementById(item).style.display = 'block';
		else
			document.getElementById(item).style.display = 'none';		
	}
	
	function journey_init()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		document.title = "Explore your friend's Mee Journey ";	
		rp_resetRightBottom();
	}
	
	function journey_orderSort(div, uid, sort)
	{
		for (i=1; i<=2; i++)
		{
			document.getElementById('journey_sort_' + i).style.fontWeight = "normal";
		}
		document.getElementById(div).style.fontWeight = "bold";
		document.getElementById('journey_sort').value = sort;
		var type = document.getElementById('journey_type').value;
		journey_getJourney(uid, type, sort);
	}
	
	function journey_orderType(div, uid, type)
	{
		for (i=1; i<=5; i++)
		{
			document.getElementById('journey_type_' + i).style.fontWeight = "normal";
		}
		document.getElementById(div).style.fontWeight = "bold";
		document.getElementById('journey_type').value = type;
		var sort = document.getElementById('journey_sort').value;
		journey_getJourney(uid, type, sort);
	}

	function journey_getJourneyCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('journey_div').innerHTML = text;
	}
	
	
	function journey_getJourney(uid, type, sort, offset)
	{	
		if (!offset) offset = 0;
		this.journey_getJ = journey_getJourneyCallback;			
		var req = new JSAjaxDoc(this, "journey_getJ");
		
/*		if (document.getElementById('sort') != null)
			req.addParam("sort", document.getElementById('sort').value);
		else
		*/
			req.addParam("uid", uid);
			req.addParam("sort", sort);
			req.addParam("type", type);			
/*		if (document.getElementById('thought_search') != null)
			req.addParam("search", document.getElementById('thought_search').value.toLowerCase());
		else
			req.addParam("search", "");
		
		if (type != null)
			gThoughtType = type;
		else
			gThoughtType = 0;
			
		req.addParam("type", gThoughtType);		
			
		if (gThoughtType != 0)
		{
			req.addParam("type", gThoughtType);	
			//document.getElementById('thought_type').value = gThoughtType;	
		}
		else
		{
			if (document.getElementById('thought_type') != null)
				req.addParam("type", document.getElementById('thought_type').value);
			else
				req.addParam("type", 0);
		}	
		
		//gThoughtType = 0;	
		*/
		req.addParam("offset", offset);
		var url = "/journey/journey_get_journey.php";
		req.send(url, "GET");
		
		return false;
	}
	
	function journey_loadRightPanelPm(uid, journey_text, date, journey_type)
	{
		loadRightPanel("profilez/main.php?profile_uid="+uid ,"right_top_div_2", 1, "profilez/personal_msg.php?profilezUid="+uid+"&journey_text="+journey_text+"&date="+date+"&journey_type="+journey_type);
	}
	
		//
	//
	//	Traveller Pages
	//
	//
	
	function traveller_loadRegCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}	
		document.getElementById('middle_content').innerHTML = text;
	}
	
	function traveller_loadReg(title, link)
	{
		this.traveller_loadR = traveller_loadRegCallback;			
		var req = new JSAjaxDoc(this, "traveller_loadR");
		req.addParam("title", title);
		req.addParam("link", link);
		var url = "/include/traveller_reg.php";
		req.send(url, "POST");
	}
	
	function traveller_init(bar, title, link)
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_profile_bar', 'mee_profile_div');
		setBarBold(bar);
		rp_resetRightBottom();
		//traveller_loadReg(title, link);
	}
	
	function traveller_source_init(bar, title, link)
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_source_div', 'widgets_bar');
		setBarBold(bar);
		rp_resetRightBottom();
		traveller_loadReg(title, link);
	}
	
	//
	//
	//	Discussion 
	//
	//
	
	function discussion_addTopicCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		eval(text);
		if ( success == 0 )
			document.getElementById('add_topic_message').innerHTML = err_msg;
		else if (station_page) {
			document.getElementById('station_page_talk').style.height = '115';
			document.getElementById('station_page_talk').innerHTML = unescape(station_page_div);
		} 
		else {
			loadMiddlePanel('/discussions/discussion_topics.php?source_id='+source_id+'& source_type='+source_type+'&filter=0&sort=1','discussion_init()');
		}
	}
	
	function discussion_addTopic(source_id, source_type, station_page, width)
	{
		this.discussion_addT = discussion_addTopicCallback;			
		var req = new JSAjaxDoc(this, "discussion_addT");
		req.addParam("source_id", source_id);
		req.addParam("source_type", source_type);
		req.addParam("topic_heading", document.getElementById('topic_heading').value);
		req.addParam("topic_body", document.getElementById('topic_body').value);
		if (station_page == true) {
			req.addParam("station_page", station_page);	
			req.addParam("width", width);	
		}
		var url = "/discussions/discussion_add_topic.php";
		req.send(url, "POST");
	}

	function discussion_addMessageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		eval(text);
		if ( success == 0 )
			document.getElementById('add_message_message').innerHTML = err_msg;
		else
			loadMiddlePanel('/discussions/discussion_messages.php?source_id='+source_id+'&source_type='+source_type+'&filter=1&sort=0&topic_id='+topic_id,'discussion_init()');
	}
	
	function discussion_addMessage(topic_id, source_type, source_id)
	{
		this.discussion_addM = discussion_addMessageCallback;			
		var req = new JSAjaxDoc(this, "discussion_addM");
		req.addParam("topic_id", topic_id);
		req.addParam("source_id", source_id);
		req.addParam("source_type", source_type);
		req.addParam("message_body", document.getElementById('discussion_new_message').value);
		var url = "/discussions/discussion_add_message.php";
		req.send(url, "POST");
	}

	function discussion_addCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {			
			return;
		}
		discussion_getMessagesBySort(text);
	}

	function discussion_addComment(message_id, comment_num) {
		comment = document.getElementById('discussion_comment_'+comment_num).value;
		if (comment == null || comment == '' || comment == 'Add your comment here') {
			document.getElementById('discussion_comment_'+comment_num).value = '';
			document.getElementById('add_comment_errorMsg_'+comment_num).style.display = 'block';
			document.getElementById('add_comment_errorMsg_'+comment_num).innerHTML = 'Please fill in comment\n';
			return;
		}
		document.getElementById('discussion_message_comment_box_'+comment_num).style.display = 'none';
		this.discussion_addC = discussion_addCommentCallback;			
		var req = new JSAjaxDoc(this, "discussion_addC");
		req.addParam("comment", comment);
		req.addParam("message_id", message_id);
		var url = "/discussions/discussion_add_comment.php";
		req.send(url, "POST");		
	}

	function discussion_getAddTopicPageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function discussion_getAddTopicPage(source_id, source_type)
	{
/*		if (document.getElementById('div_1'))
		{
			this.discussion_addTP = discussion_getAddTopicPageCallback;			
			var req = new JSAjaxDoc(this, "discussion_addTP");
			req.addParam("source_id", source_id);
			req.addParam("source_type", source_type);
			var url = "/discussions/discussion_get_add_topic_page.php";
			req.send(url, "POST");
		}*/
		loadMiddlePanel('/discussions/add_topic/add_topic.php?source_type='+source_type+'&source_id='+source_id,'discussion_init()');
	}

	function discussion_getAddMesssagePageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function discussion_getAddMessagePage(topic_id)
	{
		this.discussion_addMP = discussion_getAddMesssagePageCallback;			
		var req = new JSAjaxDoc(this, "discussion_addMP");
		req.addParam("topic_id", topic_id);
		var url = "/discussions/discussion_get_add_message_page.php";
		req.send(url, "GET");
	}

	function discussion_getTopicsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('discussions_topics').innerHTML = text;	
	}
	
	function discussion_getTopicsBySort(source_id, source_type, sorting)
	{
		for (i=0; i<3; i++) {
			document.getElementById("discussion_topic_sorting_"+i).style.fontWeight = 'normal';
		}
		document.getElementById("discussion_topic_sorting_"+sorting).style.fontWeight = 'bold';
		document.getElementById('discussion_sorting').value = sorting;
		this.discussion_getT = discussion_getTopicsCallback;			
		var req = new JSAjaxDoc(this, "discussion_getT");
		req.addParam("source_id", source_id);
		req.addParam("source_type", source_type);
		req.addParam("filter", document.getElementById('discussion_filter').value);
		req.addParam("sort", sorting);
		var url = "/discussions/discussion_get_topics.php";
		req.send(url, "GET");
	}
	
	function discussion_getTopicsByFilter(source_id, source_type,filter)
	{
		for (i=0; i<3; i++) {
			document.getElementById("discussion_topic_filter_"+i).style.fontWeight = 'normal';
		}
		document.getElementById("discussion_topic_filter_"+filter).style.fontWeight = 'bold';
		document.getElementById('discussion_filter').value = filter;
		this.discussion_getT = discussion_getTopicsCallback;			
		var req = new JSAjaxDoc(this, "discussion_getT");
		req.addParam("source_id", source_id);
		req.addParam("source_type", source_type);
		req.addParam("filter", filter);
		req.addParam("sort", document.getElementById('discussion_sorting').value);
		var url = "/discussions/discussion_get_topics.php";
		req.send(url, "GET");
	}

	function discussion_getMessagesCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;	
	}
	
	function discussion_getMessagesBySort(topic_id)
	{
		this.discussion_getM = discussion_getMessagesCallback;			
		var req = new JSAjaxDoc(this, "discussion_getM");
		req.addParam("topic_id", topic_id);
		var url = "/discussions/discussion_get_messages.php";
		req.send(url, "GET");
	}
	
	function discussion_init()
	{
//		loadLeftPanel('/fun_zone/fun_zone.php');
		document.title = "Discussions";
		window.scroll(0,0);
//		rp_resetRightBottom();
	}

	//
	//
	//	Game
	//
	//
	
	function game_getChartCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function game_getChart(offset)
	{
		this.game_getC = game_getChartCallback;			
		var req = new JSAjaxDoc(this, "game_getC");
		req.addParam("offset", offset);
		req.addParam("genre", document.getElementById('mgc_selected_genre').value);
		req.addParam("sort", document.getElementById('mgc_sort').value);
		var url = "/mee_game_charts/game_get_chart.php";
		req.send(url, "GET");
		
		return false;
	}
	
	
	function game_switchGenres(num, chosen, value, value_text)
	{
		for ( i=0; i<num; i++ )
		{
			if ( document.getElementById('mgc_genre_' + i) != null ) 
				document.getElementById('mgc_genre_' + i).style.fontWeight = "normal";
		}
		document.getElementById('mgc_selected_genre').value = value;		
		document.getElementById('mgc_genre_' + chosen).style.fontWeight = "bold";		
		document.getElementById('chosen_genre').innerHTML = value_text;		
		
		game_getChart(0);
	}
	
	function game_switchSort(num, sort_value)
	{
		for ( i=1; i<=3; i++ )
		{
			if ( document.getElementById('mgc_sort_' + i) != null )
				document.getElementById('mgc_sort_' + i).style.fontWeight = "normal";
		}
		document.getElementById('mgc_sort').value = sort_value;
		document.getElementById('mgc_sort_' + num).style.fontWeight = "bold";
		
		game_getChart(0);
	}
	
	function game_init()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_source_bar', 'mee_source_div');
		document.title = "MeeMix internet radio Mee Game charts";	
		setBarBold('chart_bar');
		
	}
	
	/*
	gFunZoneStatus = 1;
		loadLeftPanel('/meeps/meeps_left.php');
		selectMeeBar('mee_community_bar', 'mee_community_div');
		setBarBold('meeps_bar');
		document.title = "Got something on your mind? Meep it up at MeeMix!";	
		rp_resetRightBottom();
		*/
		
	//
	//
	//	Artist Home Page
	//
	//
	
	function artist_getAlbumsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function artist_getAlbums(artist_id)
	{
		this.artist_getA = artist_getAlbumsCallback;			
		var req = new JSAjaxDoc(this, "artist_getA");
		req.addParam("artist_id", artist_id);
		var url = "/artists/artist_get_albums.php";
		req.send(url, "GET");

	}

	function artist_getSongsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function artist_getSongs(artist_id)
	{
		this.artist_getS = artist_getSongsCallback;			
		var req = new JSAjaxDoc(this, "artist_getS");
		req.addParam("artist_id", artist_id);
		var url = "/artists/artist_get_songs.php";
		req.send(url, "GET");

	}

	function artist_getFansCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function artist_getFans(artist_id, offset)
	{
		this.artist_getF = artist_getFansCallback;			
		var req = new JSAjaxDoc(this, "artist_getF");
		req.addParam("artist_id", artist_id);
		req.addParam("offset", offset);
		var url = "/artists/artist_get_fans.php";
		req.send(url, "GET");
		return false;
	}
	
	function artist_getGalleryCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function artist_getGallery(artist_id, offset)
	{
		this.artist_getG = artist_getGalleryCallback;			
		var req = new JSAjaxDoc(this, "artist_getG");
		req.addParam("artist_id", artist_id);
		req.addParam("offset", offset);
		var url = "/artists/artist_get_gallery.php";
		req.send(url, "GET");
		return false;
	}

	function artist_get_artist_imageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function artist_get_artist_image(artist_id, image_id)
	{
		this.artist_getAI = artist_get_artist_imageCallback;			
		var req = new JSAjaxDoc(this, "artist_getAI");
		req.addParam("artist_id", artist_id);
		req.addParam("artist_image_id", image_id);
		var url = "/artists/artist_get_artist_image.php";
		req.send(url, "GET");
	}

	function artist_getHomeCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function artist_getHome(artist_id)
	{
		this.artist_getH = artist_getHomeCallback;			
		var req = new JSAjaxDoc(this, "artist_getH");
		req.addParam("artist_id", artist_id);
		var url = "/artists/artist_get_home.php";
		req.send(url, "GET");
	}
	
	function artist_switchTab(num) 
	{
		for ( i=1; i<=5; i++ ) {
			if (document.getElementById('artist_mode_' + i)) {
				document.getElementById('artist_mode_' + i).style.fontWeight = 'normal';
			}
		}
		if ( num != 0 ) {
			if (document.getElementById('artist_mode_' + num)) {
				document.getElementById('artist_mode_' + num).style.fontWeight = 'bold';
			}
		}
	}
	
	function artist_closeBox()
	{
		$('artist_box_container').style.display = 'none';
		if ( $('artist_video_container') ) {
			$('artist_video_container').innerHTML = '';
		}
	}
	function artists_getVideoCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		$("artist_box_container").innerHTML= text;
		var top = getScrollY();
		$("artist_box_container").style.top = top;
		$("artist_box_container").style.display= 'block';
	}

	function artists_getVideo(yt_id, artist_id, yt_link, yt_title)
	{
		if ( $('artist_box_container').style.display == 'block' && $('artists_video_player') ) {
			artists_changeVideo(yt_link, yt_id, yt_title);
			return;
		}
		this.artist_artist_video = artists_getVideoCB;
		var req = new JSAjaxDoc(this, "artist_artist_video");
		req.addParam("yt_id", yt_id);
		req.addParam("artist_id", artist_id);
		var url = "/artists/videos/get_artist_video_box.php";
		req.send(url, "POST");
	}
	
	function artist_getArtistVideosCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		$("artist_box_container").innerHTML= unescape(text);
		var top = getScrollY();
		$("artist_box_container").style.top = top;
		$("artist_box_container").style.display = 'block';
	}
	
	function artist_getArtistVideos(artist_id, offset)
	{
		this.artist_artist_videos = artist_getArtistVideosCB;
		var req = new JSAjaxDoc(this, "artist_artist_videos");
		req.addParam("artist_id", artist_id);
		offset = typeof offset == "undefined" ? 0 : offset; 
		req.addParam("offset", offset);
		var url = "/artists/videos/get_artist_videos.php";
		req.send(url, "POST");
	}

	function artist_getArtistVideosRowCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		$("videos_row").innerHTML= text;
	}
	
	function artist_getArtistVideosRow(artist_id, offset)
	{
		this.artist_artist_videos_row = artist_getArtistVideosRowCB;
		var req = new JSAjaxDoc(this, "artist_artist_videos_row");
		req.addParam("artist_id", artist_id);
		offset = typeof offset == "undefined" ? 0 : offset; 
		req.addParam("offset", offset);
		var url = "/artists/videos/get_artist_videos_row.php";
		req.send(url, "POST");
	}
	
	function artist_getArtistVideoPostsCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		eval(usr_word);
		yt_title = unescape(yt_title);
		yt_link = unescape(yt_link);
		if (IE) {
			$('artist_video_container').innerHTML= "<embed src=\""+yt_link+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"400\" height=\"325\"></embed>";
		} else {
			$('artist_video_container').innerHTML= "<object width=\"400\" height=\"325\"><param name=\"movie\" value=\""+yt_link+"\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\""+yt_link+"\" type=\"application/x-shockwave-flash\" width=\"400\" height=\"325\"></embed></object>";
		}
		$('vid_title').innerHTML = user_correct_length(yt_title, 55);
		$("artist_video_posts").innerHTML= text;
		var top = getScrollY();
		$("artist_box_container").style.top = top;
		$("artist_box_container").style.display= 'block';
	}

	function artists_changeVideo(yt_link, yt_id, yt_title)
	{
		usr_word = "var yt_link= '"+yt_link+"'; var yt_title='"+yt_title+"';";
		this.artist_artist_video_posts = artist_getArtistVideoPostsCB;
		var req = new JSAjaxDoc(this, "artist_artist_video_posts", usr_word);
		req.addParam("yt_id", yt_id);
		req.addParam("yt_title", yt_title);
		var url = "/artists/videos/get_artist_video_posts.php";
		req.send(url, "POST");
	}
	
	function artistsCheckkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (keynum == 13 && whichArtist == -1)
		{
			targ.blur();
			artistsGetPage();
		}
		else if ( keynum != 38 && keynum != 40 && keynum != 13 && keynum != 17 && keynum != 18 && keynum != 16 && keynum != 37)
		{
			suggestArtists(targ.id, 'artists_page_suggestions', 0, artistsGetPage);
		}
		else
		{
			chooseArtist(targ.id, 'artists_page_suggestions', keynum, artistsGetPage);
		}
	}
	
	function artistsGetPageCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}
	
	function artistsGetPage()
	{
		var param = "";
		if (document.getElementById('search') != null) {
			var searchValue = document.getElementById('search').value;
			searchValue = searchValue.replace(/ /g,"_");
			param = searchValue;
		}
		var url = "/music/"+param;
		window.location = url;
	}
	
	function artist_chartChange(no, action)
	{
		mp_switchChildImage($('chart_img_left_'+no));
		mp_switchChildImage($('chart_img_right_'+no));
		switch (action)
		{
			case 1:
				$('chart_img_center_'+no).style.background = "url(/artists/img/chart_strip_center_over.gif)";
				$('song_'+no+'_icons').style.display = 'block';
				break;
			case 0:
				$('chart_img_center_'+no).style.background = "url(/artists/img/chart_strip_center.gif)";
				$('song_'+no+'_icons').style.display = 'none';
				break;
		}
	}
	
	function artists_showFansCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		$("artist_box_container").innerHTML= text;
		var top = getScrollY() + 50;
		$("artist_box_container").style.top = top;
		$("artist_box_container").style.left = 20;
		$("artist_box_container").style.display= 'block';
	}

	function artists_showFans(track_id, offset)
	{
		this.artist_track_fans = artists_showFansCB;
		var req = new JSAjaxDoc(this, "artist_track_fans");
		req.addParam("track_id", track_id);
		offset = typeof offset == "undefined" ? 0 : offset;
		req.addParam("offset", offset);
		var url = "/artists/artists_get_fans_box.php";
		req.send(url, "POST");		
	}
	
	function artists_moduleChange(div)
	{
		div = div.parentNode.parentNode;
		div = div.nextSibling;
		while (div.nodeName != "DIV") {
			div = div.nextSibling;
		}
		if (div.style.display == "none") {
			div.style.display = "block";
		} else {
			div.style.display = "none";
		}
	}
	
	function artist_getMoreLovedArtistsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}

	function artist_getMoreLovedArtists(artist_id, artist_name, offset)
	{
		this.artist_loved_artists = artist_getMoreLovedArtistsCallback;
		var req = new JSAjaxDoc(this, "artist_loved_artists");
		req.addParam("artist_id", artist_id);
		req.addParam("artist_name", artist_name);
		req.addParam("offset", offset);
		var url = "/artists/artist_get_loved_artists.php";
		req.send(url, "POST");
		return false;
	}
	
	function artist_createStationByArtistCB(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		favCreateStation(text);
	}
	function artist_createStationByArtist(artist_id)
	{
		this.artist_create_station = artist_createStationByArtistCB;
		var req = new JSAjaxDoc(this, "artist_create_station");
		req.addParam("artist_id", artist_id);
		var url = "/artists/artists_get_fav_track.php";
		req.send(url, "POST");
	}
	function artist_getImageZoomCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )	{	
			return;
		}
		eval(text);
	}

	function artist_getImageZoom(artist_id, artist_image_id, artist_name)
	{
		this.loadAIcallback = artist_getImageZoomCallback;
		var req = new JSAjaxDoc(this, "loadAIcallback");
		req.addParam("artist_id", artist_id);
		req.addParam("artist_image_id", artist_image_id);
		req.addParam("artist_name", artist_name);
		var url = "/artists/artists_get_image_zoom.php";
		req.send(url, "POST");
	}

	function artists_addCommentCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}	
		document.getElementById('photo_comment_box').style.display = "none";
		document.getElementById('photo_comment_textarea').value = "";
		artists_getCommentList(usr_word);	
	}
	
	function artists_addComment(artist_image_id)
	{	
		if ( mp_isFieldEmpty('photo_comment_textarea') )
		{
			document.getElementById('photo_comment_message').innerHTML = "Please fill in comment";
			return;
		}
		this.artists_addC = artists_addCommentCallback;			
		var req = new JSAjaxDoc(this, "artists_addC", artist_image_id);
		req.addParam("artist_image_id", artist_image_id);
		req.addParam("comment", document.getElementById('photo_comment_textarea').value);
		var url = "/artists/artists_add_comment.php";
		req.send(url, "POST");
	}
	
	function artists_getCommentListCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}
		var json = eval("("+text+")");
		document.getElementById('comments_list').innerHTML = json['div'];
		document.getElementById('photo_comments_count').innerHTML = "Comments("+json['count']+")";
	}
	
	function artists_getCommentList(artist_image_id)
	{	
		this.artist_getC = artists_getCommentListCallback;			
		var req = new JSAjaxDoc(this, "artist_getC");
		req.addParam("artist_image_id", artist_image_id);
		var url = "/artists/artists_get_comments.php";
		req.send(url, "POST");
	}
	
	function artists_getTrackFavoriteCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{
			return;
		}
		if ( text == "success" ) {
			var span = (usr_word['action'] == "ADD") ? "is_not" : "is";
			document.getElementById('track_'+usr_word['track_id']+'_'+span+'_favorite').style.display = "none";
			var span2 = (usr_word['action'] == "ADD") ? "is" : "is_not";
			document.getElementById('track_'+usr_word['track_id']+'_'+span2+'_favorite').style.display = "inline";
		}
	}
	
	function artists_track_favorite(track_id, action)
	{
		this.artist_trackF = artists_getTrackFavoriteCallback;			
		usr_word = {};
		usr_word['track_id'] = track_id; 
		usr_word['action'] = action; 
		var req = new JSAjaxDoc(this, "artist_trackF", usr_word);
		req.addParam("track_id", track_id);
		req.addParam("action", action);
		var url = "/app/favorites/save_favorite_track.php";
		req.send(url, "POST");
	}
	
	function artists_getSuggestAlbumCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		$(usr_word+"_not_suggested").style.display = "none";
		$(usr_word+"_suggested").style.display = "inline";
	}
	
	function artists_suggest_album(artist_id, album_id)
	{
		this.artist_albumS = artists_getSuggestAlbumCallback;			
		var req = new JSAjaxDoc(this, "artist_albumS", album_id);
		req.addParam("artist_id", artist_id);
		req.addParam("album_id", album_id);
		var url = "/artists/artists_suggest_album.php";
		req.send(url, "POST");
	}
	
	function artists_showArtistText()
	{
		clearArtistNameError();
		if ( $('artists_showEditBtn') ) {
			$('artists_showEditBtn').style.display = 'none';
		} else if ( $('artists_showAddBtn') ) {
			$('artists_showAddBtn').style.display = 'none';
		}
		$('new_artist_name_div').style.display = 'block';
	}
	
	function artists_hideArtistText()
	{
		$('new_artist_name_div').style.display = 'none';
		if ( $('artists_showEditBtn') ) {
			$('artists_showEditBtn').style.display = 'inline';
		} else if ( $('artists_showAddBtn') ) {
			$('artists_showAddBtn').style.display = 'inline';
		}
		$('new_artist_name').value = $('artists_label_artists').options[$('artists_label_artists').selectedIndex].text;
		clearArtistNameError();
	}	
	
	function artists_changeAdd2Edit()
	{
		if ($('artists_showAddBtn')) {
			$('artists_showAddBtn').innerHTML = 'Edit artist name';
		}
		if ($('artists_addBtn')) {
			$('artists_addBtn').innerHTML = 'Change';
		}
	}	
	
	function artists_editArtistCB (text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		if ( text == "success" )
		{
			$('artists_label_artists').options[$('artists_label_artists').selectedIndex].text = usr_word;
			artists_changeAdd2Edit();
			artists_hideArtistText();
			$('new_artist_name').value = usr_word;
		}
	} 

	function clearArtistNameError()
	{
		$('artist_name_error').style.display = 'none';
		$('artist_name_error').innerHTML = '';
	}

	function artists_editArtist(artist_id)
	{
		var newArtistName = $('new_artist_name').value;
		if ( newArtistName == '' || newArtistName == null ) {
			$('artist_name_error').style.display = 'inline';
			$('artist_name_error').innerHTML = 'Please enter an artist name';
			return false;
		}
		for ( var i = 0; i <  $('artists_label_artists').options.length; i++ ) {
			if ( $('artists_label_artists').options[i].text.toLowerCase() == newArtistName.toLowerCase() ) {
				$('artist_name_error').style.display = 'inline';
				$('artist_name_error').innerHTML = 'This artist is already listed in your label catalog and may be found in the artist name selection box.';
				return false;
			}
		}
		this.artists_editName = artists_editArtistCB;
		var req = new JSAjaxDoc(this, "artists_editName", newArtistName);
		req.addParam("artist_name", newArtistName);
		req.addParam("artist_id", artist_id);
		var url = "/artists/register/edit_artist_name.php";
		req.send(url, "POST");
	}
	
	function artists_changeEditName()
	{
		var  text = $('artists_label_artists').options[$('artists_label_artists').selectedIndex].value;
		for ( var i = 0; i <  $('artists_label_artists').options.length; i++ ) {
			if ( $('artists_label_artists').options[i].text == text ) {
				$('artist_name_error').style.display = 'inline';
				$('artist_name_error').innerHTML = 'Please enter an artist name';
				return false;
			}
		}
		clearArtistNameError();
		$('new_artist_name').value = $('artists_label_artists').options[$('artists_label_artists').selectedIndex].text;
	}

	function artists_switchAccount()
	{
		var  text = $('artists_label_artists').options[$('artists_label_artists').selectedIndex].value;
		var account = text.split("_");
		if (account[0] == 'label') {
			window.location = "music_catalog_label.php?label_id="+account[1];
		} else {
			window.location = "music_catalog.php?artist_id="+account[1];
		}		
	}
	
	function artists_back_toSavePhase()
	{
		$('save_btn').style.display = 'inline';
		$('continue_btn').style.display = 'none';
		$('save_text').style.display = 'none';
	}
	
	// TOP ARTISTS PAGE
	
	function top_artists_trackText(div, track_id, text)
	{
		mp_switchChildImage(div);
		$('top_artists_track_'+ track_id +'').innerHTML = text;
	}
	
	function topArtists_switchGenresCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}

	function topArtists_switchGenres(count, j, genre, key)
	{
		this.topSG = topArtists_switchGenresCallback;	
		var req = new JSAjaxDoc(this, "topSG");

		for ( i=0; i<count; i++ )
		{
			if ( document.getElementById('topArtists_genre_' + i) != null ) 
				document.getElementById('topArtists_genre_' + i).style.fontWeight = "normal";
		}
		document.getElementById('topArtists_genre_' + j).style.fontWeight = "bold";		
		document.getElementById("topA_genre").value = genre;
		document.getElementById('chosen_genre').innerHTML = key;
		req.addParam("genre", genre);
		req.addParam("offset", 0);
		
		if (document.getElementById('topA_filter') != null)
			req.addParam("filter", document.getElementById('topA_filter').value);
		else
			req.addParam("filter",0);
		if (document.getElementById('topA_order') != null)
			req.addParam("order", document.getElementById('topA_order').value);
		else
			req.addParam("order",0);
		if (document.getElementById('top_artist_search') != null)
			req.addParam("searchValue", document.getElementById('top_artist_search').value.toLowerCase());
		else
			req.addParam("searchValue","");
			
		var url = "/top_artists/get_artists.php";
		req.send(url, "GET");
		
	}

	function topArtists_changeOrder(order)
	{
		for (i=0; i<=2; i++)
		{
			document.getElementById('top_artists_sort_' + i).style.fontWeight = "normal";
		}
		$('top_artists_sort_' + order).style.fontWeight = "bold";
		document.getElementById('topA_order').value = order;
		var genre = document.getElementById('topA_genre').value;
		var filter = document.getElementById('topA_filter').value;
		topArtists_getArtists(filter, genre, order, 0);
	}

	function topArtists_getArtistsCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('div_1').innerHTML = text;
	}
	
	
	function topArtists_getArtists(filter, genre, order, offset)
	{
		if (!offset) offset = 0;
		this.topArtists_getJ = topArtists_getArtistsCallback;			
		var req = new JSAjaxDoc(this, "topArtists_getJ");
		if ( typeof filter == 'undefined' || filter == null) {
			filter = document.getElementById('topA_filter').value;
		}	

		if ( typeof genre == 'undefined'  || genre == null) {
			genre = document.getElementById('topA_genre').value;
		}	

		if ( typeof offset == 'undefined'  || offset == null) {
			offset = document.getElementById('topA_offset').value;
		}

		if ( typeof order == 'undefined'  || order == null) {
			order = document.getElementById('topA_order').value;
		}

		if ( document.getElementById('top_artist_search').value != '' ) {
			req.addParam("searchValue", document.getElementById('top_artist_search').value);
		}
		
		req.addParam("filter", filter);
		req.addParam("genre", genre);			
		req.addParam("offset", offset);
		req.addParam("order", order);
		var url = "/top_artists/get_artists.php";
		req.send(url, "GET");
		return false;
	}
	
	function top_artists_seeFansCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY ) {
			return;
		}
		$('artist_'+ usr_word +'_fans_full').innerHTML = text;
		$('artist_'+ usr_word +'_fans').style.display = 'none';
		$('artist_'+ usr_word +'_fans_full').style.display = 'block';
	}
	
	function top_artists_seeFans(artist_id, fans_count)
	{
		if ( $('artist_'+ artist_id +'_fans_full').innerHTML != '' ) {
			$('artist_'+ artist_id +'_fans').style.display = 'none';
			$('artist_'+ artist_id +'_fans_full').style.display = 'block';
			return;
		}
		this.topArtists_seeF = top_artists_seeFansCallback;			
		var req = new JSAjaxDoc(this, "topArtists_seeF", artist_id);
		req.addParam("artist_id", artist_id);			
		req.addParam("fans_count", fans_count);			
		var url = "/top_artists/get_fans.php";
		req.send(url, "POST");
	}
	
	function top_artists_seeAllFans(artist_id)
	{
		memberGetMembersByArtist(artist_id);
	}

	function top_artists_closeFans(artist_id)
	{
		$('artist_'+ artist_id +'_fans').style.display = 'block';
		$('artist_'+ artist_id +'_fans_full').style.display = 'none';
	}

	var top_artist_lastUid = null;
	function top_artists_ChangeLargeUid(artist_id, uid)
	{
		top_artist_lastUid = $('top_artist_lastUid['+artist_id+']').value;
		$('top_artists_large_'+top_artist_lastUid).style.display = 'none';
		$('top_artist_lastUid['+artist_id+']').value = artist_id +'_'+ uid;
		$('top_artists_large_'+ artist_id +'_'+ uid).style.display = 'block';
	}
	
	function topArtistsCheckkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (keynum == 13 && whichArtist == -1)
		{
			targ.blur();
			topArtists_getArtists(null, null, null, 0);
		}
		else if ( keynum != 38 && keynum != 40 && keynum != 13 && keynum != 17 && keynum != 18 && keynum != 16 && keynum != 37)
		{
			suggestArtists(targ.id, 'top_artists_suggestions', 0, topArtists_getArtists);
		}
		else
		{
			chooseArtist(targ.id, 'top_artists_suggestions', keynum, topArtists_getArtists);
		}
	}
	
	function topArtistsInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('top_artists_bar');
		document.title = "Free Internet Radio | Top Artists on MeeMix";
		mp_initPlayer();
		rp_resetRightBottom();
	}
	
	// TOP MUSIC VIDEOS PAGE
	
	function topVideosInit()
	{
		loadLeftPanel('/fun_zone/fun_zone.php');
		selectMeeBar('mee_music_bar', 'mee_music_div');
		setBarBold('top_videos_bar');
		document.title = "Free Internet Radio | Top Vidoes on MeeMix";
		rp_resetRightBottom();
	}
	
	function topVideos_switchGenresCallback(text, xml, status, usr_word)
	{
		if (  status != STATUS_READY  )
		{			
			return;
		}
		document.getElementById('div_1').innerHTML = text;
	}

	function topVideos_switchGenres(count, j, genre, key)
	{
		this.topVSG = topVideos_switchGenresCallback;	
		var req = new JSAjaxDoc(this, "topVSG");

		for ( i=0; i<count; i++ )
		{
			if ( document.getElementById('topVideos_genre_' + i) != null ) 
				document.getElementById('topVideos_genre_' + i).style.fontWeight = "normal";
		}
		document.getElementById('topVideos_genre_' + j).style.fontWeight = "bold";		
		document.getElementById("topV_genre").value = genre;
		document.getElementById('chosen_genre').innerHTML = key;
		req.addParam("genre", genre);
		req.addParam("offset", 0);
		
		if (document.getElementById('topV_filter') != null)
			req.addParam("filter", document.getElementById('topV_filter').value);
		else
			req.addParam("filter",0);
		if (document.getElementById('top_video_search') != null)
			req.addParam("searchValue", document.getElementById('top_video_search').value.toLowerCase());
		else
			req.addParam("searchValue","");
			
		var url = "/top_videos/get_videos.php";
		req.send(url, "GET");
		
	}

	function topVideos_switchFilter(filter)
	{
		for (i=0; i<=2; i++)
		{
			document.getElementById('top_videos_filter_' + i).style.fontWeight = "normal";
		}
		$('top_videos_filter_' + filter).style.fontWeight = "bold";
		document.getElementById('topV_filter').value = filter;
		var genre = document.getElementById('topV_genre').value;
		topVideos_getVideos(filter, genre, 0);
	}
	
	function topVideos_getVideosCallback(text, xml, status, usr_word)
	{
		if ( status != STATUS_READY )
		{			
			return;
		}		
		document.getElementById('div_1').innerHTML = text;
	}
	
	
	function topVideos_getVideos(filter, genre, offset)
	{
		if (!offset) offset = 0;
		this.topVideos_getJ = topVideos_getVideosCallback;			
		var req = new JSAjaxDoc(this, "topVideos_getJ");
		if ( typeof filter == 'undefined' || filter == null) {
			filter = document.getElementById('topV_filter').value;
		}	

		if ( typeof genre == 'undefined'  || genre == null) {
			genre = document.getElementById('topV_genre').value;
		}	

		if ( typeof offset == 'undefined'  || offset == null) {
			offset = document.getElementById('topV_offset').value;
		}

		if ( document.getElementById('top_video_search').value != '' ) {
			req.addParam("searchValue", document.getElementById('top_video_search').value);
		}
		
		req.addParam("filter", filter);
		req.addParam("genre", genre);			
		req.addParam("offset", offset);
		var url = "/top_videos/get_videos.php";
		req.send(url, "GET");
		return false;
	}
	
	function topVideosCheckkey(e)
	{
		var keynum;
		keynum = e.keyCode;
		if (e.target) targ = e.target;
		else if (e.srcElement) targ = e.srcElement;
		if (keynum == 13 && whichArtist == -1)
		{
			targ.blur();
			topVideos_getVideos(null, null, 0);
		}
		else if ( keynum != 38 && keynum != 40 && keynum != 13 && keynum != 17 && keynum != 18 && keynum != 16 && keynum != 37)
		{
			suggestArtists(targ.id, 'top_videos_suggestions', 0, topVideos_getVideos);
		}
		else
		{
			chooseArtist(targ.id, 'top_videos_suggestions', keynum, topVideos_getVideos);
		}
	}
	