Enlarge = new Image(); 
Enlarge.src = "/images/enlarge.gif"

function enlarge(Picture)
{
	if (Picture=="shower")
	{
		document.getElementById("shower enlarge").src = Enlarge.src;
	}
	else if (Picture=="sink")
	{
		document.getElementById("sink enlarge").src = Enlarge.src;
	}
	else if (Picture=="pool")
	{
		document.getElementById("pool enlarge").src = Enlarge.src;
	}
	else if (Picture=="block")
	{
		document.getElementById("block enlarge").src = Enlarge.src;
	}
	else if (Picture=="camel")
	{
		document.getElementById("camel enlarge").src = Enlarge.src;
	}
	else if (Picture=="caravan")
	{
		document.getElementById("caravan enlarge").src = Enlarge.src;
	}
	else if (Picture=="waves")
	{
		document.getElementById("waves enlarge").src = Enlarge.src;
	}
	else if (Picture=="rocks")
	{
		document.getElementById("rocks enlarge").src = Enlarge.src;
	}
	else if (Picture=="trees")
	{
		document.getElementById("trees enlarge").src = Enlarge.src;
	}
}

function mouseout()
{
	
	if (document.getElementById("shower enlarge")) document.getElementById("shower enlarge").src = "/images/green.gif";
	if (document.getElementById("sink enlarge")) document.getElementById("sink enlarge").src = "/images/green.gif";
	if (document.getElementById("pool enlarge")) document.getElementById("pool enlarge").src = "/images/green.gif"
	if (document.getElementById("block enlarge")) document.getElementById("block enlarge").src = "/images/green.gif"
	if (document.getElementById("camel enlarge")) document.getElementById("camel enlarge").src = "/images/green.gif"
	if (document.getElementById("caravan enlarge")) document.getElementById("caravan enlarge").src = "/images/green.gif"
	if (document.getElementById("waves enlarge")) document.getElementById("waves enlarge").src = "/images/green.gif"
	if (document.getElementById("rocks enlarge")) document.getElementById("rocks enlarge").src = "/images/green.gif"
	if (document.getElementById("trees enlarge")) document.getElementById("trees enlarge").src = "/images/green.gif"
}
	

function Middle(XorY,size)
{
	if (XorY=='Y')
	{
		if (window.innerHeight) return (window.innerHeight-size)/2;
		else return (document.documentElement.clientHeight-size)/2;
	}
	else
	{
		if (window.innerWidth) return (window.innerWidth-size)/2;
		else return (document.documentElement.clientWidth-size)/2;
	}
}

var picViewer=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 1150;
	var speed = 10;
	var timer = 20;
	var endalpha = 100;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
	show:function(Picture,X,Y){
	if(tt == null){
	tt = document.createElement('div');
	tt.setAttribute('id',id);
	t = document.createElement('div');
	t.setAttribute('id',id + 'top');
	c = document.createElement('div');
	c.setAttribute('id',id + 'cont');
	b = document.createElement('div');
	b.setAttribute('id',id + 'bot');
	tt.appendChild(t);
	tt.appendChild(c);
	tt.appendChild(b);
	document.body.appendChild(tt);
	tt.style.opacity = 0;
	tt.style.filter = 'alpha(opacity=1)';
	}
	tt.style.zIndex="5000"
	tt.style.display = 'block';
	if (Picture=='shower')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/showers_big.png\" alt=\"Shower\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='sink')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/sinks_big.png\" alt=\"Sink\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='pool')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/pool_big.png\" alt=\"Pool\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='block')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/block_big.png\" alt=\"Shower Block\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='camel')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/camel_big.png\" alt=\"Camel Estuary\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='caravan')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/caravans_big.png\" alt=\"Caravans\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='waves')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/waves_big.png\" alt=\"Waves\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='rocks')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/rocks_big.png\" alt=\"Rocks\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}
	if (Picture=='trees')
	{
		c.innerHTML = "<img src=\"http://www.dinhamfarm.co.uk/images/trees_big.png\" alt=\"Trees\" position=\"relative;\"  style=\"z-index:1000;\" onclick=\"picViewer.hide();grayOut(false)\" \/>";
		c.style.backgroundColor = "transparent";
		window.scrollTo(0,0);
	}


	tt.style.position="absolute";
	tt.style.top  = Middle('Y',Y) + 'px';
	tt.style.left = Middle('X',X) + 'px';
	c.style.width= X + "px"
	c.style.height= Y + "px"
	t.style.display = 'block';
	b.style.display = 'block';
	clearInterval(tt.timer);
	tt.timer = setInterval(function(){picViewer.fade(1)},timer);
	},

	fade:function(d){
	var a = alpha;
	if((a != endalpha && d == 1) || (a != 0 && d == -1))
	{
		var i = speed;
		if(endalpha - a < speed && d == 1)
		{
			i = endalpha - a;
		}
		else if(alpha < speed && d == -1)
		{
			i = a;
		}
		
		alpha = a + (i * d);
		tt.style.opacity = alpha * .01;
		tt.style.filter = 'alpha(opacity=' + alpha + ')';
	}
	else
	{
	 clearInterval(tt.timer);
	 if(d == -1){tt.style.display = 'none'}
	}
	},
	hide:function(){
	clearInterval(tt.timer);
	tt.timer = setInterval(function(){picViewer.fade(-1)},timer);
	}
	};
}();
