function preLoad()
{
	var url = new Array("images/menuactive_06.gif","images/menuactive_08.gif",
						"images/menuactive_10.gif","images/menuactive_12.gif",
						"images/menuactive_14.gif");
	var img = new Array();
	for (var i=0; i<url.length; i++)
	{
		img[img.length] = new Image();
		img[img.length-1].src = url[i];
	}
}

function mouseOver(event)
{
	if(x=event.target)
	{
		source = document.images[x.id].src;
		var patt1 = /.*menu/; 
		var result = source.replace(patt1, "menuactive");
		result = 'images/'+result;
		document.images[x.id].src =result;
	}
	else
	{
		event = window.event;
		x=event.srcElement;
		source = document.images[x.id].src;
		var patt1 = /.*menu/; 
		var result = source.replace(patt1, "menuactive");
		result = 'images/'+result;
		document.images[x.id].src =result;
	}
}
function mouseOut(event)
{
	if(x=event.target)
	{
		source = document.images[x.id].src;
		var patt1 = /.*menuactive/; 
		var result = source.replace(patt1, "menu");
		result = 'images/'+result;
		document.images[x.id].src =result;
	}
	else
	{
		event = window.event;
		x=event.srcElement;
		source = document.images[x.id].src;
		var patt1 = /.*menuactive/; 
		var result = source.replace(patt1, "menu");
		result = 'images/'+result;
		document.images[x.id].src =result;
	}
}

var pics = new Array();

var urlsPhoto = new Array("photos/A Secret View of Anne Hathaway.jpg","photos/A View of Kylemore Abbey.jpg","photos/boatinShanghai.jpg","photos/boatinthewater.jpg","photos/BoatonthePond.jpg","photos/Burgundy.jpg","photos/Copy of 004_1.JPG","photos/Dungaire Castle Ireland.jpg","photos/Fountain at a German Estate.jpg","photos/Germany 2004 003.jpg","photos/Germany 2004 004.jpg","photos/Germany 2004 065.jpg","photos/Germany 2004 074.jpg","photos/Germany 2004 078.jpg","photos/Germany 2004 097.jpg","photos/Germany 2004 134.jpg","photos/Ireland2 7-07 037.jpg","photos/Germany 2004 254.jpg","photos/gorgeous picture don't know where in Ireland.jpg","photos/Inside the Alhambra.jpg","photos/Ireland2 7-07 014.jpg","photos/Ireland2 7-07 041.jpg","photos/Ireland2 7-07 046.jpg","photos/Ireland2 7-07 055.jpg","photos/Ireland2 7-07 059.jpg","photos/Ireland2 7-07 070.jpg","photos/Ireland2 7-07 109.jpg","photos/Ireland2 7-07 110.jpg","photos/Ireland2 7-07 120.jpg","photos/Ireland2 7-07 125.jpg","photos/Ireland2 7-07 172.jpg","photos/Ireland2 7-07 192.jpg","photos/Ireland2 7-07 222.jpg","photos/Ireland2 7-07 226.jpg","photos/Ireland2 7-07 234.jpg","photos/Ireland2 7-07 256.jpg","photos/Ireland2 7-07 294.jpg","photos/Ireland2 7-07 338.jpg","photos/Ireland2 7-07 396.jpg","photos/Ireland2 7-07 430.jpg","photos/Ireland 7-07 070.jpg","photos/Ireland 7-07 074.jpg","photos/Ireland 7-07 080.jpg","photos/Ireland 7-07 088.jpg","photos/Ireland 7-07 095.jpg","photos/Ireland 7-07 115.jpg","photos/Ireland 7-07 144.jpg","photos/Ireland 7-07 209.jpg","photos/Ireland 7-07 214.jpg","photos/Ireland 7-07 235.jpg","photos/IrelandChurch.jpg","photos/irelandmananddog.jpg","photos/Mountainous_Spain.jpg","photos/One Nice Day.jpg","photos/Oxford_Bridge.jpg","photos/scan0014.jpg","photos/Sculpture on the Rhine.jpg","photos/Seen Through the Trees, Kylemore Abbey.jpg","photos/streets of Galway.jpg","photos/The_Happy_Days.jpg","photos/ThreeSwans2.jpg","photos/Tower_Bridge.jpg","photos/Trilogy.jpg"); 

var urlsPortfolio = new Array("portfolio/IMG_10.png","portfolio/IMG_11.png","portfolio/IMG_12.png","portfolio/IMG_13.png","portfolio/IMG_14.png", "portfolio/IMG_20.JPG","portfolio/IMG_200.JPG","portfolio/IMG_201.JPG","portfolio/IMG_202.JPG","portfolio/IMG_203.JPG","portfolio/IMG_204.JPG","portfolio/IMG_205.JPG","portfolio/IMG_206.JPG","portfolio/IMG_207.JPG","portfolio/IMG_208.JPG","portfolio/IMG_209.JPG","portfolio/IMG_210.JPG","portfolio/IMG_211.JPG","portfolio/IMG_212.JPG","portfolio/IMG_213.png","portfolio/IMG_310.png","portfolio/IMG_400.png","portfolio/IMG_401.jpg","portfolio/IMG_402.png","portfolio/IMG_403.png","portfolio/IMG_404.png","portfolio/IMG_405.png","portfolio/IMG_406.png","portfolio/IMG_407.png","portfolio/IMG_408.jpg","portfolio/IMG_409.jpg","portfolio/IMG_410.jpg","portfolio/IMG_411.jpg","portfolio/IMG_412.jpg","portfolio/IMG_413.png","portfolio/IMG_414.jpg","portfolio/IMG_415.JPG","portfolio/IMG_416.jpg","portfolio/IMG_417.jpg","portfolio/IMG_418.png","portfolio/IMG_419.jpg","portfolio/IMG_420.jpg","portfolio/IMG_421.jpg","portfolio/IMG_422.png","portfolio/IMG_14.png"); 

var description = new Array("The Giant Beverage Company<br /> I created the html form as well as the zipcode script. The script checks to see if the zipcode is in their delivery area as well as stores the information in a file for later use.","Security and Data <br /> Updated the logo for this website.","Libyan Mission New York <br />Updated translated information on their website.","Security and Data <br /> Created new logo. Designed and developed new website.","End of Web Work","Lynxie's Art Studio","Lynxie's Art Studio <br /> A child is fascinated while watching Lynxie drawing.","Lynxie's Art Studio <br /> A child is drawing a picture on the Child's Station.  Next he will send the picture to Lynxie for her to draw it.","Lynxie's Art Studio <br /> Front view.","Lynxie's Art Studio <br /> Diagonal view of the front.","Lynxie's Art Studio <br /> A view of lynxie from the back.","Lynxie's Art Studio <br /> Picture of the cabinets and plexi-glass when they were first put together.","Lynxie's Art Studio <br /> The final interface.","Lynxie's Art Studio <br /> Lynxie and her paint holders.","Lynxie's Art Studio <br /> View through the plexi-glass to the interface.","Lynxie's Art Studio <br /> The laptop that controls everything.","Lynxie's Art Studio <br /> Top down view of Lynxie and her palette.","End of Lynxie's Art Studio.  Try clicking on another section.","End of BVW","Created for initial website design.","Designed as a Deviant ID.","White Water Rafting<br /> Ahead the White Water <br /> This next set of images where designed for a project at the ETC. <br /> They are created with photoshop.","White Water Rafting <br /> A Moment of Calm","White Water Rafting <br /> Trapped","White Water Rafting <br /> End of Rafting","Paintball <br /> Hit","Paintball <br /> Winning Paintball","A Picture for Anna","Another Door Closes","Created for my video art class at UAlbany","Created for my video art class at UAlbany","Ghost at Lunch <br /> Created with photoshop.","Background designed for previous website.","Land of Torture <br /> Created with Bryce.","First attempt at using Cinema4D","Midnight Shapes <br /> Created with Bryce.","Old Time Fun <br /> Editied in photoshop.","Purple Logo <br /> Used in my previous website.  Created with photoshop.","The Swallowing Myst <br /> Created in Bryce","This is Goodbye <br /> Edited in photoshop.","Under Water World <br /> Created in Bryce.","End of Digital Art"); 

var loc = 0;
var webWork = 5; //this is the number of how many pictures are in each section
var lynxie = 15;
var bvw = 1;
var digital = 23;
var numImages = 4;
var lastClicked = 1;
var thumbsize = {width: 80, height: 80};
var largesize = {width: 400, height: 400};
function preLoadPics(num)
{	
	if(num == 1)
		urls = urlsPhoto;
	else if(num ==2)
		urls = urlsPortfolio;
	preLoad();
		for (var i=0; i<urls.length; i++)
	{
		pics[pics.length] = new Image();
		pics[pics.length-1].src = urls[i];
	}
}

function shrink(image,size)
{
	r = image;
	m = size;
	 if(r.width > m.width)
    {
        r.height = r.height * (m.width / r.width);
        r.width = m.width;
        if(r.height > m.height)
        {
            r.width = r.width * (m.height / r.height);
            r.height = m.height;
        }
    }
    else if(r.height > m.height)
    {
        r.width = r.width * (m.height / r.height);
        r.height = m.height;
    }
	
}

function getHW(image,size)
{
	w = image.width;
	h = image.height;
	m = size;
	 if(w > m.width)
    {
        h = h * (m.width / w);
        w = m.width;
        if(h > m.height)
        {
            w = w * (m.height / h);
            h = m.height;
        }
    }
    else if(h > m.height)
    {
        w = w * (m.height / h);
        h = m.height;
    }
	hW = new Array(h,w);
	return hW;
}

function loadPictures(num)
{
	var use =0;
	lastClicked = 1;
	if(num == 0)
	{
		loc = 0;
		use = numImages;
		document.getElementById("click").innerHTML = '';
	}
	else if(num ==1)
	{
		loc = 0;
		if(webWork <numImages)
			use = webWork;
		else
			use = numImages;
	}	
	else if(num ==2)
	{
		loc = webWork;
		if(lynxie <numImages)
			use = lynxie;
		else
			use = numImages;
	}	
	else if(num ==3)
	{
		loc = webWork+lynxie;
		if(bvw <numImages)
			use = bvw;
		else
			use = numImages;
	}	
	else if(num ==4)
	{
		loc = webWork+lynxie+bvw;
		if(digital <numImages)
			use = digital;
		else
			use = numImages;
	}
	for(i = 0; i < use; i++)
	{
		var aon = 'aon'+(i+1);
		var on = 'on'+(i+1);
		tempImg = new Image();
		tempImg.src = pics[loc+i].src;
		hW = getHW(tempImg,thumbsize);
		document.getElementById(aon).innerHTML = '<img id="'+on+'" src="" height="'+hW[0]+'" width="'+hW[1]+'"/>';
		document.images[on].src =pics[loc+i].src;
		//shrink(document.images[on],thumbsize);
	}
	for(i = use; i < numImages; i++)
	{
		var aon = 'aon'+(i+1);
		var on = 'on'+(i+1);
		document.getElementById(aon).innerHTML = '<img id="'+on+'" src="" />';
	}
	if (use > 0)
	{
		i = lastClicked;
		i--;
		document.getElementById("plarge").innerHTML = '<img id="large" src=""/>';
		document.images["large"].src =pics[loc+i].src;
		shrink(document.images["large"],largesize);
	}
	else
	{
		document.getElementById("plarge").innerHTML = '<img id="large" src=""/>';
	}
	
	if(description[loc+i])
		document.getElementById("description").innerHTML = description[loc+i];
	else
		document.getElementById("description").innerHTML = '';
}

function scrollThumbs(direc)
{
	if(direc == 'right')
	{
		if((lastClicked == 4) && (loc < (urls.length-numImages)))
		{	
			loc++;
			for(i = 0; i < 4; i++)
			{
				var aon = 'aon'+(i+1);
				var on = 'on'+(i+1);
				document.getElementById(aon).innerHTML = '<img id="'+on+'" src="" />';
				document.images[on].src =pics[loc+i].src;
				shrink(document.images[on],thumbsize);
			}
			i = lastClicked;
			i--;
			document.getElementById("plarge").innerHTML = '<img id="large" src=""/>';
			document.images["large"].src =pics[loc+i].src;
			shrink(document.images["large"],largesize);
			
			if(description[loc+i])
				document.getElementById("description").innerHTML = description[loc+i];
			else
				document.getElementById("description").innerHTML = '';
		}
		if(lastClicked < 4)
		{
			i = lastClicked - 0;
			document.getElementById("plarge").innerHTML = '<img id="large" src=""/>';
			document.images["large"].src =pics[loc+i].src;
			shrink(document.images["large"],largesize);
			lastClicked++;
			
			if(description[loc+i])
				document.getElementById("description").innerHTML = description[loc+i];
			else
				document.getElementById("description").innerHTML = '';
		}
	}
	else if(direc == 'left')
	{		
		if((lastClicked == 1) && (loc > 0))
		{	
			loc--;
			for(i = 0; i < 4; i++)
			{
				var aon = 'aon'+(i+1);
				var on = 'on'+(i+1);
				document.getElementById(aon).innerHTML = '<img id="'+on+'" src="" />';
				document.images[on].src =pics[loc+i].src;
				shrink(document.images[on],thumbsize);
			}
			i = lastClicked;
			i--;
			document.getElementById("plarge").innerHTML = '<img id="large" src=""/>';
			document.images["large"].src =pics[loc+i].src;
			shrink(document.images["large"],largesize);
			
			if(description[loc+i])
				document.getElementById("description").innerHTML = description[loc+i];
			else
				document.getElementById("description").innerHTML = '';
		}
		if(lastClicked > 1)
		{
			i = lastClicked;
			i=i-2;
			document.getElementById("plarge").innerHTML = '<img id="large" src=""/>';
			document.images["large"].src =pics[loc+i].src;
			shrink(document.images["large"],largesize);
			lastClicked--;
			
			if(description[loc+i])
				document.getElementById("description").innerHTML = description[loc+i];
			else
				document.getElementById("description").innerHTML = '';	
		}
	}
}

function mainPic(event)
{
	if(x=event.target)
	{}
	else
	{
		event = window.event;
		x=event.srcElement;
	}
	var i = 0;
	source = x.id;
	i = source.charAt(2);
	lastClicked = i;
	i--;
	document.getElementById("plarge").innerHTML = '<img id="large" src=""/>';
	document.images["large"].src =pics[loc+i].src;
	shrink(document.images["large"],largesize);	
	
	if(description[loc+i])
		document.getElementById("description").innerHTML = description[loc+i];
	else
		document.getElementById("description").innerHTML = '';
}
