Cufon.replace('#ColLeft .entry-title');
Cufon.replace('#ColLeft .entry h3');
Cufon.replace('#Voisins h5');

// Returns the window's width
function getWindowWidth() {
	// get window's width
	var myWidth = 1008;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	} else if( document.documentElement && document.documentElement.clientWidth ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	} else if( document.body && document.body.clientWidth ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	}
	return myWidth;
}

// Make the crow move to the right
function slideCrow(x) {
	document.getElementById('CrowBg').style.left = "-"+x+"px";
}

// Start the movement of the crow
function moveCrow() {
	var elt = document.getElementById('CrowBg');
	var windowWidth = getWindowWidth();
	var crowBgMaxWidth = windowWidth - 140;
	var finalPosition = windowWidth - crowBgMaxWidth;
	var tmp = windowWidth + 70;
	var delai = 1000;
	elt.style.left = "-"+tmp+"px";
	$('#Crow').css('visibility', 'visible');
	while(tmp>finalPosition){
		tmp -= 54;
		setTimeout("slideCrow('"+tmp+"')",delai);
		delai += 500;
	}
}


// Preloads the menu images
var imgPath       = "http://www.festival-blogs-bd.com/design2009/images/media/menu/";

imgInfo       = new Image();
imgInfo.src   = imgPath + "informations.jpg";
imgInfo2     = new Image();
imgInfo2.src  = imgPath + "informations-over.jpg";
imgProg       = new Image();
imgProg.src   = imgPath + "programme.jpg";
imgProg2     = new Image();
imgProg2.src  = imgPath + "programme-over.jpg";
imgPlan       = new Image();
imgPlan.src   = imgPath + "plan.jpg";
imgPlan2     = new Image();
imgPlan2.src  = imgPath + "plan-over.jpg";
imgVideos       = new Image();
imgVideos.src   = imgPath + "videos.jpg";
imgVideos2     = new Image();
imgVideos2.src  = imgPath + "videos-over.jpg";
imgContact       = new Image();
imgContact.src   = imgPath + "contact.jpg";
imgContact2     = new Image();
imgContact2.src  = imgPath + "contact-over.jpg";
imgConference       = new Image();
imgConference.src   = imgPath + "conference.jpg";
imgConference2     = new Image();
imgConference2.src  = imgPath + "conference-over.jpg";

// Gere le rollover du menu
function rollOverMe(img) {
  
  switch(img.name){
    
    case 'imgInfo':
      img.src = imgInfo2.src;
      break;
        
    case 'imgProg':
      img.src = imgProg2.src;
      break;
        
    case 'imgPlan':
      img.src = imgPlan2.src;
      break;
	  
	case 'imgVideos':
      img.src = imgVideos2.src;
      break;
	  
	case 'imgContact':
      img.src = imgContact2.src;
      break;
	  
	case 'imgConference':
      img.src = imgConference2.src;
      break;
	
    default:
      alert('Fatal Error : your computer is about to crash. Press "OK" to continue then run for your life.');  

  }
}

// Gere le rollover du menu
function rollOutMe(img) {

  switch(img.name){
    
    case 'imgInfo':
      img.src = imgInfo.src;
      break;
    
    case 'imgProg':
      img.src = imgProg.src;
      break;
    
    case 'imgPlan':
      img.src = imgPlan.src;
      break;
	  
    case 'imgVideos':
      img.src = imgVideos.src;
      break;
	  
	case 'imgContact':
      img.src = imgContact.src;
      break;
	  
	case 'imgConference':
      img.src = imgConference.src;
      break;
    
    default:
      alert('Fatal Error : your computer is about to crash. Press "OK" to continue then run for your life.');  

  }
}

function loadInterviews(){
	$('#BlocInterviews').load('http://www.festival-blogs-bd.com/liste-interviews.html #Content');
}

$(document).ready(function() {
	moveCrow();
	setTimeout('loadInterviews()', 8000); 
});
