
var browserName = navigator.appName;
var currentPage = '';
var quotes = new Array("Quote_DeGaulle.gif","Quote_JustusvonLiebig.gif","Quote_Montaigne.gif","Quote_Rooney.gif","Quote_Twain.gif","Quote_Minot.gif")
 
function writeQuote(quote)
{  
  if (!quote) {
    no=Math.round(Math.random()*(quotes.length-1));
  } else {
    no=quote;
  }		
  document.write('<table cellspacing="0"><tr><td style="padding-top:20px;padding-bottom:20px"><img width="495" src="images/quotes/' + quotes[no] + '"></td></tr></table>');
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function showMainLinkOn(pageId) {
  var fr;
  
  for (var i=0; i<top.frames.length; i++) {
    if (parent.parent.frames[i].name.indexOf('header')==0){
	  fr=parent.parent.frames[i];
	}
  }
  
  ls=fr.document.anchors;
  
  for (var i=0; i<ls.length;i++) {
	var l=ls[i];
	if (l.style) {	
	  if (l.name == 'a' + pageId) {
	    l.style.display = 'none';
	  } else if (l.name == 'a' + pageId + 'OnState') {
	    l.style.display = 'inline';
	  } else if (l.name.indexOf('OnState') > 0) {
	    l.style.display = 'none';
		var n = l.name.substring(1,l.name.indexOf('OnState'));
		if (browserName=='Netscape') {
		  fr.document.images[n].src = fr.document.images[n + 'Off'].src;
		}
	  } else {
	    l.style.display = 'inline';
	  }	   
	}
  }  
}

function showLinkOn(pageId) {
  var fr;
  
  for (var i=0; i<parent.frames.length; i++) {
    if (parent.frames[i].name.indexOf('Header')>0){
	  fr=parent.frames[i];
	}
  }
  
  ls=fr.document.anchors;
  
  for (var i=0; i<ls.length;i++) {
	var l=ls[i];
	if (l.style) {	
	  if (l.name == 'a' + pageId) {
	    l.style.display = 'none';
	  } else if (l.name == 'a' + pageId + 'OnState') {
	    l.style.display = 'inline';
	  } else if (l.name.indexOf('OnState') > 0) {
	    l.style.display = 'none';
		var n = l.name.substring(1,l.name.indexOf('OnState'));
		if (browserName=='Netscape') {
		  fr.document.images[n].src = fr.document.images[n + 'Off'].src;
		}
	  } else {
	    l.style.display = 'inline';
	  }	   
	}
  }  
}  

function loadBackground(framePrefix,pageID) {
  
  for (var i=0; i<parent.frames.length; i++) {   
    var d; 
    if (parent.frames[i].name.indexOf('Header')>0){
	  d=parent.frames[i].document;
	} else if (parent.frames[i].name.indexOf('Heading')>0){
	  d=parent.frames[i].document;
	} else if (parent.frames[i].name.indexOf('Left')>0){
	  d=parent.frames[i].document;
	}  
	if (d) {
	  if (d.body) {
	    if (d.body.style.backgroundImage.indexOf('Background' + pageID + '.jpg)') < 0) {
          d.body.style.backgroundImage = 'url(images/Background' + pageID + '.jpg)';
		}
	  }
	}  
  }
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}



	  function onImage(sImg) {
		var img = document.images[sImg];
		var imgOn = document.images[sImg + 'On'];
		if (browserName=='Netscape') {
		  img.src=imgOn.src;	
		  img.src=img.src;	
		} else if (img.style) {
		  img.style.display='none';
		  imgOn.style.display='block';
		} else if (img.display) {
		  img.display='none';
		  imgOn.display='block';
		}
	  }
	  
	  function offImage(sImg) {
		var img = document.images[sImg];
		var imgOn = document.images[sImg + 'On'];
		var imgOff = document.images[sImg + 'Off'];
		if (browserName=='Netscape') {
		  img.src=imgOff.src;
		} else if (img.style) {
		  imgOn.style.display='none';
		  img.style.display='block';
		} else if (img.display) {
		  imgOn.display='none';
		  img.display='block';
		}			
	  }
	    


  var emsuffix1 = 'com';
  var emsuffix2 = 'ca';
  var emhome = '@apricotcatering.com';

function writeE(a,b,c,d,e) {
  var eA = a + b + '@' + c + d + '.' + e;
  var eL = "mailto:" + eA;
  document.write('<a href="' + eL + '">' + eA + '</a>');
}

function writeEHome(a) {
  var eA = a + emhome;
  var eL = "mailto:" + eA;
  document.write('<a href="' + eL + '">' + eA + '</a>');
}

function writeEL(emLink,a,b,c,d) {
  var eA = a + b + c + d;
  var eL = "mailto:" + eA;
  document.write('<a href="' + eL + '">' + emLink + '</a>');
}
function writeA(a,b,c,d) {
  var eA = a + b + c + d;
  var eL = "http://" + eA;
  document.write('<a target="_new" href="' + eL + '">' + eA + '</a>');
}
function writeAL(ALink,a,b,c,d) {
  var eA = a + b + c + d;
  var eL = "http://" + eA;
  document.write('<a target="_new" href="' + eL + '">' + ALink + '</a>');
}

function popUpWindow(url, windowName, width, height) {
    var winprops = '';
	var rSize = 'no';
	var sBars = 'no';	
	
	
    if (screen.height < height - 80) {
	  height = screen.height -80;
	  rSize = 'no';
	  sBars = 'yes';
    }
	
	
    if (screen.width < width - 20) {
	  width = screen.width - 20;
	  rSize = 'no'
	  sBars = 'yes';
    }
	  
    var wLeft = (screen.width - width) / 2;
    var wTop = (screen.height - height) / 2 / 4;
	
	winprops = 'width=' + width +
	           ',height=' + height +  
	           ',left=' + wLeft +  
	           ',top=' + wTop +   
	           ',scrollbars=' + sBars + 
	           ',toolbars=no' + 
	           ',resizable=' + rSize + 
	           ',location=no' + 
	           ',menubars=no';
    //alert(height + ': ' + screen.height + '   ' + wTop); 
    window.open(url,windowName,winprops);
  
  }
  
  function writeMenuItem(aMenuItem,aLink,aOn,aImage) {
    if (!aImage) {
	  aImg = aMenuItem;
	} else {
	  aImg = aImage;
	}  
    if (aOn != 0) {
	  document.write('<table cellspacing=\"0\">');
		    document.write('<tr>');
			  document.write('<td class=\"menuItem\"');
			  document.write('><a class=\"menu\">' + aLink + '&nbsp;</a></td>');
		      document.write('<td class=\"menuCircle\"');
		      document.write('><a style=\"display:inline\" name=\"a' + aMenuItem + 'OnState\" id=\"a' + aMenuItem + 'OnState\"><img src=\"images/' + aImage + '-over.jpg\"></a></td>');
			  document.write('<td class=\"menuEnd\"><img src=\"s.gif\" width=\"1\" height=\"1\"></td>');
			document.write('</tr>');
		  document.write('</table>');
	} else {
	  document.write('<table cellspacing=\"0\">');
		    document.write('<tr>');
			  document.write('<td class=\"menuItem\"');
			  document.write('><a class=\"menu\"');
			      document.write('href=\"' + aMenuItem + '\"');
				  document.write('onmouseover=\"onImage(\'' + aMenuItem + '\'); return true;\"');
				  document.write('onmouseout=\"offImage(\'' + aMenuItem + '\'); return true;\"');
				  document.write('onmousedown=\"onImage(\'' + aMenuItem + '\'); return true;\"');
				  document.write('onmouseup=\"onImage(\'' + aMenuItem + '\'); return true;\">' + aLink + '&nbsp;</a></td>');
		      document.write('<td class=\"menuCircle\"');
		      document.write('><a style=\"display:inline;\"');
			      document.write('name=\"a' + aMenuItem + '\"');
				  document.write('id=\"a' + aMenuItem + '\"');
				  document.write('href=\"' + aMenuItem + '\"');
				  document.write('onmouseover=\"onImage(\'' + aMenuItem + '\'); return true;\"');
				  document.write('onmouseout=\"offImage(\'' + aMenuItem + '\'); return true;\"');
				  document.write('onmousedown=\"onImage(\'' + aMenuItem + '\'); return true;\"');
				  document.write('onmouseup=\"onImage(\'' + aMenuItem + '\'); return true;\"');
				document.write('><img style=\"display:block\" name=\"' + aMenuItem + '\" src=\"images/' + aImage + '.jpg\" alt=\"\"');
				document.write('><img style=\"display:none\" name=\"' + aMenuItem + 'On\" src=\"images/' + aImage + '-over.jpg\" alt=\"\"');
				document.write('><img style=\"display:none\" name=\"' + aMenuItem + 'Off\" src=\"images/' + aImage + '.jpg\" alt=\"\"');
				document.write('></a><a style=\"display:none\" name=\"a' + aMenuItem + 'OnState\" id=\"a' + aMenuItem + 'OnState\"><img src=\"images/' + aImage + '-over.jpg\"></a></td>');
			  document.write('<td class=\"menuEnd\"><img src=\"s.gif\" width=\"1\" height=\"1\"></td>');
			document.write('</tr>');
		  document.write('</table>');
	}
  }
  
