function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

// dropdowns

$('#menu-main li').hover(function() { 
	$(this).find('ul.sub-menu').slideDown();
}, function() { 
	$(this).find('ul.sub-menu').slideUp();
});

// shadowbox

Shadowbox.init({
	player:     "iframe"
});

$(window).load(function(){
	var vars = getUrlVars();
	if(vars.show == 'Y'){
		$('.interviewLink').click();
	} else if(!isNaN(vars.show)){
		//Shadowbox.setup('#videoLink' + vars.show);
		var $selector = $('#videoLink' + vars.show);
		Shadowbox.open({ content:$selector.attr('href')
			, width: 790
			, height: 500
			, player: 'iframe' //assuming longdesc is an flv rather than an image!
			, title: $selector.attr('title') || ''
			, options: {} //if you have options!
		});
	}

	if(!isNaN(vars.show2)){
		//Shadowbox.setup('#videoLink' + vars.show);
		var $selector = $('#shadow' + vars.show2);
		Shadowbox.open({ content:$selector.attr('href')
			, width: 790
			, height: 500
			, player: 'iframe' //assuming longdesc is an flv rather than an image!
			, title: $selector.attr('title') || ''
			, options: {} //if you have options!
		});
	}
});

// sidebar tabs

$('.tabMenu').click(function() { 
	$(this).parent().find('.drop').slideToggle();
	$(this).toggleClass('open');
	$(this).find('a.open').toggle('hide');
	$(this).find('a.close').toggle('show');
});

// Interviews box

$('.interviewLink').click(function() { 
	$(this).parents().find('.interview').slideToggle();
	$(this).toggle('hide');
});

$('.interview a.close').click(function() { 
	$(this).parent().slideToggle();
	$(this).parents().find('.interviewLink').show();
});
