// 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='listen.php?id='+song;
	
	/*if(song==0) {
		target='listen.php?id={_ID_}';
	} else {
		target='listen.php?mode=song&id='+song;
	}*/
	showPopUp(target,'listen_window',380,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();
		}
    }
  );
}

LogoSwitcher= {
	curr:0,
	pfx:'./',
	throbber:'style/default/images/Throbber-small.gif'
	//height:100
}

LogoSwitcher.load_logos= function (to_add) {
	
	var total=3;
	this.curr+=to_add;
	if ((this.curr<0) || (this.curr>=LogoSwitcher.logos.length)) {
		this.curr=(this.curr<0)? 0 : LogoSwitcher.logos.length;
		
	}
	if (to_add>0) {
		if ((this.curr+total)>LogoSwitcher.logos.length) {
			this.curr=LogoSwitcher.logos.length-to_add;
		}
	}
	for(var i=0; i<total; i++) {
		$('logo_'+i).src=this.throbber;
		//$('logo_'+i).style.height='16px';
	}
	
	for(var i=0; i<total; i++) {
		var src=this.pfx+this.logos[this.curr+i]
		$('logo_'+i).parentNode.href=src.substr(0, src.length-3)+800;
		$('logo_'+i).src=src;
		//$('logo_'+i).style.height=this.height+'px';
	}
}

