$(document).ready(function() {

// fix png's full page
$(document).pngFix();


// home page
if ( $('#slide').length) {
// use 'random' instead of 'sequence' for random sequence
$('#fp_slide').innerfade({ speed: 'slow', timeout: 6500, type: 'sequence', containerheight: '287px', containerwidth: '520' });
$('#fp_food').innerfade({ speed: 'slow', timeout: 7500, type: 'sequence', containerheight: '243px', containerwidth: '285' });


$.ajax({
url : '_xml/sports_events.xml',
dataType : 'xml',
cache: false,
error: function() { $('#sportsFeed ul').append("<li>Sorry! data wasn't loaded</li>")},
success : function( data ) {

$(data).find('item').each(function(){
var title_text = $(this).find('postTitle').text();
var copy_text = $(this).find('postCopy').text()

$('<li></li>')
.html('<strong>' + title_text + '</strong>' + '<br />' + copy_text)
.appendTo('#sportsFeed ul')
}); // END each

$('#sportsFeed').jScrollPane({showArrows:false, scrollbarWidth: 14}); // have to init after ajax
} // END success
}); // END ajax


$.ajax({
url : '_xml/specials.xml',
dataType : 'xml',
cache: false,
error: function() { $('#specialFeed ul').append("<li>Sorry! data wasn't loaded</li>")},
success : function( data ) {

$(data).find('item').each(function(){
var title_text = $(this).find('postTitle').text();
var copy_text = $(this).find('postCopy').text()

$('<li></li>')
.html('<strong>' + title_text + '</strong>' + '<br />' + copy_text)
.appendTo('#specialFeed ul')
}); // END each

$('#specialFeed').jScrollPane({showArrows:false, scrollbarWidth: 14}); // have to init after ajax
} // END success
}); // END ajax
} // END home page



// espn feed
// not in use but leaving it here for reference
/*
if ( $('#espn').length ) {

$.get("_js/proxy.php", {}, function(data){

var today = $(data).find('station:first').attr('scheduleDate');
var newdate = today.substr(4,2) + '/' + today.substr(6,2) + '/' + today.substr(0,4); 
$('#todayDate').append(newdate);

var station = $(data).find('station:first');

$(station).find('airing').each(function() {
var startTime = $(this).find('startTime').text();
var endTime = $(this).find('endTime').text();
var showName = $(this).find('showName').text();
var site = $(this).find('site').text();

$('<li></li>')
.html('<strong>' + startTime + ' ' + endTime + '</strong><br />' + showName + '<br />' + site)
.appendTo('#espn ul')

}); // END each
}); // END proxy get
} // END espn
*/


// menu nav and show
$('#navMenu a').click(function(){

$('#navMenu a').removeClass('on');
$(this).addClass('on');

$("#menuHolder div[id^='menu']").hide();
var thisTarget = $(this).attr('href');
$(thisTarget).fadeIn();

return false;
});

// show mailing list box
$('a.showList').click(function(){
$('#mailingList').show('fast');
return false;
});


// events calendar page
if ( $('#calHolder').length ) {

// open sign up if you came from home page butn
var hash = window.location.hash;

if (hash == '#mvp' ) {
$('#mailingList').show('fast');
};


$.ajax({
url : '_xml/sports_events.xml',
dataType : 'xml',
cache: false,
error: function() { $('#calHolder ul').append("<li class='red'>Sorry! data wasn't loaded</li>")},
success : function( data ) {

$(data).find('item').each(function(){
var title_text = $(this).find('postTitle').text();
var copy_text = $(this).find('postCopy').text()

$('<li></li>')
.html('<strong>' + title_text + '</strong><br />' + copy_text)
.appendTo('#calHolder ul')
}); // END each

$('#calHolder').jScrollPane({showArrows:false, scrollbarWidth: 14}); // have to init after ajax

} // END success
}); // END ajax
} // END calendar




});
// END dom ready