$(function(){
	$(".toggle").toggleVal("active");

	$('#jApparel').jqm({modal: false, trigger: 'a.apparel_link'});	
	$('#jHardware').jqm({modal: false, trigger: 'a.hardware_link'});				
	$('#scroll_main').jScrollPane();
	
	$('#tweets').tweet({
		join_text: 'auto',
		username: 'lushprod',
		count: 10,
		auto_join_text_default: 'we said,', 
		auto_join_text_ed: 'we',
		auto_join_text_ing: 'we were',
		auto_join_text_reply: 'we replied',
		auto_join_text_url: 'we were checking out',
		loading_text: 'loading tweets...'
	});
	
	setTimeout('checkTwitterBox()', 1000);
	
	$('object').each(function() {
		obj = $(this);
		if (obj.attr('id') !== 'bannerAd') {
			obj.prepend('<param name="wmode" value="transparent"></param>');
			obj.find('embed').attr('wmode', 'transparent');
		}
	});
	var clip = $('#clip-of-the-week').find('object');
	$('#clip-of-the-week').html(clip);
	
});

function checkTwitterBox() {
	if ($('#scroll_twitter .tweet_list li').length >= 3) {
		$('#scroll_twitter').jScrollPane();
	} else {
		setTimeout('checkTwitterBox()', 1000);
	}
}

// For toggling input boxes
jQuery.fn.toggleVal=function(focusClass){this.each(function(){$(this).focus(function()
{if($(this).val()==this.defaultValue){$(this).val("")}if(focusClass)
{$(this).addClass(focusClass)}}).blur(function(){if($(this).val()=="")
{$(this).val(this.defaultValue)}if(focusClass){$(this).removeClass(focusClass)}})})}
