// 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);
}

function hasValue(theField){var fieldType; if(theField[0] && theField[0].type)fieldType = theField[0].type; else fieldType = theField.type; if(fieldType=="text" || fieldType=="password" || fieldType=="textarea" || fieldType=="file" || fieldType=="hidden"){if(theField.value.length==0) return false; else return true;} else if(fieldType.indexOf("select") > -1){var hasAVal = 0; for(i=0;i<theField.options.length;i++){if(theField.options[i].selected && theField.options[i].value != "") hasAVal = 1;} if (hasAVal) return true; else return false;} else if(fieldType=="radio"){var r_ok=0; for(i=0;i<theField.length;i++){if(theField[i].checked) r_ok=1;} if(!r_ok) return false; else return true;} else if(fieldType=="checkbox"){if(theField.checked) return true; else return false;}}
function isNumeric(theValue){if(isNaN(theValue) || theValue == "") return false; else return true;}
function isInteger(theValue){if(isNumeric(theValue) && theValue.indexOf('.') < 0) return true; else return false;}
function isFullName(theValue){if(/[a-z\.]+\s+[a-z\.]+/i.test(theValue)) return true; else return false;}
function isEmail(theValue){if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/i.test(theValue)) return true; else return false;}
function isAbsoluteURL(theValue){if(/^.+:\/\/.+\..+$/i.test(theValue)) return true; else return false;}
function isMonth(theValue){if(isInteger(theValue) && theValue>0 && theValue<=12) return true; else return false;}
function isDay(theValue){if(isInteger(theValue) && theValue>0 && theValue<=31) return true; else return false;}
function isYear(theValue){if(isInteger(theValue) && theValue.length==4 && theValue.charAt(0) != '0') return true; else return false;}
function isDate(theMonth,theDay,theYear){var validDateParts=0, isValidDate=0; if(isMonth(theMonth) && isDay(theDay) && isYear(theYear)) validDateParts = 1; enteredDate = new Date(); enteredDate.setMonth(theMonth-1); enteredDate.setDate(theDay); enteredDate.setYear(theYear); if(enteredDate.getDate() == theDay) isValidDate = 1; if(validDateParts && isValidDate) return true; else return false;}
function isAlphaNumPW(theValue){if(/^[a-z_][a-z0-9_]*$/i.test(theValue)) return true; else return false;}
function isSSNum(theValue){if(/^\d{3}[- ]*\d{2}[- ]*\d{4}$/.test(theValue)) return true; else return false;}
function isCCNum(theValue){if(/^((4\d{3})|(5[1-5]\d{2})|(6011))[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}|3[4,7]\d{13}$/.test(theValue)) return true; else return false;}
function isLocalPhoneNum(theValue){var numCount=0;for(j=0; j<theValue.length; j++){if(isInteger(theValue.charAt(j))) numCount++;} if(/^[0-9\-\s\(\)\*#ext\.]+$/i.test(theValue) && numCount>=7) return true; else return false;}
function isPhoneNum(theValue){var numCount=0;for(j=0; j<theValue.length; j++){if(isInteger(theValue.charAt(j))) numCount++;} if(/^[0-9\-\s\(\)\*#ext\.]+$/i.test(theValue) && numCount>=10) return true; else return false;}
function isZip(theValue){if(/^\d{5}(-\d{4})?$/.test(theValue)) return true; else return false;}
function hasFileExtension(theValue,theExtensionList){var reg = new RegExp("\\.(" + theExtensionList.replace(/( |\.)/gi,"").replace(/,/gi,"|") + ")$","gi"); if(reg.test(theValue)) return true; else return false;}
function isHexColor(theValue){if(/^[A-F0-9]{6}$/i.test(theValue)) return true; else return false;}

// Help Popup Window
function helpMe(subjct,hlptxt)
{
   if(!window.helpwin); else
      window.helpwin.close();
   helpwin = window.open("about:blank","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=230");
   helpwin.document.write(""
      + "<HTML>\n"
      + "<HEAD>\n"
      + "	<TI" + "TLE>HELP - " + subjct.toUpperCase() + "</TITLE>\n"
      + "	<STYLE TYPE=\"text/css\">\n"
      + "	<!--\n"
      + "	BODY, TD {color:#000000; background:#FFFFFF; font-size:12px; font-family:Arial, Helvetica, sans-serif;}\n"
      + "	-->\n"
      + "	</STYLE>\n"
      + "</HEAD>\n"
      + "<BODY BGCOLOR=\"#FFFFFF\" MARGINHEIGHT=\"0\" MARGINWIDTH=\"0\" TOPMARGIN=\"0\" LEFTMARGIN=\"0\">\n"
      + "<DIV ALIGN=\"center\" STYLE=\"width:100%; color:#FFFFFF; background:#000066; padding:3px; font-size:16px; font-weight:bold;\">" + subjct.toUpperCase() + "</DIV>\n"
      + "<DIV STYLE=\"width:100%; padding:4px;\">" + hlptxt + "</DIV>\n"
      + "</BODY>\n"
      + "</HTML>");
   helpwin.document.close();
   helpwin.location.reload();
   helpwin.focus();
}