/*
 * javascript for fishhook vineyards*/

 function loadContent(elementSelector, sourceUrl) {
$(""+elementSelector+"").load(""+sourceUrl+"");
// top.location.scrollTo(-10,-10)

} 
 
//cannot use window.onload with greybox

// Define global variables
var timerID = null;
var timerOn = false;
// number of seconds before menu times out
var timecount = 5500;

//start image fading functions
function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 


// Toggles the layer visibility on
function showLayer(layerName) {
document.getElementById(layerName).style.display = "block";
}

// Toggles the layer visibility off
function hideLayer(layerName) {
document.getElementById(layerName).style.display = "none";
}

function hideAll() {
hideLayer('loveSub');
hideLayer('loveBack');
hideLayer('fishSub');
hideLayer('fishBack');
hideLayer('careSub');
hideLayer('careBack');
hideLayer('drinkSub');
hideLayer('drinkBack');
}
//times out the submenus with inactivity
function startTime() {
if (timerOn == false) {
timerID=setTimeout( "hideAll()", timecount);
timerOn = true;
}
}

function stopTime() {

    if (timerOn) {
    clearTimeout(timerID);
    timerID = null;
    timerOn = false;
}
}
//swaps image backgrounds
function swapBackground_1() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/siftingGrapes.jpg)";}
function swapBackground_2() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/chairs.jpg)";}							
function swapBackground_3() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/barrels.jpg)";}	
function swapBackground_4() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/bottle.jpg)";}	
function swapBackground_5() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/gull.jpg)";}
function swapBackground_6() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/brunch.jpg)";}
function swapBackground_7() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/hull.jpg)";}
function swapBackground_8() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/guides.jpg)";}	
function swapBackground_9() {
	document.getElementById('picWindow').style.backgroundImage = "url(images/bio.jpg)";}	



