// Script created by Nick Beech
// www.nbbs.co.uk; www.nbWebsiteDesign.co.uk
// www.LookAndLearnTraining.com and .co.uk
// This script is copyrighted - Please ask permission to reuse

// This script displays two alternating images by setting for a cookie. 
// If the cookie is found, one image is displayed and the cookie deleted. 
// If the cookie is NOT found, the other image is displayed and the cookie created.


function displayImageNowCookie(){

// create variables for dates
var todaysdate = new Date();
var changeduedate = new Date();
// set due date for change to take place 
changeduedate.setFullYear(2009,09,03);
changeduedate.setHours(01);
changeduedate.setMinutes(0);

// check to see whether expiry date has passed
if (todaysdate >= changeduedate) {
	document.write("<a href='contactus/index.asp'><img src='images/openevents28-01.gif' alt='Click here for contact information' width='300' height='600' border='0'></a>");}
	
// now check for cookie to determine which image to display
else {
var cookieValue = document.cookie.match("pictureValue");
if (cookieValue=="pictureValue") {
// now show the first image

  	document.write("<a href='contactus/index.asp'><img src='images/openevents28-01.gif' alt='Click here for contact information' width='300' height='600' border='0'></a>");

	//
	//document.write("<a href='employer/newsandcasestudies.asp'><img src='images/web_tqs_advert.jpg' alt='Click here for details' width='329' //height='428' border='0'></a>");
////document.write("<a href='contactus/index.asp'><img src='images/newyear.jpg' alt='Contact us' width='329' height='428' border='0'></a>");

// now delete the cookie
 
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = "pictureValue=; expires=" + cookie_date.toGMTString();
}

 else {
// now show the second image
	document.write("<a href='employer/newsandcasestudies.asp'><img src='images/web_tqs_advert.jpg' alt='Click here for details' width='329' 	height='428' border='0'></a>");
// now create the cookie
document.cookie = "pictureValue=1;";
}
}
}











