ClicksToWatch = ['div_tab_left_want', 'div_tab_left_need', 'div_tab_right_do', 'div_tab_right_dont', 'chicklet_facebook', 'chicklet_fanpop', 'chicklet_flickr', 'chicklet_myspace', 'chicklet_twitter', 'div_promo_invitefriends', 'div_promo_teachers', 'featured_literature', 'featured_history', 'featured_poetry', 'featured_comingsoon'];

window.addEvent('load', function()
{
	attachClicks(ClicksToWatch);
});

function attachClicks(_ids)
{
	for(i=0;i<ClicksToWatch.length;i++)
	{
		var el = document.getElementById(ClicksToWatch[i]);
		if( el == undefined )
			return;
		if(window.addEventListener)
			el.addEventListener('click', handleMozClick, false); 
		else
			el.onclick = function(){handleClick(this.id);}
	}
}

function handleMozClick()
{
	handleClick(this.id);
}


function handleClick(_id)
{
	featured_link = document.getElementById(_id).getAttribute("url");
	switch(_id)
	{
		case 'featured_literature':
			Goto(featured_link);
			break;
			
		case 'featured_history':
			Goto(featured_link);
			break;
			
		case 'featured_poetry':
			Goto(featured_link);
			break;
			
		case 'featured_comingsoon':
			Goto('/coming-soon/');
			break;
			
		case 'div_promo_invitefriends':
			invite_friends();	
			break;

		case 'div_promo_teachers':
			Goto('/teachers/');
			break;

		case 'chicklet_facebook':
			Goto('http://www.facebook.com/pages/Shmoop/24546529640');
			break;

		case 'chicklet_fanpop':
			Goto('http://www.fanpop.com/spots/shmoop');
			break;

		case 'chicklet_flickr':
			Goto('http://www.flickr.com/photos/shmoop');
			break;

		case 'chicklet_myspace':
			Goto('http://groups.myspace.com/weheartshmoop');
			break;

		case 'chicklet_twitter':
			Goto('http://www.twitter.com/helloshmoop');
			break;

		case 'div_tab_left_want':
			document.getElementById('div_tab_left_need').style.background = 'none';
			document.getElementById('div_benefits_left_detail_need').style.display = 'none';

			document.getElementById('div_tab_left_want').style.background = ' url(/media/home/02_2009/orange_diagonals.gif)';
			document.getElementById('div_benefits_left_detail_want').style.display = 'block';
			break;
			
		case 'div_tab_left_need':
			document.getElementById('div_tab_left_want').style.background = 'none';
			document.getElementById('div_benefits_left_detail_want').style.display = 'none';

			document.getElementById('div_tab_left_need').style.background =' url(/media/home/02_2009/orange_diagonals.gif)';
			document.getElementById('div_benefits_left_detail_need').style.display = 'block';
			break;

		case 'div_tab_right_do':
			document.getElementById('div_tab_right_dont').style.background = 'none';
			document.getElementById('div_benefits_right_detail_dont').style.display = 'none';

			document.getElementById('div_tab_right_do').style.background = ' url(/media/home/02_2009/blue_diagonals.gif)';
			document.getElementById('div_benefits_right_detail_do').style.display = 'block';
			break;

		case 'div_tab_right_dont':
			document.getElementById('div_tab_right_do').style.background = 'none';
			document.getElementById('div_benefits_right_detail_do').style.display = 'none';

			document.getElementById('div_tab_right_dont').style.background =' url(/media/home/02_2009/blue_diagonals.gif)';
			document.getElementById('div_benefits_right_detail_dont').style.display = 'block';
			break;
	}
}
