// JavaScript Documentfunction Popup(pageurl)
function Popup(book,name)
{
	//plugin=new Array();
	
	//plugin=window.navigator.plugins;
	//for(i=0;i<window.navigator.plugins.length;i++)
		//alert(navigator.plugins[i].name);
	

	var detect = navigator.userAgent.toLowerCase();
	var browser;
	var pageurl = "book"+book+"_pdf/"+name;
	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('netscape')) browser = "Netscape Navigator"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else
	{
		 browser = "An unknown browser";
	}

	/*var sPlatform = app.viewerVariation;
	var sPos = "5";
	
	
	
	if (sPlatform == "Reader") {
	sPos = "5";
	}
	
	if (sPlatform == "Fill-In") {
	sPos = "5";
	}
	
	if (sPlatform == "Full") {
	sPos = "7";
	}
	
	if (sPlatform == "Reader") {
	
	//HIDE MENU ITEMS
	app.hideMenuItem("Save");
	app.hideMenuItem("SaveAs");
	app.hideMenuItem("Import");
	app.hideMenuItem("Export");
	app.hideMenuItem("DocSecurity");
	app.hideMenuItem("DocInfo");
	app.hideMenuItem("GeneralPrefs");
	
	//HIDE TOOLBARBUTTONS
	app.hideToolbarButton("Open");
	app.hideToolbarButton("Save");
	app.hideToolbarButton("ADBE:SPDR:OpStatTlButton");
	
	}
	
	
	if (sPlatform == "Fill-In") {
	
	//HIDE MENU ITEMS
	app.hideMenuItem("Save");
	app.hideMenuItem("SaveAs");
	app.hideMenuItem("Web2PDF:OpnURL");
	app.hideMenuItem("OpnAsPDF");
	app.hideMenuItem("Import");
	app.hideMenuItem("Export");
	app.hideMenuItem("AcroForm:ExportFDF");
	app.hideMenuItem("DocSecurity");
	app.hideMenuItem("DocInfo");
	app.hideMenuItem("Prefs");
	
	//HIDE TOOLBARBUTTONS
	app.hideToolbarButton("Open");
	app.hideToolbarButton("Save");
	app.hideToolbarButton("ADBE:SPDR:OpStatTlButton");
	
	}
	
	
	if (sPlatform == "Full") {
	
	//HIDE MENU ITEMS
	app.hideMenuItem("Save");
	app.hideMenuItem("SaveAs");
	app.hideMenuItem("Web2PDF:OpnURL");
	app.hideMenuItem("OpenAsPDF");
	app.hideMenuItem("Import");
	app.hideMenuItem("Export");
	app.hideMenuItem("AcroForm:ExportFDF");
	app.hideMenuItem("Batch");
	app.hideMenuItem("DocSecurity");
	app.hideMenuItem("DocInfo");
	app.hideMenuItem("Prefs");
	
	//HIDE TOOLBARBUTTONS
	app.hideToolbarButton("Open");
	app.hideToolbarButton("Save");
	app.hideToolbarButton("ADBE:SPDR:OpStatTlButton");
	
	} */
	if(browser == "Netscape Navigator")
	{
		window.open(pageurl,'my_window','width=800,height=600,screenX=350,screenY=150,scrollbars=yes,resizable=yes');
	}
	else
	{
		window.open(pageurl,'my_window','width=800,height=600,left=350,top=125,scrollbars=yes,resizable=yes');
	}
	
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
}

//Function for side menu bar in all of the pages
function menubar(whtInBook,buyIndChaps,readerRev,faq)
{
	document.writeln("<TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0><TBODY>");
	document.writeln("<TR align=left><TD><A class=mainlevel id=active_menu  href=\"index.htm\">Home</A></TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"whtInbook.htm\">What's in the books?</A>");
	if(whtInBook==1)
	{
		
		document.writeln("<DIV style=\"PADDING-LEFT:4px\"><A class=sublevel href=\"book1.htm\">Book 1: Leaving the Garden</A></DIV>");
        document.writeln("<DIV style=\"PADDING-LEFT:4px\"><A class=sublevel href=\"book2.htm\">Book 2: Finding the Ark</A></DIV>");
	}
	document.writeln("</TD></TR>");
	//document.writeln("<TR align=left><TD><A class=mainlevel href=\"http://secure.ultracart.com/cgi-bin/UCEditor?MerchantID=2620&amp;OVERRIDECONTINUESHOPPINGURL=http://www.survivingbraincancer.com/closer.htm&amp;OVERRIDECATALOGURL=http://www.survivingbraincancer.com/closer.htm&amp;ADD=2620-1\" target=_blank>Buy The Book</A></TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"buyIndChaps.htm\">Buy Individual Chapters</A>");
	if(buyIndChaps==1)
	{
		document.writeln("<DIV style=\"PADDING-LEFT: 4px\"><A class=sublevel href=\"downloadBook1.htm\">Book 1: Leaving the Garden</A></DIV>");
        document.writeln("<DIV style=\"PADDING-LEFT: 4px\"><A class=sublevel href=\"downloadBook2.htm\">Book 2: Finding the Ark</A></DIV>");
	}
	document.writeln("</TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"prevChaps.htm\">Preview Chapters</A></TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"abtAuthor.htm\">About the Author</A></TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"readerRev.htm\">Readers Reviews</A>");
	if(readerRev==1)
	{
		document.writeln("<DIV style=\"PADDING-LEFT: 4px\"><A class=sublevel href=\"profRev.htm\">Professionals</A></DIV>");
        document.writeln("<DIV style=\"PADDING-LEFT: 4px\"><A class=sublevel href=\"readRev.htm\">Readers</A></DIV>");
	}
	document.writeln("</TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"faq.htm\">FAQs</A>");
	if(faq==1)
	{
		document.writeln("<DIV style=\"PADDING-LEFT: 4px\"><A class=sublevel href=\"faqAbtBook.php\">About the Book</A></DIV>");
        document.writeln("<DIV style=\"PADDING-LEFT: 4px\"><A class=sublevel href=\"faqDr.php\">Q &amp; A with Dr. Zeltzer</A></DIV>");
	}
	document.writeln("</TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"resLink.php\">Resource Links</A></TD></TR>");
	document.writeln("<TR align=left><TD><A class=mainlevel href=\"medCons.htm\">Medical Consultation</A></TD></TR>");
	document.writeln("</TBODY></TABLE>");
	
	// Google AdSense
	
	// End of Google AdSense

     
					  
}
// Trims all spaces to the left of a specific string
function LTrim(str)
{
        var whitespace = new String(" \t\n\r ");
        // last space character is not a space, but alt+0160,
        // another invisible char.
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(0)) != -1) {
            // We have a string with leading blank(s)...
            var j=0, i = s.length;
            // Iterate from the far left of string until we
            // don't have any more whitespace...
            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;
            // Get the substring from the first non-whitespace
            // character to the end of the string...
            s = s.substring(j, i);
        }
        return s;
}
// Trims all spaces to the right of a specific string
function RTrim(str)
{
        // We don't want to trip JUST spaces, but also tabs,
        // line feeds, etc.  Add anything else you want to
        // "trim" here in whitespace
        var whitespace = new String(" \t\n\r ");
        // last space character is not a space, but alt+0160,
        // another invisible char.
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            // We have a string with trailing blank(s)...
            var i = s.length - 1;       // Get length of string
            // Iterate from the far right of string until we
            // don't have any more whitespace...
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;
            // Get the substring from the front of the string to
            // where the last non-whitespace character is...
            s = s.substring(0, i+1);
        }
        return s;
}
                                                                                                                        
// Trims all spaces to the left and right of a specific string by calling RTim
// and LTrim
function Trim(str)
{
        return RTrim(LTrim(str));
}

function googleAds()
{
	document.writeln("<br>");
	document.writeln("<script type=\"text/javascript\">");
	document.writeln("<!--");
	document.writeln("google_ad_client = \"pub-9070225262560284\";");	
	document.writeln("google_ad_width = 710;");	
	document.writeln("google_ad_height = 15;");	
	document.writeln("google_ad_format = \"728x15_0ads_al\";");	
	document.writeln("google_ad_channel = \"\";");	
	document.writeln("google_color_border = \"098ab1\";");	
	document.writeln("google_color_bg = \"098ab1\";");	
	document.writeln("google_color_link = \"ffffff\";");	
	document.writeln("google_color_text = \"ffffff\";");	
	document.writeln("google_color_url = \"ffffff\";");	
	document.writeln("//-->");	
	document.writeln("</script>");	
	document.writeln("<script type=\"text/javascript\"  src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">");	
	document.writeln("</script>");	
	
	
}

function googleTrackCode1()
{
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	
}
function googleTrackCode2()
{
	var pageTracker = _gat._getTracker("UA-2693509-1");
	pageTracker._initData();
	pageTracker._trackPageview();
}
