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

// Courtesy of http://dominiek.com/articles/2007/12/15/ajax-snippet-blank-out-a-div-with-a-spinner
function spin_div(div_id) {
	container = $(div_id);
	// So, IE doesn't like the container method.
	// And Safari doesn't like the getBoundingClientRect method.
	// Firefox, of course, likes both.
	// What's a web developer to do.
	try {
		var posobject = container.getBoundingClientRect();
		positioning = 'top: '+posobject.top+'px; left: '+posobject.left+'px; width: '+container.offsetWidth+'px; height: '+container.offsetHeight+'px; ';
	} catch (err) {
		positioning = 'top: '+container.offsetTop+'px; left: '+container.offsetLeft+'px; width: '+container.offsetWidth+'px; height: '+container.offsetHeight+'px; ';
	}

	Element.insert(container, '<div class="spin_div_container" id="twitter_status" style="position: absolute; ' + positioning + '"><div id="spin_div"></div></div>');
}


function progressPercent(bar, percentage) {
  //document.getElementById(bar).innerHTML = percentage+"%";
	if ($('tweetDownloadStatus').innerHTML == "Loading" || $('tweetDownloadStatus').innerHTML.match(/queue/) || $('tweetDownloadStatus').innerHTML.match(/Verifying/)) {
		secondManualPB = new JS_BRAMUS.jsProgressBar($('tweetDownloadStatus'), percentage, {animate: true, showText: true});
	} else {
		secondManualPB.setPercentage(percentage)
	}
}

