function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&ia.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&id.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function spacer(w,h) {
return '<img src="rc_img/x.gif" width="'+w+'" height="'+h+'" border="0">';
}

function set_img(div_id,src,width,height) {
document.getElementById(div_id).innerHTML = '<img src="rc_img/'+src+'" width="'+width+'" height="'+height+'" border="0">';
}

function set_text(div_id,text) {
document.getElementById(div_id).innerHTML = text;
}

function set_mr(projname,projloc,qstring,n) {
if (projname=='mapswitch') { 
	linktext='<a href="#" class="link">click for '+projloc+' map</a>';
	text='<span class="mrname">'+n+' project';
	if (n>1) { text=text+'s'; }
	text=text+'</span><br><span class="mrloc">';
	if (projloc=='London') { text=text+'in '; } else { text=text+'outside '; }
	text=text+'London</span><br>'+linktext;
}
else 
{
	linktext='<a href="gh_project.php'+qstring+'" class="link">click for Project Sheet</a>';
	text='<span class="mrname">'+projname+'</span><br>';
	if ('projloc'!="") {
		text=text+'<span class="mrloc">'+projloc+'</span><br>';
	}
	text=text+linktext;
}

document.getElementById('maprollover').style.visibility = 'visible';
document.getElementById('mr').innerHTML = text;

setTimeout ( 'clr_mr()', 5000 );
}

function set_r(text) {
if (text!="") {	
	text='<span class="rtext">'+text+'</span>';
}
document.getElementById('r').innerHTML = text;
}

function clr_r() {
document.getElementById('r').innerHTML = '';
}

function clr_mr() {
document.getElementById('mr').innerHTML = '';
document.getElementById('maprollover').style.visibility = 'hidden';
}

function set_bg(div_id,url) {
document.getElementById(div_id).style.backgroundImage = url;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


function bg_set(div_id,backgroundset,pick) {

var bgurl=new Array();
var bgset=new Array();
//sets:
bgurl[0]='gh_img/banner_canes.gif';
bgset[0]='standard';
bgurl[1]='gh_img/banner_class.gif';
bgset[1]='standard';
bgurl[2]='gh_img/banner_construction_kit.gif';
bgset[2]='standard';
bgurl[3]='gh_img/banner_crowd.gif';
bgset[3]='standard';
bgurl[4]='gh_img/banner_fence.gif';
bgset[4]='standard';
bgurl[5]='gh_img/banner_garden.gif';
bgset[5]='standard';
bgurl[6]='gh_img/banner_hands.gif';
bgset[6]='standard';
bgurl[7]='gh_img/banner_hoops.gif';
bgset[7]='standard';
bgurl[8]='gh_img/banner_library.gif';
bgset[8]='standard';
bgurl[9]='gh_img/banner_plasticene.gif';
bgset[9]='standard';
bgurl[10]='gh_img/banner_playground.gif';
bgset[10]='standard';
bgurl[11]='gh_img/banner_library.gif';
bgset[11]='standard';
bgurl[12]='gh_img/banner_river.gif';
bgset[12]='standard';
bgurl[13]='gh_img/banner_sk8rs.gif';
bgset[13]='standard';
bgurl[14]='gh_img/banner_street.gif';
bgset[14]='standard';
bgurl[15]='gh_img/banner_library.gif';
bgset[15]='standard';

bgoptions=bgurl.length;
bgchoice=0;
if (backgroundset==0) {
bgchoice=pick;
}

while(backgroundset!=0) {
bgchoice=Math.floor(Math.random()*(bgoptions));
if (bgset[bgchoice]==backgroundset) {
break; }
}

document.getElementById(div_id).innerHTML = '<img src="'+bgurl[bgchoice]+'" alt="The Glass-House community led design" width="700" height="120">';

}

function newWindow(strPage,h,w)
{
	if (window.screen)
	{
		window.open(strPage,'newWin', 'resize=yes, toolbar=no, status=no, menubar=yes, scrollbars=no, height='+(h)+', width='+(w));
		
		//location.href=strPage;
	}
}

function switch_d(div_id) {
	if (document.getElementById(div_id).style.display=="block")
		{
		document.getElementById(div_id).style.display="none";
		}
		else 
		{
		document.getElementById(div_id).style.display="block";
		}
}

function previewPopup(template,pg_id)
{
	window.open('../'+template+'?pg_id='+pg_id,'page_preview');
}

