////////////////////////////////////////////////////////////////////////////////
// core.js : core script vars & functions : v2.0 : (C)2003 YBS                //
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
// we store the ScriptURL here for setNavMenu, etc.
//
var ScriptURL='https://www.cameraconcepts.com/cgi-bin/cart.pl';

// default built-in imagenames /////////////////////////////////////////////
//
var aboutFN='about.gif';
var checkoutFN='checkout.gif';
var contactFN='contact.gif';
var homeFN='home.gif';
var indexFN='index.gif';
var shopcartFN='shopcart.gif';
var moreinfoFN='moreinfo.gif';
var mtw = '700';

// for setGlobalText function //////////////////////////////////////////////
//
var globalHeadText='<FONT size=3 color=#000000 face="Times New Roman"><p align="center"><FONT size=5 color=#000000><B>You Name It....We Have It!</B></FONT></p></FONT>';
var globalFootText='<FONT size=3 color=#000000 face="Times New Roman"><p align="center"><FONT size=5 color=#000000><B>No Better Source on the Planet.</B></FONT></p><p align="center"><FONT size=5 color=#000000><B>(631) 475-1118</B></FONT></p></FONT>';

// browser object detection ////////////////////////////////////////////////
//
var ns6=document.getElementById&&!document.all;
var ie5=document.getElementById&&document.all;
var ns4=document.layers;
var ie4=!document.getElementById&&document.all;

////////////////////////////////////////////////////////////////////////////
// Catalog Header/Footer text is common to all pages; set it appropriately
// on page load:

// Changed 200210.. because About and Contact are now missing headtext...
// and NS4.x bites the wax tadpole... ;-)
//
function setGlobalText() {
  if (globalHeadText != '') {
    if (ie4 || ie5 || ns6) {
      // following condition for about/contact which don't have this div
      if (document.getElementById("headtext")) {
        document.getElementById("headtext").innerHTML = globalHeadText;
      }
    } else if (ns4) {

      // only write if layer exists; insert text wrapped in a table for centering
      if (document.headtextlayer) {
        document.headtextlayer.document.open();
        document.headtextlayer.document.write('<table width="100%"><tr><td width="100%" align="center">'+globalHeadText+'</td></tr></table>');
        document.headtextlayer.document.close();
        document.headtextlayer.left = document.headtspacer.x;
        document.headtextlayer.top = document.headtspacer.y;
      }
    }
  } else {
    if (ie4 || ie5 || ns6) {
      // following condition for about/contact which don't have this div
      if (document.getElementById("headtext")) {
        document.getElementById("headtext").innerHTML = '<!-- headtext -->';
      }
    } else if (ns4) {

      // only write if layer exists
      if (document.headtextlayer) {
        document.headtextlayer.document.open();
        document.headtextlayer.document.write('<!-- headtext -->');
        document.headtextlayer.document.close();
        document.headtextlayer.left = document.headtspacer.x;
        document.headtextlayer.top = document.headtspacer.y;
      }
    }
  }
  if (globalFootText != '') {
    if (ie4 || ie5 || ns6) {
      document.getElementById("foottext").innerHTML = globalFootText;
    } else if (ns4) {
      // insert text wrapped in a table for centering
      document.foottextlayer.document.open();
      document.foottextlayer.document.write('<table width="100%"><tr><td width="100%" align="center">'+globalFootText+'</td></tr></table>');
      document.foottextlayer.document.close();
      document.foottextlayer.left = document.foottspacer.x;
      document.foottextlayer.top = document.foottspacer.y;
    }
  } else {
    if (ie4 || ie5 || ns6) {
      document.getElementById("foottext").innerHTML = '<!-- foottext -->';
    } else if (ns4) {
      document.foottextlayer.document.open();
      document.foottextlayer.document.write('<!-- foottext -->');
      document.foottextlayer.document.close();
      document.foottextlayer.left = document.foottspacer.x;
      document.foottextlayer.top = document.foottspacer.y;
    }
  }
}


////////////////////////////////////////////////////////////////////////////
function browserWarn() {
  alert('Netscape 4.x detected: You should upgrade to Netscape 7.0!');
  document.location.href='http://www.netscape.com/';
}


////////////////////////////////////////////////////////////////////////////
function resetCatLinkDropdown() {
  if (document.forms.catlinkform.catlink) {
    document.forms.catlinkform.catlink.selectedIndex=0;
  }
}


////////////////////////////////////////////////////////////////////////////
function onCatLinkChange(cl) {
  if (ns4) {
    browserWarn();
  } else {
    setGO(cl.value);
  }
}

////////////////////////////////////////////////////////////////////////////
function setGO(page) {
  if (page!=null) {
    for (var i=0; i<document.links.length; i++ ) {
      if (document.links[i].name == 'go') {
        document.links[i].href=page;
      }
    }
  }
}

////////////////////////////////////////////////////////////////////////////
function reportError(err_val) {
  alert( "YBS ERROR:\n\n" + err_val.name + "\n" + err_val.description );
}
