var timerT = false;

	function imgCancel(img) {
		clearTimeout(timerT);
	}

	function imgHover(img) {

		//clear prvious timers
		if(timerT) {
			clearTimeout(timerT);
		}
		var box = document.getElementById('imgbox' + img.id);
		if (! box) return;
		var pop = document.getElementById('popup');
		if (! pop) return;

		var popshadow = document.getElementById('popupshadow');
		var popimage = document.getElementById('popupimage');
		var poplink = document.getElementById('popuplink');
		// reset any previous stuff that was set.
		pop.style.display = 'none';
		popimage.src = '../images/spacer.gif';

		var href = document.getElementById('href' + img.id);
		poplink.href = href.href;
		poplink.target = href.target;
        

		var contain = document.getElementById('popupcontain');
		pop.style.width = '800px';

		popshadow.style.width  = '510px';
		popshadow.style.height = '387px';

		popimage.style.width  = '502px';
		popimage.style.height = '379px';

		// Not used right now.. 
		//var descT = document.getElementById('popupdesc');
		//descT.innerHTML = img.alt;

		//popimage.src = '/thumb/medium/' + img.id + '.jpg';
		popimage.src = path_from_id(img.id);

		// delay to prevent the user gettting popups while moving the mouse
		//var cmd = "delayShow('/thumb/medium/" + img.id + ".jpg')";
		var cmd = "delayShow('"+path_from_id(img.id, 'medium')+"')";
		timerT = setTimeout(cmd, 600);

	}

	function delayShow(imgsrc) {

		// clear the timer
		clearTimeout(timerT);

		// set the image
		//var popimage = document.getElementById('popupimage');
		//popimage.src = imgsrc;

		// and show the area.
		var pop = document.getElementById('popup');
		pop.style.display = 'block';
	}

	function path_from_id(id) {
		var path = 'http://www.technovate.com/';

		var a = new String(parseInt(id)).split('');
		if(a==1 ) {
			path += 'images/site_sample1_a.jpg';
		}else if(a==2){
			path += 'images/site_sample2_a.jpg';
		}else{
			path += 'images/site_sample3_a.jpg';
		}

		return  path;
	}
