// Set the title with datecode
document.title = "Actividad Paranormal 3 "  + getDateCode(); //Paranormal Activity 3 | Trailer & Official Site | October 21, 2011

// Get date code string
function getDateCode() {
	var str = "21 OCTUBRE";   // Default title
	
	// Get dates and parse them into milliseconds difference from january 01, 1970 
	var currentDate = new Date();
	var currentDate_month = currentDate.getMonth();
	var currentDate_date = currentDate.getDate();
	var currentDate_year = currentDate.getFullYear();
	currentDate = Date.parse(currentDate);
	

	var targetDayAfter  = Date.parse("Oct 22, 2011");
	var targetDate 	    = Date.parse("Oct 21, 2011");
	var targetDayBefore = Date.parse("Oct 20, 2011");
	var targetTomorrow  = Date.parse("Oct 19, 2011");
	var targetWeek      = Date.parse("Oct 17, 2011");
	
	// Set title to appropriate value based on date
	if (currentDate >= targetDayAfter){
		str = "";
		$('#logo_img').attr('src','img/logo.png');
	}
	else if (currentDate >= targetDate && currentDate <= targetDayAfter){
		str = "";
		$('#logo_img').attr('src','img/logo.png');
	}
	else if (currentDate >= targetDayBefore){
		str = "21 OCTUBRE1";
		$('#logo_img').attr('src','img/logo.png');
	}
	else if (currentDate >= targetTomorrow){
		str = "21 OCTUBRE";
		$('#logo_img').attr('src','img/logo.png');
	}
	else if (currentDate >= targetWeek){
		str = "21 OCTUBRE";
		$('#logo_img').attr('src','img/logo.png');
	}
	
	return str;
}


