// function allows (amonsgt other things) dynamic changing of style attributes in templates other than those where the call exists
// original code available here - - ->  http://simonwillison.net/2004/May/26/addLoadEvent/

function addLoadEvent(func) { 
  var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 
    window.onload = func; 
  } else { 
    window.onload = function() { 
      oldonload(); 
      func(); 
    } 
  } 
} 

// show or hide various DIV's on VbV page

function vbvShowHide(div_id) {
	// hide all the divs
	document.getElementById('vbv_a').style.display = 'none';
	document.getElementById('vbv_b').style.display = 'none';
	document.getElementById('vbv_c').style.display = 'none';
	document.getElementById('vbv_d').style.display = 'none';
	document.getElementById('vbv_e').style.display = 'none';
	// show the requested div
	document.getElementById('vbv_'+div_id).style.display = 'block';
}

function vbvMouseIn(div_id) {
	document.getElementById('vbvp_'+div_id).className = 'tab_a_Over';
}

function vbvMouseOut(div_id) {
	document.getElementById('vbvp_'+div_id).className = 'tab_a_Out';
}

function showHide(div_id) {
	// hide all the divs
	document.getElementById('a').style.display = 'none';
	document.getElementById('b').style.display = 'none';
	document.getElementById('c').style.display = 'none';
	document.getElementById('d').style.display = 'none';
	document.getElementById('e').style.display = 'none';
	document.getElementById('OrderResult').style.display = 'none';
	// show the requested div
	document.getElementById(div_id).style.display = 'block';
}

// show or hide various DIV's in DETAIL pages
function showHideDetail(div_id) {
	document.getElementById('descr').style.display = 'none';
	document.getElementById('recipes').style.display = 'none';
	document.getElementById(div_id).style.display = 'block';
}

// alternative to target="_blank" link must include rel="external"
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

function printWindow() {
	bV = parseInt(navigator.appVersion); 
	if (bV >= 4) window.print();
}


// INVERAWE ONLY -----------------------------------
// Reminder service

var badDate = new Array;
allDays = 'yes';

function setNumber(num) {
	var n = document.getElementById("services").r_updateNo;
	n.value = num;
	return true;
}
