// JavaScript Document, by tGDA
var lastToggled;
function toggleTab(tabId) {
	var target=document.getElementById('tab_'+tabId);
	var targetText=document.getElementById('tab_desc_'+tabId);
	
	if (targetText.className=="CollapsedTabText") {
			target.className='ExpandedTab';
			targetText.className='ExpandedTabText';
	} else {
			target.className='CollapsedTab';
			targetText.className='CollapsedTabText';
	}
}

//popUpping
function showPopUp(url, window_name, height, width) {	
	var newWindow = window.open(url, window_name, "height="+height+",width="+width);
	newWindow.focus();
}


//Listening...
function listen_to(song) {
	var target='';
	if(song==0) {
		target='listen.php?mode=live';
	} else {
		target='listen.php?mode=song&id='+song;
	}
	showPopUp(target,'listen_window',320,320);
}

function swap_image(new_src) {
	popup_img(new_src);
	//document.getElementById('shown_image').src=new_src;
}

var prev_horo=0;
function display_horo(horo_id) {
	if (prev_horo) {
		document.getElementById('horo_'+prev_horo).style.display="none";
	}
	
	prev_horo=horo_id;
	document.getElementById('horo_'+horo_id).style.display="";
}

/*ROTANA FUN*/
function popup_img(img_src) {

	var img_window=window.open("view_img.php?src="+img_src,"imgs_window","height=400,width=650,location=no,menubar=no,scrollbars=no,status=no,toolbar=no");

	img_window.focus();

}

function get_file(file_uid, is_image) {
	if (is_image) {
		popup_img('filer.php?uid='+file_uid+'%26do=get');
	} else {
		window.open('filer.php?uid='+file_uid+'&do=get');
	}
}

function send2friend(fid) {
	window.open('send2friend.php?id='+fid, 'send2friend', 'height=400,width=400');
}

function m_chooser(fid) {
	window.open('m_chooser.php', 'm_chooser', 'height=200,width=200');
}

function saveRating(element, memo) {
  new Ajax.Request('rate.php?id='+memo.identity, {
	    parameters: {
	    		rate:memo.rated
	    	},
	  	onComplete: function() {
	  			RatingBox.options.indicator=RatingBox.indicatorThanksStr;
	  			RatingBox.updateIndicator();
		}
    }
  );
}
