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];}
}

// set the text of the item
function RollDest(str) {
	var elem = document.getElementById("destination");
	elem.firstChild.nodeValue = str;  
	}
// unset the text ... can't be a space for IE
function UnrollDest() {
	var elem = document.getElementById("destination");
	// 160=nbsp;
	elem.firstChild.nodeValue = String.fromCharCode(160); 
	}

// wrapper functions
function RollOver(id,lit,str){
	MM_swapImage(id,'',lit,1)
	RollDest(str);
	}

function RollOut() {
	MM_swapImgRestore();	
	UnrollDest();
	}

function before(imgroot) {
//alert("yo!");
var elem = document.getElementById("beforeafter");
	if (!document.before) {
		document.before = true;
		var ipath = "photos/"+imgroot+".before.jpg";
		//alert (ipath);
		MM_swapImage("ba",'',ipath,1)
		elem.firstChild.nodeValue = document.atext;
		}
	else {
		document.before = false;
		MM_swapImgRestore();	
		elem.firstChild.nodeValue = document.btext;
		}
	}

function setbefore(btext,atext) {
	var elem = document.getElementById("beforeafter");
	document.before = false;
	document.btext = btext;
	document.atext = atext;
	elem.firstChild.nodeValue = document.btext;
}


// write either a flash movie or a static image
// part of flash modularization code
// boolean, use flash?
// id of flash as string
// width of flash/image in pixels
// height of flash/image in pixels
// relative path to flash
// relative path to image
// alt text for image
function flashImageText(flashbool,flid,flwid,flht,flpath,imgpath,imgalt) {
	if (flashbool) {
		return flashText(flid,flwid,flht,flpath);
		}
	else {
		return imgText(flwid,flht,imgpath,imgalt);
		}
	}


// write a flash movie into the document if it's supported
// part of flash modularization code
// id (as string)
// width in pixels
// height in pixels
// relative path to swf file
// this is a separate function so you can specify different height/width for flash vs image if necessary
function flashText(flid,flwd,flht,flpath) {
	var flstr;
	flstr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
				'  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ' +
				' id="' + flid + '" width="' + flwd + '" height="' +flht+ '" align="">' +
				' <param name="movie" value="' + flpath + '"><param name="loop" value="true"><param name="menu" value="false">' +
				'<param name="quality" value="high"> <param name="bgcolor" value="#ffffff">  ' +
				' <embed src="' + flpath + '" loop="true" menu="false" quality="high" bgcolor="#ffffff"  ' + 
				' swLiveConnect="FALSE" width="' + flwd + '" height="' + flht + '" name="' + flid + '" align=""' +
				' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">' +
				' </embed>' + 
				' </object>';
	return flstr;
}
// write a static image (instead of a flash movie) into the dociment
// part of flash modularization code
// width in pixels
// height in pixels
// relative path
// alt text
// this is a separate function so you can specify different height/width for flash vs image if necessary
function imgText(imgwid,imght,imgpath,imgalt) {
	return('<img src="' + imgpath + '" width="' + imgwid + '" height="' + imght + '" alt="' + imgalt + '" />');
	}

// netscape plugin check
// part of flash modularization code
// no arguments
function plugCheck() {
				var words = navigator.plugins["Shockwave Flash"].description.split(" ");
				for (var i = 0; i < words.length; ++i)
				{
				if (isNaN(parseInt(words[i])))
				continue;
				var MM_PluginVersion = words[i]; 
				}
			var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
			return MM_FlashCanPlay;
	}


// create flashcanplay w/ vbscript
// part of flash modularization code
// no arguments
function ieFlashwrite() {
	var flstr;
	flstr = '<scr' + 'ipt LANGUAGE=\"VBScript\"\> \n' + //FS hide this from IE4.5 Mac by splitting the tag
			'on error resume next \n' +
			'MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n' +
			'</scr' + 'ipt\> \n';
	return flstr;
}

//if (DEBUG) {
//	alert("done");
//	}