function openFeedbackForm(url) {
	newwindow = open(url,'feedbackform','toolbars=no,width=550,height=500,resizable=yes,scrollbars=yes');
}
	
function openPicoPhoto(comment, url){
	document.write ("<html>" +
"<head><title>Picocon 2001 photos - icsf</title><link type='text/css' rel='stylesheet' href='../../icsfwebsite.css' /></head><body class='bodyMedium'><table width='95%' cellpadding='4' class='bodyDark' align='center'><tr><td class='bodyLight'><h2>Picocon 2001 photos</h2><div align='center'><img src='" + url + "' /><p><i>'" + comment + "'</i></p></div><a href='" + homeURI + "'>[take me back..]</a></td></tr></table></body></html>");
	return true;
}

function evilPopUp(URL) {
	eval("pagePopup = window.open(URL, 'popup', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400');");
}

function webcamPopUp(URL) {
	eval("pagePopup = window.open(URL, 'webcam', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=352,height=310');");
}

function lessEvilPopUp(URL) {
	if (navigator.appVersion.indexOf("PPC") != -1) {
		remote = window.open("","popup","width=328,height=297");
	} else if (navigator.appVersion.indexOf("3.") >= 0) {
		remote = window.open("","popup","width=358,height=295");
	} else if (navigator.appVersion.indexOf("Netscape") != -1) {
		remote = window.open("","popup","width=353,height=310");
	} else {
		remote = window.open("","popup","width=353,height=315");
	}
	remote.location.href = URL;
	if (remote.opener == null) remote.opener = window;
	remote.opener.name = "opener";
}

function preLoadImages() {
	for (var j = 0; j < imageURLS.length; j++) {
		imageOn[j] = new Image();
		imageOn[j].src = imageDir + "/g_" +imageURLS[j];
	}
 	for (var j = 0; j < imageURLS.length; j++) {
		imageOff[j] = new Image();
		imageOff[j].src = imageDir + "/" + imageURLS[j];
	}
}
 
function turnOn(n) {
 	if (parseInt(navigator.appVersion) > 3) {
	document["pic" + n].src = imageOn[n].src;
	}
}
 
function turnOff(n) {
	if (parseInt(navigator.appVersion) > 3) {
 	document["pic" + n].src = imageOff[n].src;
	}
}

function swopBrand(url, frame) {
	if (parseInt(navigator.appVersion) > 3) {
		if (screen.width <= 800 || screen.height <= 600){
			url = "../images/blank.gif";
		}
		if (self != top && parent.sidemenu != null) {
			if (frame != null) {
				if ( typeof(parent.parent.sidemenu.document.brand)!='undefined') {
					parent.parent.sidemenu.document["brand"].src = url;
				}
			} else {
				if ( typeof(parent.sidemenu.document.brand)!='undefined') {
					parent.sidemenu.document["brand"].src = url;
				}
			}
		}
	}
}

function checkRes() {
	if (parseInt(navigator.appVersion) > 3) {
		if (screen.width <= 800 || screen.height <= 600){
			if ( typeof(parent.sidemenu.document.brand)!='undefined') {
				parent.sidemenu.document["brand"].src = "../images/resprob.gif";
			}
		} 
	}
}

function setPhoto(alt, url) {
	if (parseInt(navigator.appVersion) > 3) {
		parent.slide.document["photoHolder"].src = url;
		parent.chooser.document.location.href = "chooser.html";
	}
}

function buildDD() {
	document.write("<form /><select name='guidedtour' onChange='selectDD(this.options[this.selectedIndex].value);'>");
		document.write("<option value='fish'>-------- FAQs --------</option>");
		document.write("<option value='warp=wherelibrary'>Where is the Library?</option>");
		document.write("<option value='warp=events'>This term's events?</option>");
		document.write("<option value='warp=picocon'>Next Picocon?</option>");
		document.write("<option value='warp=committee'>Who are you people?</option>");
		document.write("<option value='warp=newbie'>How do I join?</option>");

		document.write("<option value='fish'>----- I'm Bored! -----</option>");
		document.write("<option value='warp=irc'>Chat on #icsf</option>");		
		document.write("<option value='warp=bookclub'>Book club</option>");
		document.write("<option value='warp=resources'>Something to read?</option>");
		document.write("<option value='warp=links'>I'm looking for links</option>");
		document.write("<option value='warp=latestwyrm'>Latest Newsletter</option>");
        	document.write("<option value='warp=newbooks'>New Books?</option>");

		document.write("<option value='fish'>------ I'm Lost! ------</option>");
		document.write("<option value='warp=sitemap'>Sitemap</option>");
		document.write("<option value='warp=new'>What's New?</option>");
		document.write("<option value='warp=help'>I don't understand!</option>");
	document.write("</select>");
}

function selectDD(url) {
	if (url == 'fish') {
	} else {
	parent.document.location.href = "../../frameset.php?" + url;
	}
}

function buildBioDD() {
	document.write("<form /><select name='guidedtour' onChange='selectBioDD(this.options[this.selectedIndex].value);'>");
		document.write("<option value='fish'>--- Jump to another Bio ---</option>");
		document.write("<option value='fish'>-------- Committee -------</option>");
		document.write("<option value='jacob_mccarthy.html'>Jacob McCarthy</option>");
		document.write("<option value='michael_wright.html'>Michael Wright (Karne)</option>");
		document.write("<option value='simon_matthews.html'>Simon Matthews</option>");
		document.write("<option value='teanyunn_chan.html'>Teanyunn Chan (Shuri)</option>");
		document.write("<option value='jo_bailey.html'>Jo Bailey</option>");
		document.write("<option value='alex_crosse.html'>Alex Crosse</option>");				
			
		document.write("<option value='fish'>--- Active Members ---</option>");
		document.write("<option value='james_barrett.html'>James Barrett (Baz)</option>");
		document.write("<option value='simon_clay.html'>Simon Clay</option>");
		document.write("<option value='dave_clements.html'>Dave Clements</option>");
		document.write("<option value='peter_gribble.html'>Peter Gribble (Tai)</option>");
		document.write("<option value='matt_johnson.html'>Matt Johnson</option>");
		document.write("<option value='john_kirk.html'>John Kirk</option>");
		document.write("<option value='peter_muir.html'>Peter Muir</option>");
		document.write("<option value='norfolk.html'>Norfolk</option>");
		document.write("<option value='michelle_osmond.html'>Michelle Osmond</option>");
		document.write("<option value='phil_pearson.html'>Phil Pearson</option>");
		document.write("<option value='richard_plackett.html'>Richard Plackett</option>");
		document.write("<option value='lorna_robinson.html'>Lorna Robinson</option>");
		document.write("<option value='ali_ryan.html'>Ali Ryan</option>");
		document.write("<option value='alia_sheikh.html'>Alia Sheikh</option>");
		document.write("<option value='alexi_tingey.html'>Alexi Tingey</option>");
		document.write("<option value='ed_walker.html'>Ed Walker</option>");
		document.write("<option value='viv_white.html'>Viv White</option>");
		document.write("<option value='jakob_whitfield.html'>Jakob Whitfield</option>");

									
		document.write("<option value='fish'>--------- Alumni ---------</option>");
		document.write("<option value='flat.html'>The icsf Flat</option>");
		document.write("<option value='chris_abbott.html'>Chris (Billy) Abbott</option>");
		document.write("<option value='adam_auden.html'>Adam Auden</option>");
		document.write("<option value='steve_baines.html'>Steve Baines</option>");
		document.write("<option value='amanda_baker.html'>Amanda Baker</option>");		
		document.write("<option value='julian_bills.html'>Julian Bills</option>");
		document.write("<option value='andrew_bradbrook.html'>Andrew Bradbrook</option>");
		document.write("<option value='steve_brewster.html'>Steve Brewster</option>");
		document.write("<option value='anthony_brown.html'>Anthony Brown</option>");
		document.write("<option value='sam_cheung.html'>Sam Cheung</option>");
		document.write("<option value='seb_drury.html'>Seb Drury</option>");
		document.write("<option value='john_finley.html'>John Finley</option>");
		document.write("<option value='julie_harris.html'>Julie Harris</option>");
		document.write("<option value='robin_hill.html'>Robin Hill</option>");
		document.write("<option value='liz_hodson.html'>Liz Hodson</option>");
		document.write("<option value='denis_howe.html'>Denis Howe</option>");
		document.write("<option value='nicholas_farrow.html'>Nicholas Farrow</option>");
		document.write("<option value='jk_fouzdor.html'>JK Fouzdor</option>");
		document.write("<option value='stuart_jenkins.html'>Stuart Jenkins</option>");
		document.write("<option value='lloyd_kilford.html'>Lloyd Kilford</option>");
		document.write("<option value='alex_mclintock.html'>Alex McLintock</option>");
		document.write("<option value='kenneth_mann.html'>Kenneth Mann</option>");
		document.write("<option value='chris_patrick.html'>Chris Patrick</option>");
		document.write("<option value='james_ramirez.html'>James Ramirez</option>");
		document.write("<option value='alan_romeril.html'>Alan Romeril</option>");
		document.write("<option value='james_shirvill.html'>James Shirvill</option>");
		document.write("<option value='matt_siddall.html'>Matt Siddall</option>");
		document.write("<option value='dan_smith.html'>Dan Smith</option>");
		document.write("<option value='michael_spilling.html'>Michael Spilling</option>");
		document.write("<option value='bob_walker.html'>Bob Walker</option>");
		document.write("<option value='alex_walton.html'>Alex Walton</option>");
		document.write("<option value='hl_windsor.html'>hl Windsor</option>");
		document.write("<option value='tom_yates.html'>Tom Yates</option>");
				
	document.write("</select>");
}

function selectBioDD(url) {
	if (url == 'fish') {
	} else {
	document.location.href = url;
	}
}

function setFramesetLink(){

	var inFrames = false;
	if (parent.frames.length != 0) {
	  // loaded in frames
	  inFrames = true;
	}

	if (inFrames) {
		//document.write("Loaded in a frameset");
		//var rootURL = "http://dormouse.fluffy-dragons.org.uk/icsf/";
		var rootURL = "http://www2.union.ic.ac.uk/scc/icsf/";
		var type = "s";
		var url = "";
		var i=0;	
		//document.write("<p>Frame names:");
		for (i=0; i<parent.frames.length; i++){
			var frameName = parent.frames[i].name;
			var frameURL = parent.frames[i].location.href;
			//document.write("<br />"+i+". ");
			//document.write(frameName+", "+frameURL);
			// 0. blank, http://dormouse.fluffy-dragons.org.uk/icsf/social/menu/blank.html
			// 1. sidemenu, http://dormouse.fluffy-dragons.org.uk/icsf/social/menu/sidemenu.html
			// 2. topmenu, http://dormouse.fluffy-dragons.org.uk/icsf/social/menu/topmenu.html
			// 3. main, http://dormouse.fluffy-dragons.org.uk/icsf/php/events.php 
		
			if (frameName=="sidemenu"){
				if (frameURL.indexOf("icsf/social/")>=0){
					//document.write(" - in the SOCIAL section");
					type = "s";
				} else {
					type = "l";
				}
			}
			if (frameName=="main"){
				if (frameURL.indexOf(rootURL)>=0){
					url= frameURL.substring(rootURL.length,frameURL.length);
					//document.write("<br />"+url);
				}

			}
		}
		var framesetLink = rootURL+"frameset.php?type="+type+"&url="+url;
		//document.write("<a href=\""+framesetLink+"\" target=\"_top\">Frameset link</a>");
		parent.location.href = framesetLink;
	
	} else {
		//document.write("Not loaded in a frameset");
	}

}
