$(document).ready(function(){



$("a[rel^='prettyPhoto']").prettyPhoto({
default_width: 960,
default_height: 400,
iframe_markup: '<iframe src ="{path}?iiiframe=true" width="{width}" height="{height}" frameborder="no" scrolling="no"><\/iframe>'
});

$("a[rel^='prettyPhoto_addmedia']").prettyPhoto({
  default_width: 600
});

$('.poll_archive_post .wp-polls-ans-wrap').hide();
$('.poll_archive_post .wp-polls-ans').prepend('<div class="show_results_please closed_poll">Show Results<\/div>');
$('.show_results_please').click(function(){
if($(this).hasClass('open_poll')){
$(this).next().slideUp(500);
$(this).addClass('closed_poll');
$(this).removeClass('open_poll');
$(this).html('Show Results');
} else {
$(this).next().slideDown(500);
$(this).removeClass('closed_poll');
$(this).addClass('open_poll');
$(this).html('Hide Results');
}
});

$('.live_stream_widget .stream_date_title').hide();
$('.live_stream_widget .stream_day_data').hide();
$('.live_stream_widget .day_1').show();
$('.live_stream_widget #day_1').show();

$('.live_stream_widget .stream_date_title').each(function(){
if($(this).hasClass('day_1')){
} else {
$(this).prepend('<div class="prev_but" title="&laquo; Previous day"><\/div>');
}
$(this).append('<div class="next_but" title="Next day &raquo;"><\/div><div class="clearer"><\/div>');
});

$('.live_stream_widget .stream_date_title:last .next_but').hide();

$('.live_stream_widget .stream_date_title .next_but').click(function(){
var cdiv = $(this).parent().attr('rel');
$('.live_stream_widget #'+cdiv).hide();
$('.live_stream_widget .'+cdiv).hide();
var ndiv = $(this).parent().next().next().attr('rel');
$('.live_stream_widget #'+ndiv).fadeIn(250);
$('.live_stream_widget .'+ndiv).fadeIn(250);
});

$('.live_stream_widget .stream_date_title .prev_but').click(function(){
var cdiv = $(this).parent().attr('rel');
$('.live_stream_widget #'+cdiv).hide();
$('.live_stream_widget .'+cdiv).hide();
var pdiv = $(this).parent().prev().prev().attr('rel');
$('.live_stream_widget #'+pdiv).fadeIn(250);
$('.live_stream_widget .'+pdiv).fadeIn(250);
});

$('.odds_concertina .odds_set').hide();
$('.odds_concertina .odds_0').show();

$('.odds_concertina .show_odds h2').click(function(){
if($(this).hasClass('open_odds')){

} else {
$('.odds_concertina .odds_set').slideUp(500);
$(this).parent().next('.odds_set').slideDown(500);
$('.odds_concertina .show_odds h2').removeClass('open_odds');
$('.odds_concertina .show_odds h2').addClass('closed_odds');
$(this).removeClass('closed_odds');
$(this).addClass('open_odds');
}
});

$('.odds_row').click(function(){
window.location = 'http://www.bet365.com/home/?affiliate=365_050711';
});


$('.team_tab').hide();
$('.first-tab').show();

$('.tabs li a').click(function(){
if($(this).hasClass('tab-current')){

} else {
var my_rel = $(this).attr('rel');
//alert(my_rel);
$('.team_tab').hide();
$('#' + my_rel).show();
$('.tabs li a').removeClass('tab-current');
$(this).addClass('tab-current');
}
return false;
});

});




function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toUTCString()) + ";path=/";
}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

$(document).ready(function(){
if (getCookie("wp_popunder")){

} else {

//switch on the popup
//setCookie("wp_popunder", 'true', 1);
//$.prettyPhoto.open('/wp-content/themes/ffc-theme/b365_frame.php?iframe=true&width=500&height=300','','');


}
});

$(function(){
	$('img.captify').captify({
		// all of these options are... optional
		// ---
		// speed of the mouseover effect
		speedOver: 'fast',
		// speed of the mouseout effect
		speedOut: 'normal',
		// how long to delay the hiding of the caption after mouseout (ms)
		hideDelay: 500,	
		// 'fade', 'slide', 'always-on'
		animation: 'slide',		
		// text/html to be placed at the beginning of every caption
		prefix: '',		
		// opacity of the caption on mouse over
		opacity: '0.7',					
		// the name of the CSS class to apply to the caption box
		className: 'caption-bottom',	
		// position of the caption (top or bottom)
		position: 'bottom',
		// caption span % of the image
		spanWidth: '100%'
	});
});

