window.onerror=ErrH;

var errmsg="";
var lastpic;
var xmlHttp;

function preloadImgs() {
 var d=document,a=arguments; if(!d.imgs) d.imgs=new Array();
 for(var i=0; i<a.length; i++) { d.imgs[i]=new Image; d.imgs[i].src=a[i]; }
}

function preloadSounds() {
 var d=document,a=arguments; if(!d.sounds) d.sounds=new Array();
 for(var i=0; i<a.length; i++) { d.sounds[i]=new File; d.sounds[i].src=a[i]; }
}

function swapImgs(id,image){document.getElementById(id).setAttribute("src",image);}

function subpagedetect(){if(parent.window.location==window.location){var str=window.location.href; parent.window.location='http://www.stupey.com/index.html?'+str.substring(str.lastIndexOf('://')+3,str.length);}}

function framedetect(){var str=window.location.href;if(str.indexOf('?')>=0){str=str.substring(str.indexOf('?')+1,str.length);parent.window.frames[1].window.location='http://'+str;}}

function imagepage(pagetype){
subpagedetect();
if(pagetype=="kids"){
    kidsAppend();
}
else if(pagetype=="album"){
    albumAppend();
}
addgrowshrink();
}


function kidsAppend(){
preloadImgs("http://www.stupey.com/images/2001normal.jpg","http://www.stupey.com/images/2001hover.jpg","http://www.stupey.com/images/2001click.jpg","http://www.stupey.com/images/2002normal.jpg","http://www.stupey.com/images/2002hover.jpg","http://www.stupey.com/images/2002click.jpg","http://www.stupey.com/images/2003normal.jpg","http://www.stupey.com/images/2003hover.jpg","http://www.stupey.com/images/2003click.jpg","http://www.stupey.com/images/2004normal.jpg","http://www.stupey.com/images/2004hover.jpg","http://www.stupey.com/images/2004click.jpg","http://www.stupey.com/images/2005normal.jpg","http://www.stupey.com/images/2005hover.jpg","http://www.stupey.com/images/2005click.jpg","http://www.stupey.com/images/2006normal.jpg","http://www.stupey.com/images/2006hover.jpg","http://www.stupey.com/images/2006click.jpg","http://www.stupey.com/images/2007normal.jpg","http://www.stupey.com/images/2007hover.jpg","http://www.stupey.com/images/2007click.jpg","http://www.stupey.com/images/2008normal.jpg","http://www.stupey.com/images/2008hover.jpg","http://www.stupey.com/images/2008click.jpg","http://www.stupey.com/images/2009normal.jpg","http://www.stupey.com/images/2009hover.jpg","http://www.stupey.com/images/2009click.jpg");
var butt20011=document.createElement("img");
var butt20012=document.createElement("img");
var butt20021=document.createElement("img");
var butt20022=document.createElement("img");
var butt20031=document.createElement("img");
var butt20032=document.createElement("img");
var butt20041=document.createElement("img");
var butt20042=document.createElement("img");
var butt20051=document.createElement("img");
var butt20052=document.createElement("img");
var butt20061=document.createElement("img");
var butt20062=document.createElement("img");
var butt20071=document.createElement("img");
var butt20072=document.createElement("img");
var butt20081=document.createElement("img");
var butt20082=document.createElement("img");
var butt20091=document.createElement("img");
var butt20092=document.createElement("img");

butt20011.id="butt20011";
butt20012.id="butt20012";
butt20021.id="butt20021";
butt20022.id="butt20022";
butt20031.id="butt20031";
butt20032.id="butt20032";
butt20041.id="butt20041";
butt20042.id="butt20042";
butt20051.id="butt20051";
butt20052.id="butt20052";
butt20061.id="butt20061";
butt20062.id="butt20062";
butt20071.id="butt20071";
butt20072.id="butt20072";
butt20081.id="butt20081";
butt20082.id="butt20082";
butt20091.id="butt20091";
butt20092.id="butt20092";

butt20011.src="http://www.stupey.com/images/2001normal.jpg";
butt20012.src="http://www.stupey.com/images/2001normal.jpg";
butt20021.src="http://www.stupey.com/images/2002normal.jpg";
butt20022.src="http://www.stupey.com/images/2002normal.jpg";
butt20031.src="http://www.stupey.com/images/2003normal.jpg";
butt20032.src="http://www.stupey.com/images/2003normal.jpg";
butt20041.src="http://www.stupey.com/images/2004normal.jpg";
butt20042.src="http://www.stupey.com/images/2004normal.jpg";
butt20051.src="http://www.stupey.com/images/2005normal.jpg";
butt20052.src="http://www.stupey.com/images/2005normal.jpg";
butt20061.src="http://www.stupey.com/images/2006normal.jpg";
butt20062.src="http://www.stupey.com/images/2006normal.jpg";
butt20071.src="http://www.stupey.com/images/2007normal.jpg";
butt20072.src="http://www.stupey.com/images/2007normal.jpg";
butt20081.src="http://www.stupey.com/images/2008normal.jpg";
butt20082.src="http://www.stupey.com/images/2008normal.jpg";
butt20091.src="http://www.stupey.com/images/2009normal.jpg";
butt20092.src="http://www.stupey.com/images/2009normal.jpg";

butt20011.onmouseover=function (){swapImgs("butt20011","http://www.stupey.com/images/2001hover.jpg");}
butt20011.onmouseout=function (){swapImgs("butt20011","http://www.stupey.com/images/2001normal.jpg");}
butt20011.onmousedown=function (){swapImgs("butt20011","http://www.stupey.com/images/2001click.jpg");}
butt20011.onmouseup=function (){swapImgs("butt20011","http://www.stupey.com/images/2001hover.jpg");}
butt20012.onmouseover=function (){swapImgs("butt20012","http://www.stupey.com/images/2001hover.jpg");}
butt20012.onmouseout=function (){swapImgs("butt20012","http://www.stupey.com/images/2001normal.jpg");}
butt20012.onmousedown=function (){swapImgs("butt20012","http://www.stupey.com/images/2001click.jpg");}
butt20012.onmouseup=function (){swapImgs("butt20012","http://www.stupey.com/images/2001hover.jpg");}
butt20021.onmouseover=function (){swapImgs("butt20021","http://www.stupey.com/images/2002hover.jpg");}
butt20021.onmouseout=function (){swapImgs("butt20021","http://www.stupey.com/images/2002normal.jpg");}
butt20021.onmousedown=function (){swapImgs("butt20021","http://www.stupey.com/images/2002click.jpg");}
butt20021.onmouseup=function (){swapImgs("butt20021","http://www.stupey.com/images/2002hover.jpg");}
butt20022.onmouseover=function (){swapImgs("butt20022","http://www.stupey.com/images/2002hover.jpg");}
butt20022.onmouseout=function (){swapImgs("butt20022","http://www.stupey.com/images/2002normal.jpg");}
butt20022.onmousedown=function (){swapImgs("butt20022","http://www.stupey.com/images/2002click.jpg");}
butt20022.onmouseup=function (){swapImgs("butt20022","http://www.stupey.com/images/2002hover.jpg");}
butt20031.onmouseover=function (){swapImgs("butt20031","http://www.stupey.com/images/2003hover.jpg");}
butt20031.onmouseout=function (){swapImgs("butt20031","http://www.stupey.com/images/2003normal.jpg");}
butt20031.onmousedown=function (){swapImgs("butt20031","http://www.stupey.com/images/2003click.jpg");}
butt20031.onmouseup=function (){swapImgs("butt20031","http://www.stupey.com/images/2003hover.jpg");}
butt20032.onmouseover=function (){swapImgs("butt20032","http://www.stupey.com/images/2003hover.jpg");}
butt20032.onmouseout=function (){swapImgs("butt20032","http://www.stupey.com/images/2003normal.jpg");}
butt20032.onmousedown=function (){swapImgs("butt20032","http://www.stupey.com/images/2003click.jpg");}
butt20032.onmouseup=function (){swapImgs("butt20032","http://www.stupey.com/images/2003hover.jpg");}
butt20041.onmouseover=function (){swapImgs("butt20041","http://www.stupey.com/images/2004hover.jpg");}
butt20041.onmouseout=function (){swapImgs("butt20041","http://www.stupey.com/images/2004normal.jpg");}
butt20041.onmousedown=function (){swapImgs("butt20041","http://www.stupey.com/images/2004click.jpg");}
butt20041.onmouseup=function (){swapImgs("butt20041","http://www.stupey.com/images/2004hover.jpg");}
butt20042.onmouseover=function (){swapImgs("butt20042","http://www.stupey.com/images/2004hover.jpg");}
butt20042.onmouseout=function (){swapImgs("butt20042","http://www.stupey.com/images/2004normal.jpg");}
butt20042.onmousedown=function (){swapImgs("butt20042","http://www.stupey.com/images/2004click.jpg");}
butt20042.onmouseup=function (){swapImgs("butt20042","http://www.stupey.com/images/2004hover.jpg");}
butt20051.onmouseover=function (){swapImgs("butt20051","http://www.stupey.com/images/2005hover.jpg");}
butt20051.onmouseout=function (){swapImgs("butt20051","http://www.stupey.com/images/2005normal.jpg");}
butt20051.onmousedown=function (){swapImgs("butt20051","http://www.stupey.com/images/2005click.jpg");}
butt20051.onmouseup=function (){swapImgs("butt20051","http://www.stupey.com/images/2005hover.jpg");}
butt20052.onmouseover=function (){swapImgs("butt20052","http://www.stupey.com/images/2005hover.jpg");}
butt20052.onmouseout=function (){swapImgs("butt20052","http://www.stupey.com/images/2005normal.jpg");}
butt20052.onmousedown=function (){swapImgs("butt20052","http://www.stupey.com/images/2005click.jpg");}
butt20052.onmouseup=function (){swapImgs("butt20052","http://www.stupey.com/images/2005hover.jpg");}
butt20061.onmouseover=function (){swapImgs("butt20061","http://www.stupey.com/images/2006hover.jpg");}
butt20061.onmouseout=function (){swapImgs("butt20061","http://www.stupey.com/images/2006normal.jpg");}
butt20061.onmousedown=function (){swapImgs("butt20061","http://www.stupey.com/images/2006click.jpg");}
butt20061.onmouseup=function (){swapImgs("butt20061","http://www.stupey.com/images/2006hover.jpg");}
butt20062.onmouseover=function (){swapImgs("butt20062","http://www.stupey.com/images/2006hover.jpg");}
butt20062.onmouseout=function (){swapImgs("butt20062","http://www.stupey.com/images/2006normal.jpg");}
butt20062.onmousedown=function (){swapImgs("butt20062","http://www.stupey.com/images/2006click.jpg");}
butt20062.onmouseup=function (){swapImgs("butt20062","http://www.stupey.com/images/2006hover.jpg");}
butt20071.onmouseover=function (){swapImgs("butt20071","http://www.stupey.com/images/2007hover.jpg");}
butt20071.onmouseout=function (){swapImgs("butt20071","http://www.stupey.com/images/2007normal.jpg");}
butt20071.onmousedown=function (){swapImgs("butt20071","http://www.stupey.com/images/2007click.jpg");}
butt20071.onmouseup=function (){swapImgs("butt20071","http://www.stupey.com/images/2007hover.jpg");}
butt20072.onmouseover=function (){swapImgs("butt20072","http://www.stupey.com/images/2007hover.jpg");}
butt20072.onmouseout=function (){swapImgs("butt20072","http://www.stupey.com/images/2007normal.jpg");}
butt20072.onmousedown=function (){swapImgs("butt20072","http://www.stupey.com/images/2007click.jpg");}
butt20072.onmouseup=function (){swapImgs("butt20072","http://www.stupey.com/images/2007hover.jpg");}
butt20081.onmouseover=function (){swapImgs("butt20081","http://www.stupey.com/images/2008hover.jpg");}
butt20081.onmouseout=function (){swapImgs("butt20081","http://www.stupey.com/images/2008normal.jpg");}
butt20081.onmousedown=function (){swapImgs("butt20081","http://www.stupey.com/images/2008click.jpg");}
butt20081.onmouseup=function (){swapImgs("butt20081","http://www.stupey.com/images/2008hover.jpg");}
butt20082.onmouseover=function (){swapImgs("butt20082","http://www.stupey.com/images/2008hover.jpg");}
butt20082.onmouseout=function (){swapImgs("butt20082","http://www.stupey.com/images/2008normal.jpg");}
butt20082.onmousedown=function (){swapImgs("butt20082","http://www.stupey.com/images/2008click.jpg");}
butt20082.onmouseup=function (){swapImgs("butt20082","http://www.stupey.com/images/2008hover.jpg");}
butt20091.onmouseover=function (){swapImgs("butt20091","http://www.stupey.com/images/2009hover.jpg");}
butt20091.onmouseout=function (){swapImgs("butt20091","http://www.stupey.com/images/2009normal.jpg");}
butt20091.onmousedown=function (){swapImgs("butt20091","http://www.stupey.com/images/2009click.jpg");}
butt20091.onmouseup=function (){swapImgs("butt20091","http://www.stupey.com/images/2009hover.jpg");}
butt20092.onmouseover=function (){swapImgs("butt20092","http://www.stupey.com/images/2009hover.jpg");}
butt20092.onmouseout=function (){swapImgs("butt20092","http://www.stupey.com/images/2009normal.jpg");}
butt20092.onmousedown=function (){swapImgs("butt20092","http://www.stupey.com/images/2009click.jpg");}
butt20092.onmouseup=function (){swapImgs("butt20092","http://www.stupey.com/images/2009hover.jpg");}

var anc20011=document.createElement("a");
var anc20012=document.createElement("a");
var anc20021=document.createElement("a");
var anc20022=document.createElement("a");
var anc20031=document.createElement("a");
var anc20032=document.createElement("a");
var anc20041=document.createElement("a");
var anc20042=document.createElement("a");
var anc20051=document.createElement("a");
var anc20052=document.createElement("a");
var anc20061=document.createElement("a");
var anc20062=document.createElement("a");
var anc20071=document.createElement("a");
var anc20072=document.createElement("a");
var anc20081=document.createElement("a");
var anc20082=document.createElement("a");
var anc20091=document.createElement("a");
var anc20092=document.createElement("a");

anc20011.href="http://www.stupey.com/Louis/2001.html";
anc20012.href="http://www.stupey.com/Louis/2001.html";
anc20021.href="http://www.stupey.com/Louis/2002.html";
anc20022.href="http://www.stupey.com/Louis/2002.html";
anc20031.href="http://www.stupey.com/Louis/2003.html";
anc20032.href="http://www.stupey.com/Louis/2003.html";
anc20041.href="http://www.stupey.com/Louis/2004.html";
anc20042.href="http://www.stupey.com/Louis/2004.html";
anc20051.href="http://www.stupey.com/Louis/2005.html";
anc20052.href="http://www.stupey.com/Louis/2005.html";
anc20061.href="http://www.stupey.com/Louis/2006.html";
anc20062.href="http://www.stupey.com/Louis/2006.html";
anc20071.href="http://www.stupey.com/Louis/2007.html";
anc20072.href="http://www.stupey.com/Louis/2007.html";
anc20081.href="http://www.stupey.com/Louis/2008.html";
anc20082.href="http://www.stupey.com/Louis/2008.html";
anc20091.href="http://www.stupey.com/Louis/2009.html";
anc20092.href="http://www.stupey.com/Louis/2009.html";

anc20011.appendChild(butt20011);
anc20012.appendChild(butt20012);
anc20021.appendChild(butt20021);
anc20022.appendChild(butt20022);
anc20031.appendChild(butt20031);
anc20032.appendChild(butt20032);
anc20041.appendChild(butt20041);
anc20042.appendChild(butt20042);
anc20051.appendChild(butt20051);
anc20052.appendChild(butt20052);
anc20061.appendChild(butt20061);
anc20062.appendChild(butt20062);
anc20071.appendChild(butt20071);
anc20072.appendChild(butt20072);
anc20081.appendChild(butt20081);
anc20082.appendChild(butt20082);
anc20091.appendChild(butt20091);
anc20092.appendChild(butt20092);

parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20011);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20012);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20021);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20022);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20031);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20032);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20041);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20042);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20051);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20052);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20061);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20062);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20071);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20072);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20081);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20082);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc20091);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc20092);

}

function albumAppend(){
preloadImgs("http://www.stupey.com/images/backnormal.jpg","http://www.stupey.com/images/backhover.jpg","http://www.stupey.com/images/backclick.jpg");
var butt1=document.createElement("img");
var butt2=document.createElement("img");
butt1.id="butt1";
butt2.id="butt2";
butt1.src="http://www.stupey.com/images/backnormal.jpg";
butt2.src="http://www.stupey.com/images/backnormal.jpg";
butt1.onmouseover=function (){swapImgs("butt1","http://www.stupey.com/images/backhover.jpg");}
butt1.onmouseout=function (){swapImgs("butt1","http://www.stupey.com/images/backnormal.jpg");}
butt1.onmousedown=function (){swapImgs("butt1","http://www.stupey.com/images/backclick.jpg");}
butt1.onmouseup=function (){swapImgs("butt1","http://www.stupey.com/images/backhover.jpg");}
butt2.onmouseover=function (){swapImgs("butt2","http://www.stupey.com/images/backhover.jpg");}
butt2.onmouseout=function (){swapImgs("butt2","http://www.stupey.com/images/backnormal.jpg");}
butt2.onmousedown=function (){swapImgs("butt2","http://www.stupey.com/images/backclick.jpg");}
butt2.onmouseup=function (){swapImgs("butt2","http://www.stupey.com/images/backhover.jpg");}
var anc1=document.createElement("a");
var anc2=document.createElement("a");
anc1.href="http://www.stupey.com/PhotoAlbum.html";
anc2.href="http://www.stupey.com/PhotoAlbum.html";
anc1.appendChild(butt1);
anc2.appendChild(butt2);
parent.window.frames[1].window.document.getElementById("nav").appendChild(anc1);
parent.window.frames[1].window.document.getElementById("nav2").appendChild(anc2);
}

function grow(id){
shrink(last);
last=id;
parent.window.frames[1].window.document.getElementById(id).style.height="400px";
}

function shrink(id){
parent.window.frames[1].window.document.getElementById(id).style.height="300px";
}

function addgrowshrink(){
var id;
var divn=window.document.getElementById("tn");
var arr=divn.getElementsByTagName("img");
for(var i=0;i<arr.length;i++){//>
id="pic"+i;
arr[i].id=id;
arr[i].onmouseover=function (){grow(this.id);}
}
last="pic0";
}


function getXmlHttpObject(){var xmlHttpTemp=null;try{xmlHttpTemp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{xmlHttpTemp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e){try{xmlHttpTemp=new XMLHttpRequest();}catch (e){xmlHttpTemp=null;}}}return xmlHttpTemp;}

function getNews(){
if(xmlHttp==null)return;
xmlHttp.open("GET","/cgi-bin/news.cgi",true);
xmlHttp.onreadystatechange=gotNews;
xmlHttp.send(null);
}



function gotNews(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
	var content=parseIt(xmlHttp.responseText);
	var myTime = new Date();
	content+="</ul><span style='font-size: smaller; text-align: center'><tt>Updated "+myTime.toLocaleString()+"</tt></span>";
	document.getElementById("news").innerHTML=content;
	setTimeout("getNews()",1000*60*10);
}}




function parseIt(inputString){
var outputString="<center><span style='font-weight: bold; font-size: normal; color: blue; text-align: center;  text-decoration: underline'><a href='http://news.bbc.co.uk/' target='_blank'>Latest News From BBC News</a></span></center><br/><ul><span style='font-size: small; text-align: center'>";
var link="";
var title="";
var description="";

for(var i=0;i<3;i++){//>
	inputString=inputString.substring(inputString.indexOf("<item>"),inputString.length);
	title=inputString.substring(inputString.indexOf("<title>")+7,inputString.indexOf("</title>"));
	description=inputString.substring(inputString.indexOf("<description>")+13,inputString.indexOf("</description>"));
	link=inputString.substring(inputString.indexOf("<link>")+6,inputString.indexOf("</link>"));	
	outputString+="<li><a href='"+link+"' target='_blank'>"+title+"</a><br/>"+description+"<br/><br/>";
	inputString=inputString.substring(inputString.indexOf("</item>"),inputString.length);
}
outputString+="</span>"
return outputString;
}




function ErrH(msg, url, ln){
//alert(errmsg+"\n\n"+msg+"\n"+url+"\n"+ln);
return true;} 


/*
-   logo
-   top
*/