// MOUSEOVER BUTTONS //
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&&i<a.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&&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];}
}

// On-Click Enlargements

// setStyleById: given an element id, style property and 
// value, apply the style.
// args:
//  i - element id
//  p - property
//  v - value
//
function setStyleById(i, p, v) {
	var n = document.getElementById(i);
	n.style[p] = v;
}

function showPic(whichpic, whichref, whichsqf, whichlsz, whichybt, whichcap, whichfloat) {
 if (document.getElementById) {
	//s = new String(whichpic.href);
	//s = s.replace(/.php/g,".jpg");
  document.getElementById('placeholder').src = whichpic.id;
  document.getElementById('placeholder').title = whichpic.title;
  document.getElementById('placeholder').alt = whichcap;
  if (whichfloat == 1) {
	document.getElementById('placeholder').style.styleFloat = 'none';
	document.getElementById('placeholder').style.cssFloat = 'none';
	document.getElementById('placeholder').style.marginRight = '0px';
  } else {
	document.getElementById('placeholder').style.styleFloat = 'left';
	document.getElementById('placeholder').style.cssFloat = 'left';
	document.getElementById('placeholder').style.marginRight = '10px';
  }
  document.getElementById('picName').childNodes[0].nodeValue = whichpic.title;
  document.getElementById('caption').childNodes[0].nodeValue = whichcap;
  document.getElementById('ref').childNodes[0].nodeValue = whichref;
  document.getElementById('sqf').childNodes[0].nodeValue = whichsqf;
  document.getElementById('lsz').childNodes[0].nodeValue = whichlsz;
  document.getElementById('ybt').childNodes[0].nodeValue = whichybt;
  return false;
 } else {
  return true;
 }
}

function showFlash() {
 if (document.getElementById) {
 	//setTimeout("loadFlash('/graphics/mainintro.jpg')",2500);
	//var flashLinkSpecs = "javascript:popUpWin('/intro.php');";
	var flashLinkSpecs = "/intro.htm";
	swapfade(document.getElementById('flashloader'), '/graphics/mainintro.jpg', '2', flashLinkSpecs);
	//crossfade(document.getElementById('flashloader'), '/graphics/mainintro.jpg', '5', 'Accessible Website Menu [green]');
	return false;
 } else {
	return true;
 }
}

function loadFlash(whichImg) {
	var flashLinkSpecs = "javascript:popUpWin('/intro.php');";
	document.getElementById('flashloader').src = whichImg;
	document.getElementById('flashlink').href = flashLinkSpecs;
}

var newWindow = null;
function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}
function popUpWin(url){
	closeWin();
	var tools="resizable=no,menubar=no,location=no,scrollbars=no,width=720,height=390";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}
function openPictureWindow(imageName,imageWidth,imageHeight,alt) {  // v4.01
if (document.getElementById) {
	var imgw = ( (imageWidth <= 750) ? imageWidth : 750 );
	var imgh = ( (imageHeight <= 550) ? imageHeight : 550 );
	newWindow = window.open("","newWindow","width="+imgw+",height="+imgh+",scrollbars=yes,left=0,top=0,resizable=yes");
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body onBlur="self.close()" style="margin:0;padding=0;">'); 	
	newWindow.document.write('<div style="margin:3px;text-align:center;">'); 	
	newWindow.document.write('<img src="'+imageName.href+'" width="'+(imageWidth-30)+'" height="'+(imageHeight-30)+'" alt="'+alt+'" style="border:1px solid #000000;margin:0;padding:0;">');
	newWindow.document.write('</div>'); 	
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
  return false;
 } else {
  return true;
 }
}
