// JavaScript Document




function rollOver(str){
	
	var source = document.getElementById(str).src
	if(source.indexOf("over") != -1){
	document.getElementById(str).onmouseout = ""
	}else{
	document.getElementById(str).src = "/images/"+ str +"_over.gif"
	}
	//clickFunc(str);
		
}

function rollOut(str){
	
	document.getElementById(str).src = "/images/"+ str +".gif"
	
	//clickFunc("book")
}

function showBio(){
	document.getElementById("inner_content").innerHTML= '<div id="auth_back"><a href="http://catchadream.org" target="_blank"><img src="images/author_text.gif" alt="contact agent" title="contact agent" onMouseOut="hideBio()"></div>' 	
}

function hideBio(){
	document.getElementById("inner_content").innerHTML = '<img src="images/author_pic.jpg" id="bio" alt="Bobby Cole" title="Bobby Cole" onMouseOver="showBio()">'
}

function hideBuyOne(){
	document.getElementById("inner_content").innerHTML = "<img src='images/book_cover.jpg' id='cover' alt='The Dummy Line' title='The Dummy Line' onmouseover='clickFunc(this.id)'>" 	
}

var xmlHttp

function checkAjax(){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 	
}

function clickFunc(str)
{ 

checkAjax()

var url="content.asp";
url=url+"?pid="+str;
xmlHttp.onreadystatechange= function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 



if(str == "reviews"){
	document.getElementById("nav").innerHTML = '<img src="images/author.gif"  alt="author" title="author" id="author" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/book.gif" alt="buy one" title="buy one" id="book" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/reviews_over.gif" alt="reviews"title="reviews" id="reviews"><img src="images/contactus.gif" alt="contact us"title="contact us" id="contactus" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)">'	
}else if(str == "author"){
	document.getElementById("nav").innerHTML = '<img src="images/author_over.gif"  alt="author" title="author" id="author"><img src="images/book.gif" alt="buy one" title="buy one" id="book" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/reviews.gif" alt="reviews"title="reviews" id="reviews" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/contactus.gif" alt="contact us"title="contact us" id="contactus" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)">'
}else if (str == "book"){
	document.getElementById("nav").innerHTML = '<img src="images/author.gif"  alt="author" title="author" id="author" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/book_over.gif" alt="buy one" title="buy one" id="book"><img src="images/reviews.gif" alt="reviews"title="reviews" id="reviews" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/contactus.gif" alt="contact us"title="contact us" id="contactus" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)">'	
}else if (str == "contactus"){
	document.getElementById("nav").innerHTML = '<img src="images/author.gif"  alt="author" title="author" id="author" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/book.gif" alt="buy one" title="buy one" id="book" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/reviews.gif" alt="reviews"title="reviews" id="reviews" onMouseOver="rollOver(this.id)" onMouseOut="rollOut(this.id)" onClick="clickFunc(this.id)"><img src="images/contactus_over.gif" alt="contact us"title="contact us" id="contactus">'	
}

if(str == "author"){
	document.getElementById("extra").innerHTML = '<a href="http://www.plantbiologic.com/Scripts/prodView.asp?idproduct=59&ampsection=store" target="_blank"><img src="images/preorder.gif"></a>'
}else{
	document.getElementById("extra").innerHTML = '<a href="http://www.plantbiologic.com/Scripts/prodView.asp?idproduct=59&ampsection=store" target="_blank"><img src="images/preorder.gif"></a>'
}

document.getElementById("inner_content").innerHTML=xmlHttp.responseText;

if(str == "reviews"){
	reviews(0)
}


}
};
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}



function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}	



function reviews(){

i = 0

document.getElementById("review_holder").innerHTML = "<img src='images/review_a.gif'>"

}


function reviewnext(){

var theReviews = new Array()
theReviews[0] = "<img src='images/review_a.gif'>"
theReviews[1] = "<img src='images/review_b.gif'>"
theReviews[2] = "<img src='images/review_0.gif'>"
theReviews[3] = "<img src='images/review_1.gif'>"
theReviews[4] = "<img src='images/review_2.gif'>"
theReviews[5] = "<img src='images/review_3.gif'>"
theReviews[6] = "<img src='images/review_4.gif'>"
theReviews[7] = "<img src='images/review_5.gif'>"
theReviews[8] = "<img src='images/review_6.gif'>"
theReviews[9] = "<img src='images/review_7.gif'>"
theReviews[10] = "<img src='images/review_8.gif'>"

if(i != 10){
i++
}

document.getElementById("review_holder").innerHTML = theReviews[i]


}



function reviewprev(){

var theReviews = new Array()
theReviews[0] = "<img src='images/review_a.gif'>"
theReviews[1] = "<img src='images/review_b.gif'>"
theReviews[2] = "<img src='images/review_0.gif'>"
theReviews[3] = "<img src='images/review_1.gif'>"
theReviews[4] = "<img src='images/review_2.gif'>"
theReviews[5] = "<img src='images/review_3.gif'>"
theReviews[6] = "<img src='images/review_4.gif'>"
theReviews[7] = "<img src='images/review_5.gif'>"
theReviews[8] = "<img src='images/review_6.gif'>"
theReviews[9] = "<img src='images/review_7.gif'>"
theReviews[10] = "<img src='images/review_8.gif'>"

if(i != 0){
i--
}

document.getElementById("review_holder").innerHTML = theReviews[i]


}