// Set Cookie Expiration in Days
num_days = 1;
// Set cookie name
thiscookie = "aug2011"; 
// Call function to read cookie
readCookie(thiscookie);

// Read Cookie and Display Appropriate Movie
function readCookie(cookieName){
	var start = parseInt(getCookie(cookieName));
	if (!start)
	  {
		  start = 3;
	  }

		switch(start)
			{
		    case 1:
				DisplayMovie('flash/home2_aug2011.swf','393','949')
				// Set new cookie value - increment +1
				setCookie(cookieName,2,num_days)
			  break;
			 case 2:
				DisplayMovie('flash/home3_aug2011.swf','393','949')
				// Set new cookie value - increment +1
				setCookie(cookieName,3,num_days)
			  break;
			case 3:
				DisplayMovie('flash/home1_aug2011.swf','393','949')
				// Set new cookie value - increment +1
				setCookie(cookieName,1,num_days)
			  break;
			default:
			  //code to be executed if visit number is out of scope of cases
			  // alert("out of scope of visit numbers");
			  // alert(start);
			  
			}
}
 
// Set Date for Cookie Expiration - no editing necessary
function ged(noDays){
    var today = new Date();
    var expr = new Date(today.getTime() + noDays*24*60*60*1000);
    return  expr.toGMTString();
}

// Function to display Object tag code
function DisplayMovie(filepath,height,width) {
			document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24" width="' + width + '" height="' + height + '">');
		    document.write('<param name="movie" value="' + filepath + '" />');
		    document.write('<param name="wmode" value="transparent" />');
		    document.write('<!--[if !IE]> <-->');
		    document.write('<object data="' + filepath + '"');
            document.write('        width="' + width + '" height="' + height + '" type="application/x-shockwave-flash">');
		    document.write('  <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />');
		    document.write(' <param name="wmode" value="transparent" />');
		    document.write(' FAIL (the browser should render some flash content, not this).');
	        document.write('</object>');
		    document.write('<!--> <![endif]-->');
	   		document.write('</object>');
}


// Get Cookie
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

// Set Cookie
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} 
