function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its Id
    if(document.getElementById && document.getElementById(objectId)) {
        // W3C DOM
        return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
        // MSIE 4 DOM
        return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
        // NN 4 DOM.. note: this won't find nested layers
        return document.layers[objectId];
    } else {
        return false;
    }
} // getStyleObject

function closeDiv(CloseDivId)
{
  var the_style = getStyleObject(CloseDivId);
  the_style.display = "none";
} // closeDiv

function toggleDisplay(toggleDisplay, toggleId) {
    var theStyle = getStyleObject(toggleId);
    switch (toggleDisplay) {
        case 'on' : theStyle.display = 'block';
        break
        case 'off' : theStyle.display = 'none';
        break
        default : if (theStyle.display=='block'){theStyle.display = 'none';} else {theStyle.display = 'block';} // swap
	}
} // toggleDisplay

function getWindowWidth() {
    var adjustWidth = 0;
    if (isIE) {adjustWidth = 7};
    if (isWindows && isFox) {adjustWidth = -12};
    if (isMac && isFox) {adjustWidth = -5};
    if (isSafari) {adjustWidth = -7};
    if (typeof( window.innerWidth ) == 'number' ) {
      // W3C and others
      return (window.innerWidth + adjustWidth );
    } else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      // IE 6 in 'standards compliant mode'
      return (document.documentElement.clientWidth + adjustWidth) ;
    } else if (document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      // IE 4
      return (document.body.clientWidth + adjustWidth);
    } else { return 750;}
} // getWindowWidth

function getWindowHeight() {
    var adjustHeight = 0;
    if (typeof( window.innerHeight ) == 'number' ) {
      // W3C and others
      return (window.innerHeight + adjustHeight );
    } else if (document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      // IE 6 in 'standards compliant mode'
      return (document.documentElement.clientHeight + adjustHeight) ;
    } else if (document.body && ( document.body.clientHeight || document.body.clientHeight ) ) {
      // IE 4
      return (document.body.clientheight + adjustHeight);
    } else { return 600;}
} // getWindowWidth

var globalSlideFullWidth;
var globalSlideInc;
var globalSlideSpeed
function makeDivWider(theDivId, fullWidth, slideSpeed)
{
    globalSlideFullWidth = fullWidth + 1;
    globalSlideSpeed = slideSpeed;
    globalSlideInc = globalSlideSpeed;

    my_timeout = setTimeout(function () { stretchDiv(theDivId) }, 1);
    // get it moving
} // makeDivWider

function stretchDiv(theDivId)
{
    if (globalSlideInc < globalSlideFullWidth)
    {
      var the_style = getStyleObject(theDivId); // get Div style
      the_style.width = globalSlideInc +"px";
      globalSlideInc = globalSlideInc + globalSlideSpeed;

      my_timeout = setTimeout(function () { stretchDiv(theDivId) }, 1);
      // keep it moving
    }
} // stretchDiv


function openContent(option) {
    var navClass;
    navClass = "nav_";
    navClass += option;
    navClass += "_on";
    document.getElementById("nav_list").className = navClass;

    fadeOut();

    toggleDisplay('off','introducing');
    toggleDisplay('off','latest');
    toggleDisplay('off','find');
    toggleDisplay('off','contact');
    toggleDisplay('off','events');
    toggleDisplay('off','wine');
    toggleDisplay('off','coffee');
    toggleDisplay('off','food');
    toggleDisplay('off','food2');
    toggleDisplay('off','food3');
    toggleDisplay('off','food4');
    toggleDisplay('off','functions');
    toggleDisplay('off','testimonials');
    toggleDisplay('off','special');
    toggleDisplay('off','special2');
    toggleDisplay('off','offers');
    toggleDisplay('off','local-links');

    toggleDisplay('on',option);

    toggleDisplay('on','local-links');

    fadeIn();

} // openContent

var globalSplashState
function openSplash() {
    toggleDisplay('off','introducing');
    toggleDisplay('off','latest');
    toggleDisplay('off','find');
    toggleDisplay('off','contact');
    toggleDisplay('off','events');
    toggleDisplay('off','wine');
    toggleDisplay('off','coffee');
    toggleDisplay('off','food');
    toggleDisplay('off','food2');
    toggleDisplay('off','food3');
    toggleDisplay('off','food4');
    toggleDisplay('off','functions');
    toggleDisplay('off','testimonials');
    toggleDisplay('off','special');
    toggleDisplay('off','special2');
    toggleDisplay('off','offers');
    toggleDisplay('off','local-links');

    toggleDisplay('off','logo');
    toggleDisplay('off','nav');
    toggleDisplay('off','mailing');
    toggleDisplay('off','times');
    toggleDisplay('off','content_and_extras');
    
    toggleDisplay('on','splash');
    globalSplashState = "on";
} // openSplash


function closeSplash(startDiv) {
  if (globalSplashState == "on"){
    toggleDisplay('off','splash');
    toggleDisplay('on','logo');
    toggleDisplay('on','nav');
    toggleDisplay('on','mailing');
    toggleDisplay('on','times');
    toggleDisplay('on','content_and_extras');
    toggleDisplay('on','nav');
    openContent(startDiv);
    toggleDisplay('on','times');
    globalSplashState = "off";
  }
} // closeSplash

function delayCloseSplash() {
    setTimeout("closeSplash('introducing')",500);
} // delayCloseSplash

var opacityC=0 //opacity of image
var increaseC=1 //increase opacity indicator

function fadeContentMoz(){
    if (opacityC<0.79&&increaseC)
        opacityC+=0.1
    else{
        increaseC=0
        opacityC=0.99
    }
    var the_style = getStyleObject('content');
    the_style.MozOpacity=opacityC;
}

function fadeContent(){
    if (opacityC<0.49&&increaseC)
        opacityC+=0.25
    else{
        increaseC=0
        opacityC=0.99
    }
    var the_style = getStyleObject('content');
    the_style.Opacity=opacityC;
}

function fadeOut() {
    var the_style = getStyleObject('content');
    opacityC=0
    if (document.getElementById('content') && document.getElementById('content').style.MozOpacity) //if Mozilla
        the_style.MozOpacity=opacityC;
    if (document.getElementById('content') && document.getElementById('content').style.Opacity) //if W3C
        the_style.Opacity=opacityC;
}

function fadeIn() {
    opacityC=0
    increaseC=1;

    if (document.getElementById('content') && document.getElementById('content').style.MozOpacity) //if Mozilla
    {
        setTimeout('setInterval("fadeContentMoz()",1)', 0)
    }

    if (document.getElementById('content') && document.getElementById('content').style.Opacity) //if W3C
    {
        alert("debug!");
        setTimeout('setInterval("fadeContent()",1)', 0)
    }

}

