function swapScreenshot(tid){
	for (var i=1;i<=4;i++) {
		var image = document.getElementById("image_" + i).style.display = (i == tid ? "inline" : "none");
		var header = document.getElementById("header_" + i).style.display = (i == tid ? "block" : "none");
		var text = document.getElementById("text_" + i).style.display = (i == tid ? "block" : "none");
	}	
}

  function tDay(day) {
    day_arr = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    return day_arr[day];
  }
  function tMonth(month) {
    month_arr = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
    return month_arr[month];
  }
  function t2(num) {
    return (num<10 ? "0"+num : num);
  }
  function CookieDate(date) {
    d = new Date();
    d.setTime(date.getTime() + date.getTimezoneOffset()*60*1000);
    return tDay(d.getDay())+", "+t2(d.getDate())+"-"+tMonth(d.getMonth())+"-"+t2(d.getFullYear()-2000)
        + " "+t2(d.getHours())+":"+t2(d.getMinutes())+":"+t2(d.getSeconds())+" GMT";
  }

  affid="------";
  str = document.location.search.slice(1);
  if (str!="") {
    arr = str.split("&");
    for (var i=0; i < arr.length; i++) {
      arrp = arr[i].split("=");
      if (arrp[0]=="affid") {
        affid = arrp[1].slice(0,5);
        theday = new Date();
        theday.setTime(theday.getTime() + 24*60*60*1000);
        document.cookie = "affid=" + affid + "; path=/; expires=" + CookieDate(theday);
        break;
      }
    }
  }
  if (affid=="------") {
    affid = "";
    coo = document.cookie.split("; ");
    for (i=0; i<coo.length; i++) {
      coo1 = coo[i].split("=");
      if (coo1[0]=="affid") {
        affid = coo1[1].slice(0,5);
      }
    }
  }
