
// 12-06, move all CSS to external file 

    var img1a  = new Image();      img1a.src  = '/images/left-margin.gif';
    var img1b  = new Image();      img1b.src  = '/images/right-margin.gif';
    var img1c  = new Image();      img1c.src  = '/images/header-bg.jpg';
    var img1d  = new Image();      img1d.src  = '/images/footer-background.gif';
    var img1e  = new Image();      img1e.src  = '/images/header-right.gif';
    var camp_nav          = new Image();      camp_nav.src          = '/images/camp-nav.gif';
    var camp_nav_over     = new Image();      camp_nav_over.src     = '/images/camp-nav-over.gif';
    var map_nav           = new Image();      map_nav.src           = '/images/rogue-rec-maps.gif';
    var map_nav_over      = new Image();      map_nav_over.src      = '/images/rogue-rec-maps-over.gif';
    var contact_nav       = new Image();      contact_nav.src       = '/images/contact-rogue-recreation.gif';
    var contact_nav_over  = new Image();      contact_nav_over.src  = '/images/contact-rogue-recreation-over.gif';
    var main_nav          = new Image();      main_nav.src          = '/images/rogue-recreation-main.gif';
    var main_nav_over     = new Image();      main_nav_over.src     = '/images/rogue-recreation-main-over.gif';

function attachRollovers () {
  if (document.getElementById) {
    document.getElementById('camp_link').onmouseover = function() { document.getElementById('camp_nav').src  ='\/images\/camp-nav-over.gif'; };
    document.getElementById('camp_link').onmouseout = function() { document.getElementById('camp_nav').src  ='\/images\/camp-nav.gif'; };
    document.getElementById('map_link').onmouseover = function() { document.getElementById('map_nav').src  ='\/images\/rogue-rec-maps-over.gif'; };
    document.getElementById('map_link').onmouseout = function() { document.getElementById('map_nav').src  ='\/images\/rogue-rec-maps.gif'; };
    document.getElementById('contact_link').onmouseover = function() { document.getElementById('contact_nav').src  ='\/images\/contact-rogue-recreation-over.gif'; };
    document.getElementById('contact_link').onmouseout = function() { document.getElementById('contact_nav').src  ='\/images\/contact-rogue-recreation.gif'; };
    document.getElementById('main_link').onmouseover = function() { document.getElementById('main_nav').src  ='\/images\/rogue-recreation-main-over.gif'; };
    document.getElementById('main_link').onmouseout = function() { document.getElementById('main_nav').src  ='\/images\/rogue-recreation-main.gif'; };
  }
}

window.onload = function() { attachRollovers(); hideTOS(); }; 

// Added for employment app
function hideTOS() {
	if (document.getElementById('tos_row')) {
		document.getElementById('tos_row').style.display='none';
	}
}

function newWindow(title, imgName, width, height) {
  var day = new Date();
  var id = day.getTime();
  var params = 'width=620,height=525,scrollbars,resizable';
  var msg;

  msg = '<!DOCTYPE HTML PUBLIC "-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN" "http:\/\/www.w3.org\/TR\/html4\/loose.dtd">\n'+
        '<html>\n<head>\n<meta http-equiv="Content-Type" content="text\/html; charset=ISO-8859-1">\n'+
	    '<title>'+ title + '<\/title>\n<link rel="stylesheet" type="text\/css" href="data/rr.css">\n<\/head><body class="blk">\n'+
		'<h2 class="white">'+title+'<\/h2><div class="center">\n';
        if (imgName == '') { msg += '<p><strong>Currently no map available for this location.<\/strong><\/p>\n'; }
        else { msg += '<img src="' + imgName + '" width="' + width+ '" height="' + height+ '" border="0" alt="' + title + '">\n'; }
		msg += '<p class="printwin"><a href="#" onClick="window.print(); return false;">Print it</a><\/p>\n';
		msg += '<form><input type="button" onClick="window.close\(\)\;" value="Close Window"><\/form><br><br><\/div><\/body>\n\n<\/html>\n\n';
        newWin = open('', id, params);
        newWin.document.write(msg);
        newWin.document.close();
		return false;
}

function picWindow(url) {
      var day = new Date();
      var id = day.getTime();
      if (url == '') { alert('Pictures coming soon, please check back often!');  }
      else { newWin = open(url, id, 'width=620,height=450,scrollbars'); }
		return false;
}
   
function noCamp(title) {
     var msg;
     if (title == '') {   msg = 'Click on one of the icons wthin the map \n to see a map of the campground layout.'; }
     else {
        msg = 'There is no information on the ' + title + '\n' +
              'camp. We are continually updating our site, so \n' +
              'please check back soon, or give us a call at \n' +
              'the Rogue Recreation office, (541) 560-3900.';
     }
     alert(msg);
}




function checkForm(form) {
   var requireds = new Array("Name", "Email", "Source");
   var checkThis = msg = "";

   if (document.getElementById) {
     for (i=0; i<requireds.length; i++) {
        checkThis = document.getElementById(requireds[i]);
        if (checkThis.value == "") {
            if (requireds[i] == 'Source') {
              msg = 'In an effort to better serve you, please\n' +
                    'tell us how you found out about us.';
            }
            else { msg = 'Please provide your ' + requireds[i] + ' before submitting this form.';  }
            break;
        }
     }
     if ((msg == '') && (form.Email.value != '')) {
       var found = false;
       var emailString = form.Email.value;
       for (j=0; j < emailString.length; j++) {
         if (emailString.charAt(j) == "@") { found = true; }
       }
       if (found == false) {
          msg = 'Is that your true email address?\n' +
                'Please enter your correct email address.\n' +
                'We will not place you on any mailing lists!\n';
       }
     }

     if (msg != '') {  alert(msg);  }
     else { form.submit(); }
  }

}


function decompose(item) {
      var items = new Array ("Styrofoam", "Never", "Aluminum", "80-100 years", "Plastic Bags", "10-20 years",
                             "Plastic Coated Cartons", "5 years", "Plastic Containers", "50-80 years",
                             "Cigarette Butts", "10-12 years", "Leather Shoes", "25-40 years", "Vibram Soles",
                             "50-80 years", "Wool Socks", "6-24 years", "Orange Peels", "up to 6 months", "Paper Containers", "2-5 months");
      var answer = '', msg = '';

      for (i=0;i<items.length;i++) {
          if (item == items[i]) { answer = items[i+1]; break; }
      }
      if (item == 'Styrofoam') { msg = 'Styrofoam will '; }
      else { msg = 'It will take '; }
      msg += answer;
      if (item == 'Styrofoam') { msg += ' decompose! Not ever!'; }
      else { msg += ' for ' + item + ' to decompose!'; }
      alert (msg, 'wow', 'Myfile');
}

