if (top.location != self.location)	{ top.location = self.location }
n = 1;
x = 1;
sect = 0;
counter = 0;

window.onload = init();
document.onkeydown = keyNavigate();

document.write("<style type='text/css'>");
document.write(".show {display:block;}");
document.write(".hide {display:none;}");
document.write("<\/style>");

function closeme() {
	window.close();		//Close pop-up
} 

function popup0() {
	window.name ="mainWindow";
	window.open('pop-up1.htm','popup','width=840,height=800,scrollbars=yes,resizable=yes');
} 

function popup1() { window.open('cms_flow.htm','popup','width=600,height=600,scrollbars=yes,resizable=yes') } 
function popup2() { window.open('182what.htm','popup','width=600,height=600,scrollbars=yes,resizable=yes') } 
function popup3() { window.open('pages/pop3.htm','popup','width=700,height=660,scrollbars=yes,resizable=yes') } 
function popup4() { window.open('pages/pop4.htm','popup','width=700,height=600,scrollbars=yes,resizable=yes') } 
function popimage(imgname,vert,horiz) { var imagename = imgname; window.open('image.htm','popup','width=horiz,height=vert,scrollbars=yes,resizable=yes'); }

function gopage() {
  if (opener && !opener.closed) {opener.location.href = "http://www.blurb.com/bookstore/detail/2098910"};
	window.close();
}

function init() {
	document.getElementById('nex').className = "show"
	document.getElementById("part1").className = "show"
	document.getElementById("menu1").style.color = "#cc0000"
	document.getElementById("menu1").style.marginLeft = "25px"
	document.getElementById('prev').className = "hide"
	x = 1

	document.getElementById(win).style.display = "block"
	document.getElementById(mac).style.display = "none"
}

function writemenu(sections) {
	for (var itemNo = 1; itemNo <= sections; itemNo++) { 
		document.write("<a href='#' id='menu" + itemNo + "' onclick='javascript:goTo(" + itemNo + ")'>Section " + itemNo + "<\/a> ")
		}
}

function keyNavigate(goPage) {
	var myKeyCode;
	if (window.event) {
		myKeyCode = window.event.keyCode;
		}
	else if (goPage) {
		myKeyCode = goPage.which;
	}
//	alert(myKeyCode)
	switch(myKeyCode) {
		case 32: //Spacebar
		next();
		break;
//		case 34: //Page Down Key
//		next();
//		break;
		case 39: // Right Arrow Key
		next();
		break;
//		case 33: //Page Up Key
//		previous();
//		break;
		case 37: //Left Arrow Key
		previous();
		break;
	}
}

function goTo(z) {	//z is the section number to navigate to
	x = z
	for (var q = 1; q <= 20; q++) {
		var productElement = document.getElementById("part" + q);
		if (productElement == null) {
			var p = q - 1	//p is the number of sections in the document
			break;
		}
	}
	for (var i = 1; i <= p; i++) {
		document.getElementById("part" + i).className = "hide"
		document.getElementById("menu" + i).style.color = "#000000"
		document.getElementById("menu" + i).style.marginLeft = "17px"
		}
	document.getElementById('prev').className = "show"
	document.getElementById('nex').className = "show"
	document.getElementById("part" + z).className = "show"
	document.getElementById("menu" + z).style.color = "#cc0000"
	document.getElementById("menu" + z).style.marginLeft = "25px"
	if (z == 1) {document.getElementById('prev').className = "hide"}
	if (z == p) {document.getElementById('nex').className = "hide"}
	scroll(0,0);
}

function next() {
	if (document.getElementById('nex').className == "show") {
		gopart = "part" + x
		document.getElementById(gopart).className = "hide"
		document.getElementById("menu" + x).style.color = "#000000"
		document.getElementById("menu" + x).style.marginLeft = "17px"
		x++
		document.getElementById("menu" + x).style.color = "#cc0000"
		document.getElementById("menu" + x).style.marginLeft = "25px"
		gopart = "part" + x
		document.getElementById(gopart).className = "show"
		if (x > 1) {document.getElementById('prev').className = "show"}
		if (x == sect) {document.getElementById('nex').className = "hide"}
		setTimeout("scroll(0,0)", 5)
	}
}

function previous() {
	if (document.getElementById('prev').className == "show") {
		document.getElementById("part" + x).className = "hide"
		document.getElementById("menu" + x).style.color = "#000000"
		document.getElementById("menu" + x).style.marginLeft = "17px"
		x--
		document.getElementById("menu" + x).style.color = "#cc0000"
		document.getElementById("menu" + x).style.marginLeft = "25px"
		document.getElementById("part" + x).className = "show"
		if (x == 1) {document.getElementById('prev').className = "hide"}
		if (x < sect) {document.getElementById('nex').className = "show"}
//		setTimeout("scroll(0,0)", 5)
	}
}

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";
      }
    }
  } 
}
// Email code
	// 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
	var v = "mark"
	var domain = "robertstech.com"
	var w = "mai"
	var x = "lto:"

	if (y == "webmaster") {	// This is for the "email webmaster" code at the bottom of every page
		y = v
		z = domain
		// alert(w + x + y + z)
		document.getElementById("webmaster").href = w + x + y + "@" + z
		}
	else {			// This is used for all other email addresses
		if (z == "1") {
			z = "robertstech.com" ;
			}
		// alert(w + x + y + z)
		document.getElementById(y).href = w + x + y + "@" + z
		}
	}
// End Email code

function mailhide(y,z) {
		document.getElementById(y).href = "http://www.robertstech.com/mail_01.htm"
}

