 /* ====================================================
 Image Slide Show
==================================================== */

//*** Fader script ***
// http://brainerror.net/scripts/javascript/blendtrans/ for the fade transition

function opacityin(id, opacStart, opacEnd, millisec) { 
//speed for each frame 
var speed = Math.round(millisec / 100); 
var timer = 10; 

//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("changeOpacin(" + i + ",'" + id + "')",(timer * speed)); 
     timer++; 
 } 
} else if(opacStart < opacEnd) { 
 for(i = opacStart; i <= opacEnd; i++) 
 { 
     setTimeout("changeOpacin(" + i + ",'" + id + "')",(timer * speed)); 
     timer++; 
 } 
} 
} 


//change the opacity for different browsers 
function changeOpacin(opacity, id) { 
var object = document.getElementById(id).style; 
	object.filter = "alpha(opacity=" + opacity + ")"; 
	object.opacity = (opacity / 100); 
	object.MozOpacity = (opacity / 100); 
	object.KhtmlOpacity = (opacity / 100); 
}


var nimg = -1;

//**** gallery page forward and back scripts
function imagegallery(nimg) {

	if (nimg<opimages.length-1)
	{
	nimg++
	}
	else if (nimgC>=opimagesC.length-1)
	{
	nimg = 0;
	}
	
	//thisSlide = nimg+1;
	//totslides = opimages.length;
	//slidenumb = "<b>Photo:</b> "+thisSlide+" of "+totslides;
	
	//thisimgid = nimg-1;
	//curimgid = "pgi"+thisimgid;
	//document.getElementById(curimgid).className = "curimg";
	
	document.getElementById("photogallery").innerHTML = '<div id="slidecontainer" class="imagefade"><img src="'+opimages[nimg]+'"  alt="Lant Lane" /></div>';
	opacityin('slidecontainer', 0, 100, 500);
	return true;
}

function imagegalleryL(nimg) {

	if (nimg<opimages.length-1)
	{
	nimg++
	}
	else if (nimgC>=opimagesC.length-1)
	{
	nimg = 0;
	}
	
	document.getElementById("photogalleryL").innerHTML = '<div id="slidecontainerL" class="imagefade"><img src="'+opimages[nimg]+'"  alt="Porsche 911 Turbo project 2008" /><div id="desc">'+opdesc[nimg]+'</div></div>';
	opacityin('slidecontainerL', 0, 100, 500);
	return true;
}



function insurance()
{
	window.open('/insurance.html','','scrollbars=yes,width=550,height=430');
}


function windowOpener(page,w,h)
{
window.open(page,'ImageZoom','resizable=yes,location=no,directories=no,toolbar=no,status=no,scrollbars=no,width='+ 350 + ',height='+ 350);
} 

function windowOpenerlarge(page,w,h)
{
window.open(page,'ImageZoom','resizable=yes,location=no,directories=no,toolbar=no,status=no,scrollbars=no,width='+ 650 + ',height='+ 350);
} 