﻿var category = 1;
var imgno = 3
function init() {
	var orange  =  document.getElementById("o");
	orange.style.color = "#ffff00";
	change_category( 1, 1 )
}
function imgHover(list)
{
	var i =  document.getElementById("move_l");
	if( list ) {		
		i.style.backgroundImage = "url(images/gallery_selector_images/arrows/l_hover_20x30.gif)";
	}
	else{
		var i =  document.getElementById("move_r");
		i.style.backgroundImage = "url(images/gallery_selector_images/arrows/r_hover_20x30.gif)";
	}
	document.body.style.cursor = "hand";
	document.body.style.cursor = "pointer";
}
function imgunHover(list)
{
	var i =  document.getElementById("move_l");
	i.style.backgroundImage = "url(images/gallery_selector_images/arrows/l_20x30.gif)";
	i =  document.getElementById("move_r");
	i.style.backgroundImage = "url(images/gallery_selector_images/arrows/r_20x30.gif)";
	document.body.style.cursor = "auto";
}
function cathover(ref){ 
	var i =  document.getElementById(ref);
	document.body.style.cursor = "hand";
	document.body.style.cursor = "pointer";
	ref.className = "selected";
}
function catunhover(ref){
	var i =  document.getElementById(ref);
	ref.className = "unselected";
	document.body.style.cursor = "auto";
}
function moveImage( up_or_down ) { 
	var i =  document.getElementById("gallery");
	i.style.backgroundColor = "#b6b7ad";
	if ( up_or_down ) imgno = imgno + 1;
	if ( !up_or_down ) imgno = imgno - 1;	
	var from = "images/orangery_show/" + imgno + ".jpg";
	if ( category == 1 ) from = "images/orangery_show/" + imgno + ".jpg";
	if ( category == 2 ) from = "images/conservatory_show/" + imgno + ".jpg";
	if ( category == 3 ) from = "images/extension_show/" + imgno + ".jpg";
	if ( category == 4 ) from = "images/drives_patios_show/" + imgno + ".jpg";
	getLoad( from );
	document.body.style.cursor = "hand";
	document.body.style.cursor = "pointer";
	check_up_and_down( imgno);
}
function check_up_and_down() {
	var i;
	if(imgno > 4 ) {
		i =  document.getElementById("move_r");
		i.style.visibility = "hidden";	
	}
	else {
		i =  document.getElementById("move_r");
		i.style.visibility = "visible";	
	}
	if ( imgno < 2 ) {
		i =  document.getElementById("move_l");
		i.style.visibility = "hidden";	
	}
	else {
		i =  document.getElementById("move_l");
		i.style.visibility = "visible";	
	}
}
function getLoad( locator ) {
	var img01 = loadImage( locator );
	setTimer( img01 );
}
function setTimer( image_name )
{
	time_out_check = setTimeout(function(){checkProgress(image_name)},100);
}
function checkProgress( image_name )
{	
	if ( image_name.complete ) 
	{ 		

			var showelement =  document.getElementById("gallery");

			clearTimeout(time_out_check); 
			showelement.style.backgroundImage = "url(" + image_name.src + ")";
	}
	else
	{
		setTimer( image_name );
	}
}
function loadImage( xMin ) {
	var a01 = new Image();
	a01.src = xMin;
	return a01;
}
function change_category( catno, dieser ) {
	category = catno;
	imgno = 3;
	var a = document.getElementById("o");
	a.style.color = "#00bd00";
	var b = document.getElementById("c");
	b.style.color = "#00bd00";	
	var c = document.getElementById("e");
	c.style.color = "#00bd00";
	var d = document.getElementById("d");
	d.style.color = "#00bd00";	
	if ( category == 1 ) {
		from = "images/orangery_show/" + imgno + ".jpg";
		var oran  =  document.getElementById("o");
		oran.style.color = "#ff3300";
	}
	if ( category == 2 ) {
		from = "images/conservatory_show/" + imgno + ".jpg";
		var cons  =  document.getElementById("c");
		cons.style.color = "#ff3300";		
	}
	if ( category == 3 ) from = "images/extension_show/" + imgno + ".jpg";
	if ( category == 4 ) from = "images/drives_patios_show/" + imgno + ".jpg";
	getLoad( from );
	var i =  document.getElementById("move_r");
	i.style.visibility = "visible";		
	document.body.style.cursor = "auto";
	i =  document.getElementById("move_l");
	i.style.visibility = "visible";	
}
var intvalref;
var image_increment = 0;
var pace = 3000;
var fade = 10;
var image_array = new Array() 
image_array[0] = 'images/pop_up_gallery/BlakeHillCrescent/1.jpg'
image_array[1] = 'images/pop_up_gallery/BlakeHillCrescent/2.jpg'
image_array[2] = 'images/pop_up_gallery/BlakeHillCrescent/10.jpg'
image_array[3] = 'images/pop_up_gallery/ThornyHill/2.jpg'
image_array[4] = 'images/pop_up_gallery/RozellManor/1.jpg'
image_array[5] = 'images/pop_up_gallery/RadcottsRoad/1.jpg'
image_array[6] = 'images/pop_up_gallery/RadcottsRoad/5.jpg'
image_array[7] = 'images/pop_up_gallery/WillowDrive/2.jpg'
image_array[8] = 'images/pop_up_gallery/WillowDrive/1.jpg'
image_array[9] = 'images/pop_up_gallery/LowtherRoad/2.jpg'
image_array[10] = 'images/pop_up_gallery/BlakeHillCrescent/1.jpg'
image_array[11] = 'images/pop_up_gallery/BlakeHillCrescent/2.jpg'
image_array[12] = 'images/pop_up_gallery/BlakeHillCrescent/3.jpg'
image_array[13] = 'images/pop_up_gallery/BlakeHillCrescent/4.jpg'
image_array[14] = 'images/pop_up_gallery/BlakeHillCrescent/5.jpg'
image_array[15] = 'images/pop_up_gallery/BlakeHillCrescent/6.jpg'
image_array[16] = 'images/pop_up_gallery/BlakeHillCrescent/7.jpg'
image_array[17] = 'images/pop_up_gallery/BlakeHillCrescent/8.jpg'
image_array[18] = 'images/pop_up_gallery/BlakeHillCrescent/9.jpg'
image_array[19] = 'images/pop_up_gallery/BlakeHillCrescent/10.jpg'
image_array[20] = 'images/pop_up_gallery/BlakeHillCrescent/11.jpg'
image_array[21] = 'images/pop_up_gallery/BlakeHillCrescent/12.jpg'
image_array[22] = 'images/pop_up_gallery/BlakeHillCrescent/13.jpg'
image_array[23] = 'images/pop_up_gallery/BlakeHillCrescent/14.jpg'
image_array[24] = 'images/pop_up_gallery/BlakeHillCrescent/15.jpg'
image_array[25] = 'images/pop_up_gallery/BlakeHillCrescent/16.jpg'
image_array[26] = 'images/pop_up_gallery/ThornyHill/1.jpg'
image_array[27] = 'images/pop_up_gallery/ThornyHill/2.jpg'
image_array[28] = 'images/pop_up_gallery/ThornyHill/3.jpg'
image_array[29] = 'images/pop_up_gallery/ThornyHill/4.jpg'
image_array[30] = 'images/pop_up_gallery/RozellManor/1.jpg'
image_array[31] = 'images/pop_up_gallery/RozellManor/2.jpg'
image_array[32] = 'images/pop_up_gallery/RozellManor/3.jpg'
image_array[33] = 'images/pop_up_gallery/RozellManor/4.jpg'
image_array[34] = 'images/pop_up_gallery/RadcottsRoad/1.jpg'
image_array[35] = 'images/pop_up_gallery/RadcottsRoad/2.jpg'
image_array[36] = 'images/pop_up_gallery/RadcottsRoad/3.jpg'
image_array[37] = 'images/pop_up_gallery/RadcottsRoad/4.jpg'
image_array[38] = 'images/pop_up_gallery/RadcottsRoad/5.jpg'
image_array[39] = 'images/pop_up_gallery/RadcottsRoad/6.jpg'
image_array[40] = 'images/pop_up_gallery/RadcottsRoad/7.jpg'
image_array[41] = 'images/pop_up_gallery/RadcottsRoad/8.jpg'
image_array[42] = 'images/pop_up_gallery/RadcottsRoad/9.jpg'
image_array[43] = 'images/pop_up_gallery/WillowDrive/1.jpg'
image_array[44] = 'images/pop_up_gallery/WillowDrive/2.jpg'
image_array[45] = 'images/pop_up_gallery/WillowDrive/3.jpg'
image_array[46] = 'images/pop_up_gallery/WillowDrive/4.jpg'
image_array[47] = 'images/pop_up_gallery/LowtherRoad/1.jpg'
image_array[48] = 'images/pop_up_gallery/LowtherRoad/2.jpg'
image_array[49] = 'images/pop_up_gallery/LowtherRoad/3.jpg'
image_array[50] = 'images/pop_up_gallery/LowtherRoad/4.jpg'
image_array[51] = 'images/pop_up_gallery/LowtherRoad/5.jpg'
image_array[52] = 'images/pop_up_gallery/LowtherRoad/6.jpg'
image_array[53] = 'images/pop_up_gallery/LowtherRoad/7.jpg'
var image_number = image_array.length;
var gallery_array = new Array()
for (no_of_images = 0; no_of_images < image_number; no_of_images++){
   gallery_array[no_of_images] = new Image()
   gallery_array[no_of_images].src = image_array[no_of_images]
}
function oldview_gallery(){}
function oldclose_gallery(){}
function view_gallery(){
	document.body.style.cursor = "hand";
	document.body.style.cursor = "pointer";
	var showelement =  document.getElementById("popupsection");
	showelement.style.visibility = "visible";
	var mainbody =  document.getElementById("maindiv2");
	//ar.className = "selectgall";
	//mainbody.className = "obscured";	
/*   if (document.all){
    document.images.bild.style.filter="blendTrans(duration=fade)"
    document.images.bild.filters.blendTrans.Apply()      
   }*/
   document.images.bild.src = gallery_array[image_increment].src
/*   if (document.all){
      document.images.bild.filters.blendTrans.Play()
   }*/
   image_increment = image_increment + 1
   if (image_increment > (image_number-1)) image_increment=0
   intvalref = setTimeout('view_gallery()', pace)
}
function close_gallery(){
	var showelement =  document.getElementById("popupsection");
	showelement.style.visibility = "hidden";
	clearInterval( intvalref );
	document.body.style.cursor = "auto";
	var mainbody =  document.getElementById("maindiv2");
	mainbody.className = "full";
	//ir.className = "unselectgall";
}	
function openWindow(theURL,winName,features) { 
  	window.open(theURL,winName,features);	
}
function gallover(list)
{
	document.body.style.cursor = "hand";
	document.body.style.cursor = "pointer";
	list.className = "selectgall";
	//this.style.bordercolor="white"
	//list.className = "printer_icon_hover";
/*document.getElementById("announce").style.borderColor = "red";
document.getElementById("announce").style.borderColor = "red green";
document.getElementById("announce").style.borderColor =
"black rgb(100, 75, 0) #c0c0c0";
document.getElementById("announce").style.borderColor = "yellow green blue red";*/	
}
function gallunover(list)
{
	document.body.style.cursor = "auto";
	list.className = "unselectgall";
}

