// JavaScript Document	
	function Project (title, desc, siteUrl) {
		this.title = title;
		this.desc = desc;
		this.siteUrl = siteUrl;
	}

	// WEBSITES ARRAY: alt text / project type / description / URL
	var websites = new Array();
	websites[0] = new Project('Moorlands', 'Website design and build. Built with full CMS.', 'http://www.moorlands.ac.uk');
	websites[1] = new Project('Bute Motorsport - GT Cup', 'Website design and build. Built with full CMS.', 'http://www.gtcup.co.uk');
	websites[2] = new Project('SEGRO plc', 'Corporate website build. Built with MCMS.', 'http://www.segro.com');
	websites[3] = new Project('All Car One', 'Website design and build. Built with full CMS.', 'http://www.allcarone.com/');
	websites[4] = new Project('Slough Trading Estate', 'Website design and build. Built with MCMS.', 'http://www.sloughte.com/');
	websites[5] = new Project('Ultimate Family Hideaways', 'Website design and build. Built with full CMS.', 'http://www.ultimatefamilyhideaways.co.uk');
	websites[6] = new Project('World Forum for Motor Museums', 'Website design and build. Built with full CMS.', 'http://www.worldforumformotormuseums.com/');
	websites[7] = new Project('Xtreme Wheels Show', 'Website design and build.', 'http://www.xtremewheelsshow.com/');
	websites[8] = new Project('Bournemouth Reef Holidays', 'Web and corporate ID design. Built with full CMS.', 'http://www.bournemouthreefholidays.com');
	websites[9] = new Project('Auto Reminder', 'Website design and build. Built with full CMS.', 'http://www.auto-reminder.co.uk/');

	// IMAGES ARRAY
	var images = new Array();
	images[0] = "je_0.jpg";
	images[1] = "je_1.jpg";
	images[2] = "je_2.jpg";
	images[3] = "je_3.jpg";
	images[4] = "je_4.jpg";
	images[5] = "je_5.jpg";
	images[6] = "je_6.jpg";
	images[7] = "je_7.jpg";
	images[8] = "je_8.jpg";
	images[9] = "je_9.jpg";

var gal = {
    init : function() {
        if (!document.getElementById || !document.createElement || !document.appendChild) return false;
        if (document.getElementById('gallery')) document.getElementById('gallery').id = 'jgal';
        var li = document.getElementById('jgal').getElementsByTagName('li');
        li[0].className = 'active';
        for (i=0; i<li.length; i++) {
            li[i].style.backgroundImage = 'url(' + li[i].getElementsByTagName('img')[0].src + ')';
            li[i].style.backgroundRepeat = 'no-repeat';
	    if (websites[i].title == 'Moorlands')	li[i].style.backgroundPosition = '15% 2%';
		if (websites[i].title == 'Bute Motorsport - GT Cup')	li[i].style.backgroundPosition = '30% 4%';
		if (websites[i].title == 'SEGRO plc')	li[i].style.backgroundPosition = '40% 55%';
		if (websites[i].title == 'All Car One')	li[i].style.backgroundPosition = '11% 3%';
		if (websites[i].title == 'Slough Trading Estate')	li[i].style.backgroundPosition = '12% 2%';
		if (websites[i].title == 'Ultimate Family Hideaways')	li[i].style.backgroundPosition = '8% 3%';
		if (websites[i].title == 'World Forum for Motor Museums')	li[i].style.backgroundPosition = '12% 3%';
		if (websites[i].title == 'Xtreme Wheels Show')	li[i].style.backgroundPosition = '14% 5%';
		if (websites[i].title == 'Bournemouth Reef Holidays')	li[i].style.backgroundPosition = '9% 11%';
		if (websites[i].title == 'Auto Reminder')	li[i].style.backgroundPosition = '10% 1%';
	    
	    li[i].title = websites[i].title;
	    var sProjectTitle = websites[i].title;
	    var sProjectDesc = websites[i].desc;
	    var sLinkText = 'Launch Site';
	    
	    if (websites[i].siteUrl == 'comingsoon')	 sLinkText = 'Site Coming Soon';
	    if (websites[i].siteUrl == 'mockup')	sLinkText = 'Mockup only';
	    if (websites[i].siteUrl == 'logo')	sLinkText = '';
	   
	    if (sLinkText == 'Launch Site')
		var sProjectUrl = '<a href="' + websites[i].siteUrl + '" target="_blank">' + sLinkText + '</a>';
	    else
		var sProjectUrl = sLinkText;
	    
    	    document.getElementById('textbox'+i).innerHTML = "CLIENT: " + sProjectTitle + "<br/>DESCRIPTION: " + sProjectDesc + "<br/>WEBSITE: " + sProjectUrl;
            gal.addEvent(li[i],'click',function() {
                var im = document.getElementById('jgal').getElementsByTagName('li');
                for (j=0; j<im.length; j++) {
                    im[j].className = '';
                }
                this.className = 'active';
            });
        }
    },
    addEvent : function(obj, type, fn) {
        if (obj.addEventListener) {
            obj.addEventListener(type, fn, false);
        }
        else if (obj.attachEvent) {
            obj["e"+type+fn] = fn;
            obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
            obj.attachEvent("on"+type, obj[type+fn]);
        }
    }
}

gal.addEvent(window,'load', function() {
    gal.init();
});

	// preload images
	if (document.images)
	{
	     for (i=0; i<images.length; i++)
	     {
		myimages[x] = new Image();
		myimages[x].src = 'images/'+images[i];
	     }
	}