 function showLargeImage(size,type,view,id,width,height) {
	window.open('image.cgi?s='+size+'&t='+type+'&view='+view+'&id='+id,'largeimage','scrollbars=yes,resizable=yes,width='+width+',height='+height);
 }
var slide = 0;
function slideShow() {
    if (slide) {
	slide=0;
	document.getElementById('aslideshow').innerHTML = 'START SLIDE SHOW';
    }
    else {
	slide = 1;
	document.getElementById('aslideshow').innerHTML = 'STOP SLIDE SHOW';
	nextPhoto();
    }
}

function nextPhoto() {
    if (slide) {
	var n = 0;
	for(var i = 0; i < MyImage.length; i++) {
	    var url = MyImage[i].src;
	    url = url.replace('s=medium','s=large');
	    if (document.getElementById('primaryphoto').src == url) {
		n = i;
		break;
	    }
	}
	n++;
	if (n >= MyImage.length) {
	    n = 1;
	}
	
	var url = MyImage[n].src;
	url = url.replace('s=medium','s=large');
	
	document.getElementById('primaryphoto').src=url;
	
//	document.links('carhref').href=MyHref[n];
//	document.links('cardetails').href=MyHref[n];
		
	setTimeout("nextPhoto();", 2000);
    }
}

 function showLargePhoto(size,type,view,id,width,height) {
	var e = document.getElementById('fadepopup');
	e.style.height = document.body.scrollHeight;
	e.style.width = document.body.scrollWidth;
	if (e.style.display == 'none') {
	    e.style.display = 'block';
	    var e2 = document.getElementById('fadephoto');
	    e2.innerHTML = '<div style="opacity:1;filter:alpha(opacity=100);"><table><tr><td align="left"><a href="javascript:slideShow();" id="aslideshow">START SLIDE SHOW</a></td><td align="right"><a href="javascript:hideLargePhoto();" style="color:white;text-decoration:none;">CLOSE X</a></td></tr><tr><td colspan="2"><a href="javascript:hideLargePhoto();"><img src="/image.cgi?s='+size+'&t='+type+'&view='+view+'&id='+id+'" width='+width+' height='+height+' border=0 id="primaryphoto"></a></td></tr></table></div>';
	    e2.style.display = 'block';
	}
 }
 function hideLargePhoto () {
    slide = 0;
    var e1 = document.getElementById('fadepopup');
    e1.style.display = 'none';
    var e2 = document.getElementById('fadephoto');
    e2.style.display = 'none';
 }
var H_STOP = 0;

function HV_Stop ()
{
	H_STOP = 1;
}

function HV_Fade ()
{
	var inext = 0;
	var imin = ImCount[inext];
	for (i = 1; i < ImNum; i ++)
	{
		if (imin > ImCount[i])
		{
			imin = ImCount[i];
			inext = i;
		}
	}
	ImCount[inext] ++;

	var arand = LastArchNum;
	while (arand == LastArchNum) arand = Math.floor(Math.random() * 1000) % ArchNum;
	LastArchNum = arand;

	fade (inext,arand,0,2);


	if (H_STOP == 0)
	{
		setTimeout("HV_Fade();", TimeOut);
	}
}

function fade (inum,anum,opacity,direction)
{
	if (opacity == 0 && direction >= 0)
	{
		document.images['pic'+anum+'a'].src=Jm[inum].src;
	}
	if (opacity <= 0 && direction <= 0)
	{
		opacity = 0;
		return;
	}
	if (opacity >= 100) 
	{
		opacity = 100;
		direction = -direction;

		document.images['pic'+anum].src=Im[inum].src;
	}
	opacity += direction;

	document.images['pic'+anum+'a'].style.filter='Alpha(opacity='+opacity+',style=0)';

	setTimeout("fade("+inum+","+anum+","+opacity+","+direction+");", 20);
}

function LoadHeaderPhotos ()
{
	for (i = 0; i < 3; i ++)
	{
		document.images['pic'+i].src=Im[i].src;
		document.images['pic'+i+'a'].src=Jm[i].src;
	}
}


function floor(number)
{
  return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
}

