function putImage(imgDocID,imgObjName) {
   //window.alert("imgDocID:" + imgDocID + ";\n imgObjName:" + imgObjName +  "\n" +
   //             "document.images[imgDocID].src=" + document.images[imgDocID].src);
   //   imgDocID - the name or number of the document image to be replaced
   //   imgObjName - the name of the image object to be swapped in
   if ( browser ) {
      document.images[imgDocID].src = eval(imgObjName + ".src")
   }
}

function CSURLPopupShow(formName, popupName, target) {
   var popup = document[formName].elements[popupName];
   window.open(popup.options[popup.selectedIndex].value, target);
   //popup.selectedIndex = 0;
}

function searchBoxHelp(formName, e) {
   /*receives form name and search element reference, if the value of this
      element is regexp storyserver, then changes the value to something we know
      that will find the faq that they are looking for
   */
   re = new RegExp;
   re.compile("storyserver", "i");
   var ss = document[formName].elements[e].value;
   searchString = new String(ss);
   caught = searchString.match(re);
   if ( caught ) {
      // here we should change the form value to what we know is good
      document[formName].elements[e].value = "frequently asked questions";
   }
   return;
}

function popUpWindow(path,name,width,height,scroll) {
   

   wid=window.open(path, name, 'toolbar=no,status=no,directories=no,location=no,scrollbars='+scroll+',width='+width+',height='+height);
   if ( wid.opener == null ) wid.opener = window;
}


function checkCurlString(c) {
   // make a regex to check for existing qs from rms etc.
   re = new RegExp;
   re.compile("vgn");
   caught = c.match(re);
   
   return (caught);
}

function vtvPopUp(curl) {
   /*
   Pop up default channel Vtv Window
   */
   /*
   var browser = "ie";
   if (HM_NS4 || HM_NS4old) browser = "ns";
   */
   var url = curl;
   vtv=window.open(url,'vtv','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=610,height=490');
}


function vtvPopUpChannel(curl,channelName) {
   /*
   Pop up a specific channel Vtv Window
   */
   /*
   var browser = "ie";
   if (HM_NS4 || HM_NS4old) browser = "ns";
   */
   if ( checkCurlString(curl) ) {
      var url = curl + "&channelName=" + channelName;
   } else {
      var url = curl + "?channelName=" + channelName;
   }
   vtv=window.open(url,'vtv','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=610,height=490');
}

function vtvPopUpQueued(curl,mediaId) {
   /*
   Pop up specific media Vtv Window
   */
   /*
   var browser = "ie";
   if (HM_NS4 || HM_NS4old) browser = "ns";
   */
   if ( checkCurlString(curl) ) {
      var url = curl + "&mediaId=" + mediaId;
   } else {
      var url = curl + "?mediaId=" + mediaId;
   }
   vtv=window.open(url,'vtv','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=610,height=490');   
}


function getRandomImage() {
   var i = Math.floor(headerImages.length*Math.random());
   return (headerImages[i]);
}

function getRandomImageFrontLeft() {
   var i = Math.floor(frontleftImages.length*Math.random());
   return (frontleftImages[i]);
}

function getRandomImageFrontRight() {
   var i = Math.floor(frontrightImages.length*Math.random());
   return (frontrightImages[i]);
}

function getRandomImageD(style) {
   switch ( style ) {
   case "frontDoorLeft" : 
      var i = Math.floor(frontleftImages.length*Math.random());
      return (frontleftImages[i]);
   case "frontDoorRight" :
      var i = Math.floor(frontrightImages.length*Math.random());
      return (frontrightImages[i]);
   case "header" :
      // drop thru to default anyway
   default: 
      var i = Math.floor(headerImages.length*Math.random());
      return (headerImages[i]);
   }  
}

function getRandomElement(len) {
   var i = Math.floor(len*Math.random());
   return (i);
}

function hasFlash() {
   //alert("Checking flash");
   var plugin = (navigator.mimeTypes && 
                 navigator.mimeTypes["application/x-shockwave-flash"] ? 
                 navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0); 
   //alert(plugin);
   if ( (navigator.appName == "Microsoft Internet Explorer" && 
         navigator.appVersion.indexOf("Mac") == -1 && 
         navigator.appVersion.indexOf("3.1") == -1) || (plugin && 
                                                        parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>= 4) ) {
      //alert("has flash");
      var hasFlash = 1;
      return (1);
   } else {
      //alert("no flash");	
      var hasFlash = 0;
      return (0);
   }
}

function demo(path,name) {
   if ( navigator.appName == 'Microsoft Internet Explorer' && (navigator.platform.substring(0,3) == 'Win') ) {
      var scw=screen.Width-10;
      var sch=screen.Height-52;
      wid=window.open (path,name, "left=0,top=0,width=" + scw + ",height=" + sch);
   } else if ( navigator.appName == 'Microsoft Internet Explorer' && navigator.platform == 'MacPPC' ) {
      wid=window.open (path, name, "screenX=0,screenY=0,outerWidth=" + screen.width + ",outerHeight=" + screen.height);
   } else if ( navigator.appName == 'Netscape' || navigator.platform == 'MacPPC' ) {
      wid=window.open (path,name, "screenX=0,screenY=0,outerWidth=" + screen.width + ",outerHeight=" + screen.height);
   } else {
      
   }
}
