/* Author: Graeme Reed - http://www.graemereed.ca

*/

$(function(){
	
	// Initiate Dropdown Menu
	$('ul.sf-menu').superfish();
	
	// Validator
	$("#ecomedyLogin").validator({
		singleError: true,
		message: '<div><div class="arrow-right"></div></div>',
		position: 'center left',
		offset: [0, -176]
	});

	$(document).ready(function() {
	
		// Add img 'frame' to current event 
		currentThumb = "<img src='img/upcoming-thumb-current.png' class='frame'>"
		$('#upcomingThumbs .thumbs').find('.current').append(currentThumb);
	
		// Add class 'odd' to odd upcoming list items
		$('#upcomingList .list').children('li:nth-child(odd)').addClass('odd');
		
		// jquery to make select boxs look sexy
		if (!$.browser.opera) {
					// select element styling
					$('select.select').each(function(){
						var title = $(this).attr('title');
						if( $('option:selected', this).val() != ''  ) title = $('option:selected',this).text();
						$(this)
							.css({'z-index':10,'opacity':0,'-khtml-appearance':'none'})
							.after('<span class="select">' + title + '</span>')
							.change(function(){
								val = $('option:selected',this).text();
								$(this).next().text(val);
								})
					});
				};
	 });
	
	// Make sure google directions links open in new tab
	$('.gadget a[href^="http://"]').attr("target", "_blank");
	// Give gadget container class for styling
	$('.gadget').find('div').addClass('custom-gadget');
});























