jQuery(document).ready(function($) {
//   var video = '<a class="video" href="http://www.youtube.com/watch?v=XcCrTahsLg0">The Legendary Bong Guitar Video</a>';
   var video = '<a class="video" href="hhttp://www.youtube.com/watch?v=wE1i_oQ8se0">The Legendary Bong Guitar Video</a>';
//    var video = '<a class="video" href="http://www.vimeo.com/29725531">the trailer</a>';
    $('#player').youTubeEmbed(video);
    
$('.video').click(function(){
    var video = $(this).attr('href');
    console.log("video:",video, "attr", $(this).attr('href'));
    if (video == 'http://www.youtube.com/watch?v=wE1i_oQ8se0') {
    //$('#player').css("outline", "2px dotted red");
    //console.log('foo');
    //$('#player').youTubeEmbed(video);
    return false;
    } else {
    $('#player').empty();
	$('#player').youTubeEmbed(video);
	return false;
}
});

$('.video_a').click(function(){
    var video = $(this).attr('href');
    window.open(video, "new window", "width=680, height=480");
    return false;
});
  

/*	$('form').submit(function(){
		$('#player').youTubeEmbed($('#url').val());
		$('#url').val('');
		return false;
	}); */
	
$('.booktrailer #poster, #viewtrailer').click ( function() {
    console.log($(this));
    $('.booktrailer #poster').fadeOut();
    $('#vimeoframe').fadeIn();
    $('.booktrailer').animate({height:'349px'}, 300);
    $('#vimeoframe').trigger('click');
    $('.glasses_instructions').fadeOut();
    return false;
    });	
    
$('#get_glasses').click ( function() {
    console.log($(this));
    $('.booktrailer #poster').fadeOut();
    $('#vimeoframe').fadeOut();
    $('.glasses_instructions').fadeIn();
    return false;
    });
});

/* jQuery(document).ready(function($) {
    $('#homepage #menu-edison li').hover(function(){
        console.log($(this).find('a'));
        var link=$(this).find('a');
        $('#ajax_load').empty();
        var whichdiv=link.attr('href');
        console.log(link.attr('href'));
        var splitdiv=whichdiv.split('/');
        console.log('splitdiv', splitdiv[splitdiv.length-1]);
		var loadit = "/homepage-teasers#"+splitdiv[splitdiv.length-1];
		console.log(loadit);
        $('#ajax_load').load(loadit);
        return false;
    });
    });
    
*/
