
/* cookie functions */
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}
// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString()+";path=/";
  }
  document.cookie = name + "=" + escape(value) + expire;
}

function dispDate(dateVal) {
DaystoAdd=dateVal
TodaysDate = new Date();
TodaysDay = new Array('Sunday', 'Monday', 'Tuesday','Wednesday', 'Thursday', 'Friday', 'Saturday');
TodaysMonth = new Array('January', 'February', 'March','April', 'May','June', 'July', 'August', 'September','October', 'November', 'December');
DaysinMonth = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');
function LeapYearTest (Year) {
if (((Year % 400)==0) || (((Year % 100)!=0) && (Year % 4)==0)) {
return true;
}
else {
return false;
}
}
CurrentYear = TodaysDate.getYear();
if (CurrentYear < 2000) 
CurrentYear = CurrentYear + 1900;
currentMonth = TodaysDate.getMonth();
DayOffset = TodaysDate.getDay();
currentDay = TodaysDate.getDate();
month = TodaysMonth[currentMonth];
if (month == 'February') {
if (((CurrentYear % 4)==0) && ((CurrentYear % 100)!=0) || ((CurrentYear % 400)==0)) {
DaysinMonth[1] = 29;
}
else {
DaysinMonth[1] = 28;
}
}
days = DaysinMonth[currentMonth];
currentDay += DaystoAdd;
if (currentDay > days) {
if (currentMonth == 11) {
currentMonth = 0;
month = TodaysMonth[currentMonth];
CurrentYear = CurrentYear + 1
}
else {
month =
TodaysMonth[currentMonth+1];
}
currentDay = currentDay - days;
}
DayOffset += DaystoAdd;
function offsettheDate (offsetCurrentDay) {
if (offsetCurrentDay > 6) {
offsetCurrentDay -= 6;
DayOffset = TodaysDay[offsetCurrentDay-1];
offsettheDate(offsetCurrentDay-1);
}
else {
DayOffset = TodaysDay[offsetCurrentDay];
return true;
}
}
offsettheDate(DayOffset);TheDate  = DayOffset + ', ';
TheDate += month + ' ';
TheDate += currentDay + ', '; 
if (CurrentYear<100) CurrentYear="19" + CurrentYear;
TheDate += CurrentYear;
document.write(' '+TheDate);
}

// slide show for the awards/ad area
// needs no fading
var image1=new Image()
image1.src="../images/AustChamAwards310.JPG"
var image2=new Image()
image2.src="../images/AustChamAwards320.JPG"
var image3=new Image()
image3.src="../images/DSC01703.JPG"
//variable that will increment through the images
var step=1
function slideit(){
    //if browser does not support the image object, exit.
    if (!document.images)
        return
    document.images.slide.src=eval("image"+step+".src")
    if (step<3)
        step++
    else
        step=1
    //call function "slideit()" every 2.5 seconds
    setTimeout("slideit()",2500)
}

// slide show for the king zone area
// needs to be fading action
// Set kingZoneSlideShowSpeed (milliseconds)
var kingZoneSlideShowSpeed = 2500;
// Duration of crossfade (seconds)
var crossFadeDuration = 20;
var Pic = new Array();
Pic[0] = '/cms/images/king_zone_1.jpg'
Pic[1] = '/cms/images/king_zone_2.jpg'
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) {
    preLoad[i] = new Image();
    preLoad[i].src = Pic[i];
}
function KingZoneSlideShow() {
    if (document.king_zone_slide) {
        if (document.all) {
            document.images.king_zone_slide.style.filter="blendTrans(duration=2)";
            document.images.king_zone_slide.style.filter="blendTrans(duration=crossFadeDuration)";
            document.images.king_zone_slide.filters.blendTrans.Apply();
        }
            document.images.king_zone_slide.src = preLoad[j].src;
        if (document.all) {
            document.images.king_zone_slide.filters.blendTrans.Play();
        }
        j = j + 1;
        if (j > (p - 1)) j = 0;
        t = setTimeout('KingZoneSlideShow()', kingZoneSlideShowSpeed);
    }
}

// slide show for the activity area
// needs to be fading action
// Set activitySlideShowSpeed (milliseconds)
var activitySlideShowSpeed = 2500;
// Duration of crossfade (seconds)
var crossFadeDuration = 20;
var Pic = new Array();
Pic[0] = '/cms/images/activity_group_1.jpg'
Pic[1] = '/cms/images/activity_group_2.jpg'
Pic[2] = '/cms/images/activity_group_3.jpg'
Pic[3] = '/cms/images/activity_group_4.jpg'
var t;
var a_j = 0;
var a_p = Pic.length;
var a_preLoad = new Array();
for (i = 0; i < a_p; i++) {
    a_preLoad[i] = new Image();
    a_preLoad[i].src = Pic[i];
}
function ActivitySlideShow() {
    if (document.activity_slide) {
        if (document.all) {
            document.images.activity_slide.style.filter="blendTrans(duration=2)";
            document.images.activity_slide.style.filter="blendTrans(duration=crossFadeDuration)";
            document.images.activity_slide.filters.blendTrans.Apply();
        }
            document.images.activity_slide.src = a_preLoad[a_j].src;
        if (document.all) {
            document.images.activity_slide.filters.blendTrans.Play();
        }
        a_j = a_j + 1;
        if (a_j > (a_p - 1)) a_j = 0;
        t = setTimeout('ActivitySlideShow()', activitySlideShowSpeed);
    }
}

