/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

/* This is where you must define the images you want to use later.
   Put the document.write line where you want it in the document */

images = new Array(8);
images[0] = "<img src='../images/mainpic_01.jpg' hspace='0' vspace='0' alt='DynCorp International Aviation Engineering Services' width='603' height='287' border='0'>";
images[1] = "<img src='../images/mainpic_02.jpg' hspace='0' vspace='0' alt='DynCorp International Marine Services' width='603' height='287' border='0'>";
images[2] = "<img src='../images/mainpic_03.jpg' hspace='0' vspace='0' alt='DynCorp International Marine Services' width='603' height='287' border='0'>";
images[3] = "<img src='../images/mainpic_05.jpg' hspace='0' vspace='0' alt='DynCorp International Technology Services' width='603' height='287' border='0'>";
images[4] = "<img src='../images/mainpic_06.jpg' hspace='0' vspace='0' alt='DynCorp International Infrastructure Development and Contruction Services' width='603' height='287' border='0'>";
images[5] = "<img src='../images/mainpic_07.jpg' hspace='0' vspace='0' alt='DynCorp International Aviation Operations Services' width='603' height='287' border='0'>";
images[6] = "<img src='../images/mainpic_08.jpg' hspace='0' vspace='0' alt='DynCorp International Engineering Services' width='603' height='287' border='0'>";
images[7] = "<img src='../images/mainpic_09.jpg' hspace='0' vspace='0' alt='DynCorp International Logistics and Contingency Services' width='603' height='287' border='0'>";
/*
use this to display the rotating image from the list above.
you can add images to the list above without having to change the code.
document.write("<DT>" + "" + images[dynimage] + "\n");
*/



/* Start code to rotate images.
 */

// create an instance of the Date object
var now = new Date();
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);

/*Start cookie 1*/
var dynimage = getCookie("dynimage");
// if the cookie wasn't found, this is your first visit
if (!dynimage) {
  dynimage = 0; // the value for the new cookie
} else {
  // increment the counter
  dynimage = parseInt(dynimage) + 1;
  if(dynimage == images.length) {
    dynimage = 0;
  }
}
// set the new cookie
setCookie("dynimage", dynimage, now);
/* End cookie 1 */

/* Start cookie 2 */
var dynimage2 = getCookie("dynimage2");
// if the cookie wasn't found, this is your first visit
if (!dynimage2) {
  dynimage2 = 0; // the value for the new cookie
} else {
  // increment the counter
  dynimage2 = parseInt(dynimage2) + 1;
  if(dynimage2 == 1) {
    dynimage2 =0;
  }
}
setCookie("dynimage2", dynimage2, now);
/* end cookie 2

You can cut and paste the cookie 2 code for as many images as you need. */

