
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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

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_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&&i<d.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 doNuhn() {}

function getRefToDiv(divID,oDoc) {
	if( document.getElementById ) { return document.getElementById(divID); }
	if( document.all ) { return document.all[divID]; }
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) {
			return oDoc.layers[divID];
		} else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDiv(divID,oDoc.layers[x].document);
			}
			return y;
		}
	}
	return false;
}




function rwDiv(divID_as_a_string) {
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.innerHTML ) { myReference.innerHTML = ('<p>' + (step+1) +' / ' + (imax+1) +'<\/p>' + pic[step][0][1]); } else {
		if( myReference.document && myReference.document != window.document ) {
			myReference.document.open();
			myReference.document.write('<p>' + (step+1) +' / ' + (imax+1) +'<\/p>' + pic[step][0][1]);
			myReference.document.close();
		} else {
			window.alert('Your browser does not allow the contents to be re-written.\nI have not implemented an iframe here.\nSee my generic re-writable elements example for how this should be done.'); return; }
    }
}




function emailDiv(divID_as_a_string) {
var part2 = "wingfinger.co.uk"
var at = "@"
var part1 = "pteri"
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.innerHTML ) { myReference.innerHTML = (part1+at+part2); } else {
		if( myReference.document && myReference.document != window.document ) {
			myReference.document.open();
			myReference.document.write(part1+at+part2);
			myReference.document.close();
		} else {
			window.alert('Your browser does not allow the contents to be re-written.\nI have not implemented an iframe here.\nSee my generic re-writable elements example for how this should be done.'); return; }
    }
}

function linkDiv(divID_as_a_string) {
var part2 = "wingfinger.co.uk"
var at = "@"
var part1 = "pteri"
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.innerHTML ) { myReference.innerHTML = ('<a href="mailto:'+part1+at+part2+'">Email</a>'); } else {
		if( myReference.document && myReference.document != window.document ) {
			myReference.document.open();
			myReference.document.write('<a href="mailto:'+part1+at+part2+'">Email</a>');
			myReference.document.close();
		} else {
			window.alert('Your browser does not allow the contents to be re-written.\nI have not implemented an iframe here.\nSee my generic re-writable elements example for how this should be done.'); return; }
    }
}

function generate_address( part1, part2 ) {
var atsign = "&#64;";
var addr = part1 + atsign + part2;
document.write( 
"<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" +
addr +
"<\/a>");
}




/*To change the size of a positioned element:
MWJ_changeSize( idOfPositionedElement, width, height[, optional referenceToFrameToStartSearchingIn] )*/
function MWJ_changeSize( oName, oWidth, oHeight, oFrame ) {
        var theDiv = MWJ_findObj( oName, oFrame ); if( !theDiv ) { return; }
        if( theDiv.style ) { theDiv = theDiv.style; } var oPix = document.childNodes ? 'px' : 0;
        if( theDiv.resizeTo ) { theDiv.resizeTo( oWidth, oHeight ); }
        theDiv.width = oWidth + oPix; theDiv.pixelWidth = oWidth;
        theDiv.height = oHeight + oPix; theDiv.pixelHeight = oHeight;
}

/*To change the visibility of a positioned element - true for visible, false for hidden:
MWJ_changeVisibility( idOfPositionedElement, true/false[, optional referenceToFrameToStartSearchingIn] );*/
function MWJ_changeVisibility( oName, oVis, oFrame ) {
	var theDiv = MWJ_findObj( oName, oFrame ); if( !theDiv ) { return; }
	if( theDiv.style ) { theDiv.style.visibility = oVis ? 'visible' : 'hidden'; } else { theDiv.visibility = oVis ? 'show' : 'hide'; }
}

/*To change the position of a positioned element - true for relative to the document, false for
relative to its current position:
MWJ_changePosition( idOfPositionedElement, leftOffset, topOffset, true/false[, optional referenceToFrameToStartSearchingIn] ); */
function MWJ_changePosition( oName, oXPos, oYPos, oRel, oFrame ) {
	var theDiv = MWJ_findObj( oName, oFrame ); if( !theDiv ) { return; }
	if( theDiv.style ) { theDiv = theDiv.style; } var oPix = document.childNodes ? 'px' : 0;
	if( typeof( oXPos ) == 'number' ) { theDiv.left = ( oXPos + ( oRel ? 0 : parseInt( theDiv.left ) ) ) + oPix; }
	if( typeof( oYPos ) == 'number' ) { theDiv.top = ( oYPos + ( oRel ? 0 : parseInt( theDiv.top ) ) ) + oPix; }
}

/*To reference any frame, iframe, form, input, image or anchor (but not link) by its name, or
positioned element by its id in the current document - it can optionally scan through any frameset
structure to find it (searching in frames that have not loaded will cause an error):
theObject = MWJ_findObj( nameOrIdOfObject[, optional referenceToFrameToStartSearchingIn] ); */
function MWJ_findObj( oName, oFrame, oDoc ) {
	if( !oDoc ) { if( oFrame ) { oDoc = oFrame.document; } else { oDoc = window.document; } }
	if( oDoc[oName] ) { return oDoc[oName]; } if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; }
	if( oDoc.getElementById && oDoc.getElementById(oName) ) { return oDoc.getElementById(oName); }
	for( var x = 0; x < oDoc.forms.length; x++ ) { if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
	for( var x = 0; x < oDoc.anchors.length; x++ ) { if( oDoc.anchors[x].name == oName ) { return oDoc.anchors[x]; } }
	for( var x = 0; document.layers && x < oDoc.layers.length; x++ ) {
		var theOb = MWJ_findObj( oName, null, oDoc.layers[x].document ); if( theOb ) { return theOb; } }
	if( !oFrame && window[oName] ) { return window[oName]; } if( oFrame && oFrame[oName] ) { return oFrame[oName]; }
	for( var x = 0; oFrame && oFrame.frames && x < oFrame.frames.length; x++ ) {
		var theOb = MWJ_findObj( oName, oFrame.frames[x], oFrame.frames[x].document ); if( theOb ) { return theOb; } }
	return null;
}


