var designs=new Array();
designs[0]=["armadillo.gif","pcgcentipede2","It's a armadillo!!"];
designs[1]=["coaster.gif","pcgcentipede","Save a horse - Ride a coaster"];
designs[2]=["hearse.gif","pcgcentipede3","If you're driving a hearse, with a corpse in the back, is it ok to use the carpool lane?"];
designs[3]=["mom.gif","pcgcentipede4","Your mom"];
designs[4]=["pimp.gif","pcgcentipede6","You can't be a pimp and a prostitute too"];
designs[5]=["wtf.gif","pcgcentipede5","WTF, mate?"];
designs[6]=["monkey.gif","pcgcentipede7","Dance Monkey Dance!!"];
designs[7]=["fsh.gif","pcgcentipede8","Fsh"];
designs[8]=["mimas.gif","pcgcentipede9","That's no moon..."];
designs[9]=["cats_eye.gif","pcgcentipede10","Cat's Eye Nebula"];
designs[10]=["jesus_espo_front.gif","pcgcentipede11","Jesus Saves...but Espo puts in the rebound!"];
designs[11]=["jesus_espo_back.gif","pcgcentipede11","Jesus Saves...but Espo puts in the rebound!"];
designs[12]=["zone.gif","pcgcentipede12","Not now chief, I'm in the fuckin zone"];
designs[13]=["homeboy.gif","pcgcentipede14","St Pat is my Homeboy"];
designs[14]=["paddy.gif","pcgcentipede15","Who's Your Paddy?"];
designs[15]=["vegetables.gif","pcgcentipede16","Vegetables are what food eats"];
designs[16]=["paintball.gif","pcgcentipede17","Paintball anyone?"];
designs[17]=["hero.gif","pcgcentipede18","Save the world, become an hero!"];
designs[18]=["cats_eye2.gif","pcgcentipede19","Cat's Eye Nebula"];
designs[19]=["nebula.gif","pcgcentipede20","The Glowing Eye of NGC-6751"];
designs[20]=["fishing.gif","pcgcentipede21","Large mouth, big belly, foul smell, but enough about my fishin' buddies..."];
designs[21]=["momma.gif","pcgcentipede22","I got these from my momma"];
designs[22]=["literalists.gif","pcgcentipede23","Literalists do it with their genetalia"];
designs[23]=["anticrombie.gif","pcgcentipede24","Anticrombie"];
designs[24]=["hate.gif","pcgcentipede25","I >3 You"];
designs[25]=["metal_up.gif","pcgcentipede26","Metal Up or GTFO"];
designs[26]=["penguin.gif","pcgcentipede27","Penguin"];
designs[27]=["warning.gif","pcgcentipede28","Warning May contain AWESOME"];

var spans=new Array();

function getThumb(theIndex){
	var theFull=designs[theIndex][0];
	if(theFull.length==0){
		return("none.gif");
	}
	var theFile=theFull.substring(0,theFull.length-4)+"_thumb"+theFull.substring(theFull.length-4);
	return(theFile);
}

function swapPage(thePage){
	for(var i=0;i<spans.length;i++){
		var theId="span_"+i;
		if(i+1==thePage){
			var theThumb="thumbs_"+i;
			document.getElementById(theThumb).innerHTML=spans[i];
			document.getElementById(theId).style.display="inline";
		}else{
			document.getElementById(theId).style.display="none";
		}
	}
}

function isValid(theIndex){
	return(true);
}

function showImage(theIndex){
	var theImage=document.getElementById("large_image");
	theImage.src="../../images/designs/"+designs[theIndex][0];
	theImage.alt=designs[theIndex][2];
	document.getElementById("large_link").innerHTML='<a href="http://www.cafepress.com/'+designs[theIndex][1]+'" target="cafe_press">Purchase</a>';
	document.getElementById("large_link2").innerHTML='<a href="http://www.cafepress.com/'+designs[theIndex][1]+'" target="cafe_press">Purchase</a>';
	var scrOfY=0;
	if( document.body && document.body.scrollTop) {
	    //DOM compliant
	    scrOfY = document.body.scrollTop;
	} else if( document.documentElement && document.documentElement.scrollTop) {
	    //IE6 standards compliant mode
	    scrOfY = document.documentElement.scrollTop;
	}
	document.getElementById("image_div").style.top=scrOfY;
	document.getElementById("image_div").style.display="inline";
}

function closeImage(){
	document.getElementById("image_div").style.display="none";
}

function writeThumbs(){
	spans=new Array();
	var itemCount=0;
	var theString='<table cellspacing="0" cellpadding="0" border="0" width="640"><tr valign="top">';
	for(var i=0;i<designs.length;i++){
		if(isValid(i)){
			itemCount++;
			theString=theString+'<td width="200"><a href="javascript:showImage('+i+')"><img src="../../images/designs/'+getThumb(i)+'" width="200" height="200" alt="'+designs[i][2]+'" border="0"></a><br><a href="http://www.cafepress.com/'+designs[i][1]+'" target="cafe_press">Purchase</a></td>';
			if(itemCount%3==0){
				theString=theString+'</tr>';
				/*if(itemCount%9==0){
					theString=theString+'</table>';
					spans[spans.length]=theString;
					theString='<table cellspacing="0" cellpadding="0" border="0" width="640"><tr valign="top">';
				}else{*/
					theString=theString+'<tr valign="top"><td colspan="5"><img src="../../images/spacer.gif" width="640" height="20" alt=""></td></tr><tr valign="top">';
				/*}*/
			}else{
				theString=theString+'<td width="20"><img src="../../images/spacer.gif" width="20" height="200" alt=""></td>';
			}
		}
	}
	if(theString.length>79&&theString.substring(theString.length-8)!="</table>"){
		theString=theString+'</table>';
		spans[spans.length]=theString;
	}
	theString="";
	if(spans.length==0){
		document.getElementById("thumbSpan").innerHTML='<span>No results found</span>';
	}else{
		for(var i=0;i<spans.length;i++){
			theString=theString+'<span id="span_'+i+'">';/*<p align="right" class="pagination">Page:';
			for(var j=0;j<spans.length;j++){
				if(j!=spans.length){
					theString=theString+'&nbsp;';
				}
				if(j==i){
					theString=theString+'<b>'+(j+1)+'</b>';
				}else{
					theString=theString+'<a href=javascript:swapPage('+(j+1)+')>'+(j+1)+'</a>';
				}
			}
			theString=theString+'</p><span id="thumbs_'+i+'"></span></span>';*/
			theString=theString+'<span id="thumbs_'+i+'"></span></span>';
		}
		document.getElementById("thumbSpan").innerHTML=theString;
		swapPage(1);
	}
}
