if (top.location != self.location) { top.location = self.location }

if (navigator.appName == "Microsoft Internet Explorer")
	{
	window.onload = checkVersion;
	}
 else
	{
	if (document.getElementById("indexpage").className == "book") {window.onload = setcookie}
	}

// Email code
var counter = 0
var v = "mark"
var domain = "robertstech.com"
var w = "mai"
var x = "lto:"

	// Code in the HTML page passes two arguments (y,z) to this function: y is
	// the "username" part of the address (everything before the "@" sign), which is also the ID of the
	// anchor tag on the HTML page. z is the domain name part of the address.

	function sendmail(y,z) {	// Below are the domain names used in the final part of the email address function. Add more if necessary
	if (y == "webmaster") {	// This is for the "email webmaster" code at the bottom of every page
		y = v
		z = domain
		document.getElementById("webmaster").href = w + x + y + "@" + z
		}
	else {			// This is used for all other email addresses
		if (z == "1") {
			z = "robertstech.com" ;
			}
		document.getElementById(y).href = w + x + y + "@" + z
		}
	}
// End Email code

function setcookie() { document.cookie="movevalue=stay";} //When page first loads, set cookie NOT to load Books page

function cookiecheck() { //run this function on main window gotFocus
 	if (document.cookie!="") 
	{ // break apart the cookie and look for value of "movevalue"
		var stringToSplit=document.cookie
		var cookieStrings=stringToSplit.split(";")
		for (var i=0; i<cookieStrings.length; i++)
		{
			if (cookieStrings[i].search("movevalue")!=-1)	
			// -1 is the value returned if the search function *doesn't* find what it's looking for
			{
				var tempValue=cookieStrings[i]
				var equalSign=tempValue.indexOf("=")
				var outputValue=tempValue.slice(equalSign+1)
			}	
		}	
		if (outputValue == "relocate") { // If user has just closed the pop-up by selecting the PDML book page from there...
			document.cookie="movevalue=stay"; // ...re-set the cookie value back to default and then...
			document.location="books.htm" // ...go to that page
			}
	}
}

function checkVersion() {
 var msg = "Not Internet Explorer.";
 var ver = -1; // Return value assumes failure.
 var ua = navigator.userAgent;
 var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
 if (re.exec(ua) != null)
	{
	ver = parseFloat( RegExp.$1 );
	}
	if ( ver > -1 )
	{
		if ( ver >= 7.0 ) 
		{
			msg = "Internet Explorer 7 or later - no change"
			if (document.getElementById("indexpage").className == "book") {window.onload = setcookie}
		}
		else
		{
			msg = "Internet Explorer 6 or earlier - oh no!"
			if (document.title == "Photography and Multimedia: Mark Roberts, Boston - Robertstech digital imaging, sound design and web media")
				{
				document.getElementById("mainpart1").style.width="55%";
//				document.getElementById("mainpart1").style.border="1px solid #ffffff";
//				document.getElementById("rightside").style.border="1px solid #ffffff";
				document.getElementById("rightside").style.position="absolute";
				document.getElementById("rightside").style.width="130px";
				document.getElementById("rightside").style.right="40px";
				document.getElementById("rightside").style.top="170px";
				setcookie;
				}
			else
				{
				document.getElementById("homelogo").style.width="112px";
				document.getElementById("pagehead").style.display="inline";
				document.getElementById("pagehead").style.marginLeft="30px";
				document.getElementById("main").style.width="75%";
				document.getElementById("gallerycol").style.width="145px";
				document.getElementById("gallerycol").style.marginLeft="-5px";
				document.getElementById("pagelogo").style.marginTop="-10px";
				}
		}
	}
}

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
 
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}

