// 4
var cookieExpiry = new Date();
cookieExpiry.setTime(cookieExpiry.getTime() + (365*24*60*60*1000));

function setCookie (name, value) {
  var argv = setCookie.arguments;
  var argc = setCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
}
function getCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
function getCookieVal(offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function disableFlash() {
setCookie('disableFlash', 'true', cookieExpiry)
document.location.reload();
}

function enableFlash() {
setCookie('disableFlash','false', cookieExpiry);
document.location.reload();
}

function writeFlashLink(oArg) {

//oArg.width
//oArg.height
//oArg.swf_path
//oArg.image_path
//oArg.image_link

var staticImage = '<a href="'+ oArg.image_link +'" title="What' + "'s" + ' new? Latest events, news, promotions and services."><img src="' + oArg.image_path + '" width="' + oArg.width + '" height="221" style="border:0em;" alt="What' + "'s" + ' new? Latest events, news, promotions and services."></a>';

if (checkForFlash7 != true)
{
document.write(staticImage);
document.write("<br><div align='right' style='width:" + oArg.width + "px;background-color:#E9E9E9;padding-top:.2em;border-bottom:0.05em solid #bebebe;margin-bottom:-0.7em'><a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' target='_blank' title='Update your flash player to enable the animated version'>Update your flash player to enable the animated version&nbsp;</a></div>");
}
else if ((getCookie('disableFlash') == null) || (getCookie('disableFlash') == 'false')) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="' + oArg.width + '" height="' + oArg.height + '"><param name="movie" value="' + oArg.swf_path + '"><param name="quality" value="high"><param name="bgcolor" value="#E9E9E9"><!--[if !IE]> <--><object data="' + oArg.swf_path + '" width="' + oArg.width + '" height="' + oArg.height + '" type="application/x-shockwave-flash"><param name="quality" value="high"><param name="bgcolor" value="#E9E9E9"><param name="pluginurl" value="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"><!--> <![endif]--><div style="width:' + oArg.width + 'px; height: ' + oArg.height + 'px; overflow:auto"><a href="/portal/page?_pageid=221,479311&_dad=portal&_schema=PORTAL" title="What' + "'s" + ' new? Latest events, news, promotions and services."><img src="' + oArg.image_path + '" width="' + oArg.width + '" height="' + oArg.height + '" alt="What' + "'s" + ' new? Latest events, news, promotions and services."></a></div><!--[if !IE]> <--></object><!--> <![endif]--></object>');

// alt="What' + "'s" + ' new? Latest events, news, promotions and services."

document.write("<br><div align='right' style='width:" + oArg.width + "px;background-color:#E9E9E9;padding-top:.2em;border-bottom:0.05 solid #bebebe;margin-bottom:-0.7em'><a href='javascript:disableFlash();' title='Disable this animation'>Disable this animation&nbsp;</a></div>");

} else if (getCookie('disableFlash') == 'true'){
document.write(staticImage);
document.write("<br><div align='right' style='width:" + oArg.width + "px;background-color:#E9E9E9;padding-top:.2em;border-bottom:0.05em solid #bebebe;margin-bottom:-0.7em'><a href='javascript:enableFlash();' title='Enable the animated version'>Enable the animated version&nbsp;</a></div>");
}
}