
//  MacroMedia functions:

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

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 printNavigation(page) {
	
	document.write('<table cellpadding="0" cellspacing="0" border="0" bgcolor="#1D202A"><tr height="20" valign="top">');
	document.write('<td><img src="img/global/nav_green.gif" width=321 height=20 alt="" border="0"></td>');
	
	document.write('<td>');
		if (page == "biography") {
			document.write('<img src="img/global/nav_bio_active.gif" width=85 height=20 alt="" border="0">');
		} else {
			document.write('<a href="biography.html"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'bio\',\'\',\'img/global/nav_bio_over.gif\',1)">');
			document.write('<img src="img/global/nav_bio.gif" width=85 height=20 alt="" border="0" name="bio">');
			document.write('</a>');
		}
	document.write('</td>');
	
	document.write('<td><img src="img/global/nav_small_spacer.gif" width=8 height=20 alt="" border="0"></td>');
	
	document.write('<td>');	
		if (page == "books") {
			document.write('<img src="img/global/nav_books_active.gif" width=62 height=20 alt="" border="0">');
		} else {
			document.write('<a href="books.html"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'books\',\'\',\'img/global/nav_books_over.gif\',1)">');
			document.write('<img src="img/global/nav_books.gif" width=62 height=20 alt="" border="0" name="books">');
			document.write('</a>');
		}
	document.write('</td>');
	
	document.write('<td><img src="img/global/nav_small_spacer.gif" width=8 height=20 alt="" border="0"></td>');
	
	document.write('<td>');
		if (page == "story_archive") {
			document.write('<img src="img/global/nav_story_active.gif" width=102 height=20 alt="" border="0">');
		} else {
			document.write('<a href="story_archive.html"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'story\',\'\',\'img/global/nav_story_over.gif\',1)">');
			document.write('<img src="img/global/nav_story.gif" width=102 height=20 alt="" border="0" name="story">');
			document.write('</a>');
		}
	document.write('</td>');
	
	document.write('<td><img src="img/global/nav_small_spacer.gif" width=8 height=20 alt="" border="0"></td>');
	
	document.write('<td>');
		if (page == "films") {
			document.write('<img src="img/global/nav_films_active.gif" width=57 height=20 alt="" border="0">');
		} else {
			document.write('<a href="films.html"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'films\',\'\',\'img/global/nav_films_over.gif\',1)">');
			document.write('<img src="img/global/nav_films.gif" width=57 height=20 alt="" border="0" name="films">');
			document.write('</a>');
		}
	document.write('</td>');
/*		
	document.write('<td><img src="img/global/nav_small_spacer.gif" width=8 height=20 alt="" border="0"></td>');
	
	document.write('<td>');
		if (page == "blog") {
			document.write('<img src="img/global/nav_blogs_active.gif" width=55 height=20 alt="" border="0">');
		} else {
			document.write('<a href="blog.html"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'blog\',\'\',\'img/global/nav_blogs_over.gif\',1)">');
			document.write('<img src="img/global/nav_blogs.gif" width=55 height=20 alt="" border="0" name="blog">');
			document.write('</a>');
		}
	document.write('</td>');
	
	document.write('<td><img src="img/global/nav_small_spacer.gif" width=8 height=20 alt="" border="0"></td>');

	document.write('<td>');
		if (page == "news") {
			document.write('<img src="img/global/nav_news_active.gif" width=56 height=20 alt="" border="0">');
		} else {
			document.write('<a href="news.html"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'news\',\'\',\'img/global/nav_news_over.gif\',1)">');
			document.write('<img src="img/global/nav_news.gif" width=56 height=20 alt="" border="0" name="news">');
			document.write('</a>');
		}
	document.write('</td>');
*/	
	document.write('<td><img src="img/global/nav_small_spacer.gif" width=8 height=20 alt="" border="0"></td>');
	
	document.write('<td>');
		if (page == "contact") {
			document.write('<img src="img/global/nav_contact_active.gif" width=70 height=20 alt="" border="0">');
		} else {
			document.write('<a href="contact.html"  onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'contact\',\'\',\'img/global/nav_contact_over.gif\',1)">');
			document.write('<img src="img/global/nav_contact.gif" width=70 height=20 alt="" border="0" name="contact">');
			document.write('</a>');
		}
	document.write('</td>');
	
	document.write('<td><img src="img/global/nav_small_spacer.gif" width=21 height=20 alt="" border="0"></td>');
	
	document.write('</tr></table>');
	
}

//==================================================
// footer:
//==================================================

function printFooter() {

	document.write('<tr><td>');
		document.write('<table cellpadding="0" cellspacing="0" border="0" width="750">');
		document.write('<tr height="20">');
		document.write('<td width="185"><img src="img/global/spacer.gif" width=185 height=1 alt="" border="0"></td>');
		document.write('<td>');
			document.write('<img src="img/global/spacer_gray.gif" width=330 height=15 alt="" border="0"><br><br>');
		document.write('</td>');
		document.write('</tr>');
		document.write('</table>');
		document.write('<img src="img/global/bottom.gif" width=750 height=22 alt="" border="0">');
		document.write('<table cellpadding="0" cellspacing="0" border="0" width="750" class="footer">');
		document.write('<tr height="20">');
		document.write('<td bgcolor="999999" width="25"><img src="img/global/spacer.gif" width=25 height=20 alt="" border="0"></td>');
		document.write('<td bgcolor="999999" width="160">&nbsp;&copy;2008 Adam L. Penenberg</td>');
		document.write('<td bgcolor="999999" width="353">');
			document.write('<a href="index.html">home</a> |');
			document.write('<a href="biography.html">biography</a> | ');
			document.write('<a href="books.html">books</a> | ');
			document.write('<a href="story_archive.html">archive</a> | ');
			document.write('<a href="films.html">films</a> | ');
			//document.write('<a href="blog.html">blog</a> | ');
			//document.write('<a href="news.html">news</a> | ');
			document.write('<a href="contact.html">contact</a>');
		document.write('</td>');
		document.write('<td width="1"><img src="img/global/spacer.gif" width=1 height=20 alt="" border="0"></td>');
		document.write('<td width="211" bgcolor="333333">&nbsp; &nbsp;<a href="http://www.ms-ds.com" target="_blank" >Matthew Schwartz Design Studio</a></td>');
		document.write('</tr>');
		document.write('</table>');
	document.write('<!-- end footer -->');
	
	document.write('</td></tr>');
}

//==================================================
// flash detection:
//==================================================

// heavily modified version of original by colin moock

// user defined global: modify to customize the inspection behaviour
var requiredVersion = 4;			// version needed

// system globals
var flash2Installed = false;		// boolean. true if flash 2 is installed
var flash3Installed = false;		// boolean. true if flash 3 is installed
var flash4Installed = false;		// boolean. true if flash 4 is installed
var flash5Installed = false;		// boolean. true if flash 5 is installed
var flash6Installed = false;		// boolean. true if flash 5 is installed
var maxVersion = 6;					// highest version we can actually detect
var actualVersion = 0;				// version the user really has
var hasRightVersion = false;		// boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0;				// the version of javascript supported


// check the browser...we're looking for ie/win
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.platform.indexOf("Win32") != -1) ? true : false;

// this is a js1.1 code block, so make note that js1.1 is supported.
jsVersion = 1.1;

// write vbscript detection if we're not on mac.
if(isIE && isWin) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n'); 
	document.write('</SCR' + 'IPT\> \n');
}


function detectFlash() {	
	if (navigator.plugins) {	// does navigator.plugins exist?
		if (navigator.plugins["Shockwave Flash 2.0"] 	// yes>> then is Flash 2 
		|| navigator.plugins["Shockwave Flash"]) {		// or flash 3+ installed?

			// set convenient references to flash 2 and the plugin description
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

			// we know the version, now set appropriate version flags
			flash2Installed = flashVersion == 2;		
			flash3Installed = flashVersion == 3;
			flash4Installed = flashVersion == 4;
			flash5Installed = flashVersion == 5;
			flash6Installed = flashVersion >= 6;
		}
	}
	
	// loop through all versions and set actualVersion to highest detected version
	for (var i = 2; i <= maxVersion; i++) {	
		if (eval("flash" + i + "Installed") == true) actualVersion = i;
	}
	
	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;
	
	// return true if greater than or equal to required version, else return false.
	if (actualVersion >= requiredVersion) {
		return true;
	} 
	else {
		return false;
	}
}