

var RecaptchaOptions = {theme : 'clean'};

function expandCollapseElement( _oid )
{
	var element = document.getElementById( _oid );
	element.style.display = (element.style.display == "none") ? "block" : "none";
}

function alt_overlay( _id, _alt )
{
	var ele = document.getElementById( _id );
	if( ele )
		ele.style.display = (_alt? "none": "block");
	
	var alt = document.getElementById( _id+"_alt" );
	if( alt )
		alt.style.display = (_alt? "block": "none");	
}

function unvoteSong( songid, tag )
{
	ajax_vote( "vote.php?unvote=1&id="+encodeURI(songid)+"&tag="+encodeURI(tag), 'votebutton_'+songid+'_'+tag );
}

function voteSong( songid, tag )
{	
	ajax_vote( "vote.php?id="+encodeURI(songid)+"&tag="+encodeURI(tag), 'votebutton_'+songid+'_'+tag );
}

function votesClear(songid)
{	
	ajax_vote( "vote.php?clear=1", 'reload_page' );
}

function ajax_vote( url, target_id ) 
{
	var x = document.getElementById( target_id );
	
	var opt = {
	method: 'get',
		onSuccess: function(t) {
		
			if( target_id == 'reload_page' ) window.location.reload();
		
			if( x ) x.innerHTML = t.responseText;
			
			if( target_id != 'message_header' )	ajax_vote( "vote.php?summary", 'message_header' );
		},
		onFailure: function(t) {
		
			if( target_id == 'reload_page' ) window.location.reload();

			if( x ) x.innerHTML = "Error";
		}
	}
	
	new Ajax.Request( url, opt );
	return true;
}  

function ask_login( passthru_url )
{	
	if( passthru_url.length == 0 )
		passthru_url = window.location.pathname+window.location.search;
					
	if( confirm("You need to be signed-in to your Dancetracks account to download the Remix Audio Components.\n\nDo you want to sign-in now?") )
		self.location = "/account/login.php?PASSTHRU_URL="+encodeURIComponent(passthru_url);
		
	return false;
}

function make_xplayer( _link )
{	
	var window_name = "xplayer_make";
	var window_attrs = "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=475,screenX=90,screenY=90,top=90,left=90";
	if( window.open( _link.href, window_name, window_attrs ) )
		return false;
	return true;
}

function load_video1()
{		
	var p = new SWFObject( "/swf/mp3player.swf", "vid1_player", "470", "320", "7" ); 
	
	p.addVariable("file",window.location.pathname+"/images/video.flv");
	p.addVariable("image",window.location.pathname+"/images/video.jpg");
	p.addVariable("backcolor","0x000000");
	p.addVariable("frontcolor","0xffffff");
	p.addVariable("lightcolor","0xC0C0C0");
	p.addVariable("volume","100");
	
	p.write("vid1_player");
}


function remix_player( item_uri )
{		
	var w = get_player_window( item_uri ); 	
	if( w )
	{
		try {
			
			var fn = w.reload_player;
			if( fn )
			{
				fn( item_uri );
				return false;
			}
		} 
		catch( _ex ) { }
	}
	return false;
}




