var dateForImage = new Date();
var dateImage = dateForImage.getDate();

var nightImageHour = dateForImage.getUTCHours()-5;

/* swaps bg image for our multiple countdowns at multiple times of day regarding a sale that doesn't exist
/* HIDDEN BECAUSE METHOD IS NOT CURRENTLY USED AT THIS TIME
function afterdarkSale(){
	if(nightImageHour < 0){
		document.getElementById('shopsalewrap2').backgroundImage = "http://www.memorysuppliers.com/lib/memorysuppliers/sale-afterdarksale.png";
	}
}
*/


var end_hours = 17;
var end_minutes = 59;
var end_seconds = 59;

var late_end_hours = 23;

function showSaleTimeLeft(){
var current_time = new Date();
 sterile_current_hours = current_time.getUTCHours()-5;
 current_minutes = current_time.getMinutes();
 current_seconds = current_time.getSeconds();
 current_seconds = current_seconds.toString();


/* for 6pm */
current_hours =  end_hours - sterile_current_hours;

/* for midnight */
later_current_hours = late_end_hours - sterile_current_hours;

if(current_hours > end_hours){
	current_hours = current_hours - 18;
} else if(current_hours < 0){
		current_hours = later_current_hours;
}


current_minutes = end_minutes - current_minutes;
current_seconds = end_seconds - current_seconds;

current_seconds = current_seconds.toString();
 if(current_seconds.length < 2){
 	current_seconds = "0"+current_seconds;
 }
 
if (document.getElementById("europe3")) {
	document.getElementById("europe3").innerHTML = "Expires: " + current_hours + "h " + current_minutes + "m " + current_seconds + "s";
}

if (document.getElementById("rcol-shopsale-timer")) {
	document.getElementById("rcol-shopsale-timer").innerHTML = "Expires: " + current_hours + "h " + current_minutes + "m " + current_seconds + "s";
}

}

