// Preload MouseOver Images
var use_images = new Array("");
var pl_images = new Array();
for(i=0;i<use_images.length;i++)
{
   pl_images[i] = new Image();
   pl_images[i].src = "images/" + use_images[i];
}

// SubMenu Operation
var submenuin = "";
var submenutime = 100;
function showSubMenu(menuID)
{
   submenuin = menuID;
   document.getElementById(menuID).style.display = "block";
   document.getElementById(menuID).style.zIndex = 5;
}
function hideSubMenu(menuID)
{
   document.getElementById(menuID).style.zIndex = 4;
   setTimeout("doHideSubMenu('" + menuID + "')",submenutime);
   submenuin = "";
}
function doHideSubMenu(menuID)
{
   if(submenuin != menuID)
      document.getElementById(menuID).style.display = "none";
}
function getTopNode(linkElem)
{
   tn = "";
   le = linkElem;
   while (tn != "TABLE")
   {
      le = le.parentNode;
	  tn = le.tagName;
   }
   return le.id;
}

// Flash Detection
function hasFlashVersion(theVersion)
{
   if(!self["MM_FlashCanPlay_" + theVersion])
      return false;
   else
      return true;
}
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
for(i=3;i<=10;i++)
{
   if (plugin)
   {
      var words = navigator.plugins["Shockwave Flash"].description.split(" ");
      for(j=0; j<words.length; j++)
      {
         if (isNaN(parseInt(words[j])))
            continue;
         self["MM_PluginVersion_" + i] = words[j]; 
      }
      self["MM_FlashCanPlay_" + i] = self["MM_PluginVersion_" + i] >= i;
   }
   else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1))
   {
      document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
      document.write('on error resume next \n');
      document.write('MM_FlashCanPlay_' + i + ' = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + i + ')))\n');
      document.write('</SCR' + 'IPT\> \n');
   }
}

// Flash Embedding
function insertFlashApp(theFile, theWidth, theHeight, theFlashVersion, theAlternateCode, theBGColor, theQuality, theID, theWindowMode)
{
   if(!theFlashVersion || !parseInt(theFlashVersion) || parseInt(theFlashVersion) == "")
      theFlashVersion = 3;
   if((!theBGColor && theBGColor != 0) || theBGColor == "")
      theBGColor = "#FFFFFF";
   if((!theQuality && theQuality != 0) || theQuality == "")
      theQuality = "high";

   if(hasFlashVersion(parseInt(theFlashVersion)) && !(!theFile && theFile != 0) && theFile != "" && !(!theWidth && theWidth != 0) && theWidth != "" && !(!theHeight && theHeight != 0) && theHeight != 0)
   {
      var theFlashEmbedCode = "<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"\n"
         + "	CODEBASE=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + theFlashVersion + ",0,0,0\"\n";

      if(!(!theID && theID != 0) && theID != "")
         theFlashEmbedCode += "	ID=\"" + theID + "\"\n";

      theFlashEmbedCode += "	WIDTH=\"" + theWidth + "\"\n"
         + "	HEIGHT=\"" + theHeight + "\"\n";

      theFlashEmbedCode += "	>\n"
      + "	<PARAM NAME=\"movie\" VALUE=\"" + theFile + "\">\n"
      + "	<PARAM NAME=\"quality\" VALUE=\"" + theQuality + "\">\n"
      + "	<PARAM NAME=\"bgcolor\" VALUE=\"" + theBGColor + "\">\n";

      if(!(!theWindowMode && theWindowMode != 0) && theWindowMode != "")
         theFlashEmbedCode += "	<PARAM NAME=\"wmode\" VALUE=\"" + theWindowMode + "\">\n";

      theFlashEmbedCode += "	<EMBED SRC=\"" + theFile + "\"\n";

      if(!(!theID && theID != 0) && theID != "")
         theFlashEmbedCode += "		NAME=\"" + theID + "\"\n";

      theFlashEmbedCode += "		WIDTH=\"" + theWidth + "\"\n"
         + "		HEIGHT=\"" + theHeight + "\"\n"
         + "		QUALITY=\"" + theQuality + "\"\n"
         + "		BGCOLOR=\"" + theBGColor + "\"\n";

      if(!(!theWindowMode && theWindowMode != 0) && theWindowMode != "")
         theFlashEmbedCode += "		WMODE=\"" + theWindowMode + "\"\n";

      theFlashEmbedCode += "		TYPE=\"application/x-shockwave-flash\"\n"
         + "		PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\">\n"
         + "	</EMBED>\n"
         + "</OBJECT><BR>";

      document.write(theFlashEmbedCode);
   }
   else if(theAlternateCode)
      document.write(theAlternateCode);
}

// Open Document in New Window
function openDocument(theDocument,theTarget,theWidth,theHeight,theScrollBars,theResize)
{
   if(theScrollBars=="0")
      theScrollBars = 0;
   else
      theScrollBars = 1;

   if(theResize=="0")
      theResize = 0;
   else
      theResize = 1;

   var winattribs = "toolbar=no,location=no,directories=no,status=no,menubar=no";
   if(theScrollBars)
      winattribs += ",scrollbars=no";
   else
      winattribs += ",scrollbars=yes";
   if(theResize)
      winattribs += ",resizable=no"
   else
      winattribs += ",resizable=yes";

   winattribs += ",width=" + theWidth + ",height=" + theHeight;

   window.open(theDocument,theTarget,winattribs);
}

// Image Popup Window
function popupImage(theImageFile,theWidth,theHeight)
{
   var picwin = window.open("about:blank","_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + theWidth + ",height=" + theHeight);
   picwin.document.open();
   picwin.document.write("<HTML>\n<HEAD>\n	<TITLE>Image</TITLE>\n</HEAD>\n<BODY MARGINHEIGHT=\"0\" MARGINWIDTH=\"0\" TOPMARGIN=\"0\" LEFTMARGIN=\"0\" onBlur=\"window.close()\">\n<IMG SRC=\"" + theImageFile + "\" WIDTH=\"" + theWidth + "\" HEIGHT=\"" + theHeight + "\" BORDER=\"0\" ALT=\"\">\n</BODY>\n</HTML>");
   picwin.document.close();
   picwin.document.focus();
}

// Home Page Slide Show
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;

// Duration of crossfade (seconds)
var crossFadeDuration = 6;

// Specify the image files
var Pic = new Array();
var Link = new Array();

// to add more images, just continue the pattern, adding to the array below
Pic[0] = 'cm/images/SlideShow_01.png'
Pic[1] = 'cm/images/SlideShow_02.png'
Pic[2] = 'cm/images/SlideShow_03.png'
Pic[3] = 'cm/images/SlideShow_04.png'
Pic[4] = 'cm/images/SlideShow_05.png'
Pic[5] = 'cm/images/SlideShow_06.png'
Pic[6] = 'cm/images/SlideShow_07.png'

// do not edit anything below this line
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 runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=8)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}