// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


//
// copied from: http://www.tek-tips.com/viewthread.cfm?qid=1465395&page=5
// TODO: reference original author...
//
function copy(rubyurl) {
	var flashcopier = 'flashcopier';
	if(!document.getElementById(flashcopier)) {
	  var divholder = document.createElement('div');
	  divholder.id = flashcopier;
	  document.body.appendChild(divholder);
	}
	document.getElementById(flashcopier).innerHTML = '';
	var divinfo = '<embed src="/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(rubyurl)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
	document.getElementById(flashcopier).innerHTML = divinfo;
	$('x_copy_button').hide();
	$('x_copied').show();
}


function updateEntry() {
	var previous_id = $('x_previous_id').value;
	var auto_play_value = $('x_entry_auto_update').value;
  if ( auto_play_value == '1' ) {
    new Ajax.Request('/entries/reload', {asynchronous:true, evalScripts:true, parameters:'previous_id=' + encodeURIComponent(previous_id)}); return false;
  }
}

function pauseShow() {
  $('x_entry_auto_update').value = '0';
  $('x_show_pause').hide();  
  $('x_show_resume').show();
	$('x_previous_tweet').show();
}

function resumeShow() {
  $('x_entry_auto_update').value = '1';
  $('x_show_resume').hide();
  $('x_show_pause').show();
	$('x_previous_tweet').hide();
}
