$(window).load(function() {
      Cufon.refresh();
});
$(document).ready(function() {
   
    jQuery.event.add(window, "load", resizeFrame);
  jQuery.event.add(window, "resize", resizeFrame);


//Menu Multimedia drop down scripts
	$('.latest_photos').fancybox();
	
	$("ul.list-photos li a").fancybox();

	$("a.menu-video-link").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
	
	return false;
	});

	$("a.helmet-video").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		: 680,
			'height'		: 495,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
	
	return false;
	});

  //if twitter exists
  if ($('#twitter').length>0) { 
   
      $(function(){
	      $("#twitter").tweet({
	        join_text: "auto",
	        username: ["J_Allgaier","AshleyAllgaier"],
	        avatar_size: 56,
	        count: 2,
			refresh_interval: 0,
	        loading_text: "loading tweets..."
	    });
		
  	});	
  }

  //if twitter exists
  if ($('#twitter-fans').length>0) { 
   
      $(function(){
	      $("#twitter-fans").tweet({
	        join_text: "auto",
	        username: ["J_Allgaier","AshleyAllgaier"],
	        avatar_size: 56,
	        count: 5,
			refresh_interval: 0,
	        loading_text: "loading tweets..."
	    });
		
  	});	
  }

  
  $('ul#list-helmets').cycle({ 
    fx:     'fade', 
    speed:  'fast', 
    timeout: 0, 
    next:   '#next', 
    prev:   '#prev',
   cleartype:true,
   cleartypeNoBg:true 
  });
  
  if ($('#top-news ul.list').length>0) {
	  $('#top-news ul.list').cycle({ 
	    fx:     'fade', 
	    speed:  '500', 
	    timeout: 4000,
	   cleartype:true,
	   cleartypeNoBg:true 
	  });
  }
  
  //onload and resize
function resizeFrame() 
{

    var x = $(window).width();

  if (x < 1020){
    $("body").addClass("minwidth");
  } else{
    $('body').removeClass('minwidth');
  }
	
}
 
    //Cufon

	Cufon.replace('ul#main-nav li a', {hover:true});
	Cufon.replace('a.button', {hover:true});
	//Cufon.replace('#footer ul');
	//Cufon.replace('#footer p');
	//Cufon.replace('#footer p a',{hover:true});
	Cufon.replace('ul.list a', {hover:true});
	
	//home
	Cufon.replace('#feature h2 a', {hover:true});
	Cufon.replace('#feature p');
	
	Cufon.replace('#bottom-content h3 a', {hover:true});
	Cufon.replace('#bottom-content h4');
	Cufon.replace('#bottom-content p');
	Cufon.replace('#bottom-content ul');
	
	
	Cufon.replace('#title h2', {fontFamily: 'Eurostar Black Extended' } );
	Cufon.replace('ul.list-news h3');
	Cufon.replace('ul.list-news .date');
	Cufon.replace('ul.list-news p');
	
	Cufon.replace('table.table-schedules td');


});





