function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function clearBox(box) {
	 	 	 box.value = "";
	 }
	
function goodbye() {
//run only if no cookie exists-so check to see if we have it
var read_once_cookie = document.cookie;
var split_cookie = read_once_cookie.split(";");
//alert("all cookies are "+document.cookie);
var cookieslength=split_cookie.length;
//alert("cookieslength="+cookieslength);
var  ind=-1;
for (var i=0;i<=cookieslength-1;i++){
//split each cookie
var full_split_cookie=split_cookie[i].split("=");
//alert(full_split_cookie[1]);
	if ( full_split_cookie[1]==1) {
	//alert(full_split_cookie[0]+" exists");
	ind=i;
	 }
}
// we have the position of the cookie in the array-but what if we dont, and it hasnt been set?
// ind will be undefined so if it is we need to pop up the window and set the cookie.
if (ind==-1) {

var month_names = new Array ( );
month_names[month_names.length] = "January";
month_names[month_names.length] = "February";
month_names[month_names.length] = "March";
month_names[month_names.length] = "April";
month_names[month_names.length] = "May";
month_names[month_names.length] = "June";
month_names[month_names.length] = "July";
month_names[month_names.length] = "August";
month_names[month_names.length] = "September";
month_names[month_names.length] = "October";
month_names[month_names.length] = "November";
month_names[month_names.length] = "December";

var day_names = new Array ( );
day_names[day_names.length] = "Sunday";
day_names[day_names.length] = "Monday";
day_names[day_names.length] = "Tuesday";
day_names[day_names.length] = "Wednesday";
day_names[day_names.length] = "Thursday";
day_names[day_names.length] = "Friday";
day_names[day_names.length] = "Saturday";

	//alert("the cookie doesnt exist so we just created it. ind ="+ind);
	//set cookie since it didnt exist;
	
	//set date to be in two weeks i.e. 	today plus 20160000 milliseconds
	
	//example 
	//var expDate = new Date();
	//expDate.setFullYear(expDate.getFullYear() + 1);

	var d=new Date(); //auto sets to todays date;
	//use setDate to add 14 days to create a new expiring time.
	d.setDate(d.getDate()+14);
	//alert (d.toGMTString());
	var the_cookie_date = d.toGMTString();
	var read_once_cookie = "visited=1"+";expires=" + the_cookie_date;
	document.cookie = read_once_cookie;
	alert("opening window");
//	var w=window.open('goodbye.htm','goodbye','width=553,height=450');
//	w.focus();
	}
}
// -->
