// JavaScript Document
var subNavShown = 0;
//Quote Rotation
var quote=new Array();
  quote[0]='<span style=\"font-size:12px;\">Grace Based parenting changed my life and my children\'s lives! I think my friends are sick and tired of hearing about it!</span>';
  quote[1]='Grace-Based Parenting has totally changed the way I think about and deal with my children.';
  quote[2]='Thank you for writing such an encouraging book';
  quote[3]='<span style=\"font-size:12px;\">I\'m so impressed with this book that I\'ve started buying it for young mommies and expecting mommies in my church</span>';
  quote[4]='<span style=\"font-size:12px;\">This is probably the very best parenting book (other than the Bible) that I\'ve read - and believe me, I\'ve read them all</span>';
  quote[5]='I was blown away by the truth that now seems so obvious, so basic, and so freeing';
  quote[6]='<span style=\"font-size:12px;\">I can\'t thank you enough for Grace Based Parenting and the tremendous blessing that it has been to me and my family</span>';
  quote[7]='This has become one of my parenting manuals, second only to the Bible!!';
  quote[8]='No book has ever impacted me as much as this one';
  quote[9]='Grace Based Parenting has revolutionized the way that I parent my children';
  quote[10]='This is so rich that I savor every bit.. What a new way to look at parenting... Thank you.';

var speed=7000;    /*this is the time in milliseconds adjust to suit*/
var q=0;

function showQuote() {
	var objQuotes = document.getElementById("quotes");
	if (objQuotes) {
    	objQuotes.innerHTML=quote[q];
     	q++;
		if(q==quote.length) {
			q=0;
	  	}
	}
}

setInterval('showQuote()',speed);

//END QUOTE CODE

function overLink(obj) {
	if (obj.className == "linkBarLink") {
		obj.className = "linkBarLinkOver";
	} else {
		obj.className = "linkBarLink";
	}
}

function getPrice(obj) {
	var objList = document.getElementById('DDListPriceDisp');
	var objFM = document.getElementById('DDFMPriceDisp');
	if (obj.selectedIndex == 1) {
		//Hardback
		objList.innerHTML = "$19.99";
		objFM.innerHTML = "$16.99";
	} else if (obj.selectedIndex == 0) {
		//Paperback
		objList.innerHTML = "$14.99";
		objFM.innerHTML = "$11.99";
	} else {
		//En Espaņol
		objList.innerHTML = "13.99";
		objFM.innerHTML = "$11.19";
	}
}

function getNewPrice(obj) {
	var objList = document.getElementById('DDListPriceDisp');
	var objFM = document.getElementById('DDFMPriceDisp');
	var objLink = document.getElementById('bookLink');
	if (obj.selectedIndex == 0) {
		//Paperback
		objList.innerHTML = "$14.99";
		objFM.innerHTML = "$11.19";
		objLink.href = "http://shop.familymatters.net/quick_return.php?return_type=basket&return_id=6&id=4&qty=1"
	} else {
		//En Espaņol
		objList.innerHTML = "14.99";
		objFM.innerHTML = "$11.99";
		objLink.href = "http://shop.familymatters.net/quick_return.php?return_type=basket&return_id=6&id=26&qty=1"
	}
}

function breadcrumbs(pageName){
  sURL = new String;
  bits = new Object;
  var x = 0;
  var stop = 0;
  var output = "<a style=\"color:#fff;text-decoration:none;font-weight:bold;\" href=\"http://www.familymatters.net\">FamilyMatters.net</a>";
  sURL = location.href;
  sURL = sURL.slice(8,sURL.length);
  chunkStart = sURL.indexOf("/");
  sURL = sURL.slice(chunkStart+1,sURL.length)
  while(!stop){
    chunkStart = sURL.indexOf("/");
    if (chunkStart != -1){
      bits[x] = sURL.slice(0,chunkStart)
      sURL = sURL.slice(chunkStart+1,sURL.length);
    }else{
      stop = 1;
    }
    x++;
  }
  var sPath = window.location.pathname;
  var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
  var isIndex = false;
  if (sPage == "" || sPage == "index.asp") {
	  isIndex = true;
  }
  var bitCount = 0;
  for(var z in bits) {
	  bitCount++;
  }
  var tempbit = "";
  for(var i in bits){
	  if (i == bitCount-1 && isIndex) {
		tempbit = bits[i].replace(/_/g, " ");
		tempbit = tempbit.replace(/%20/g, " ");
		tempbit = tempbit.replace(/%2D/g, "-");
		tempbit = tempbit.replace(/%5F/g, " ");
		output += "&nbsp;>&nbsp;<strong>" + tempbit + "</strong>";
	  } else {
		output += "&nbsp;>&nbsp;<a style=\"color:#fff;font-weight:bold;text-decoration:none;\" href=\"";
		for(y=1;y<x-i;y++){
		  output += "../";
		}
		tempbit = bits[i].replace(/_/g, " ");
		tempbit = tempbit.replace(/%20/g, " ");
		tempbit = tempbit.replace(/%2D/g, "-");
		tempbit = tempbit.replace(/%5F/g, " ");
		output += bits[i] + "/\">" + tempbit + "</a>";
	  }
	
//	tempbit = bits[i].replace(/_/g, " ");
//	tempbit = tempbit.replace(/%20/g, " ");
//	tempbit = tempbit.replace(/%2D/g, " ");
//	tempbit = tempbit.replace(/%5F/g, "-");
//  output += bits[i] + "/\">" + tempbit + "</a>";
  }
  if (!isIndex) {
	  if (pageName == undefined) {
		pageName = "&nbsp;&gt;&nbsp;<strong>" + document.title + "</strong>";
	  } else {
		pageName = "&nbsp;&gt;&nbsp;<strong>" + pageName + "</strong>";  
	  }
	  output += pageName;
  }
  document.write(output);
}

function gotoLink(page) {
	window.location = page + ".asp";
}


function submitToShoppingCart(id,feature) {
	document.getElementById('feature').value = feature;
	document.getElementById('product').value = id;
	document.getElementById('BG_submit').submit();
}

function getDDValue(obj) {
	var objDD = document.getElementById(obj);
	return objDD.options[objDD.options.selectedIndex].value;
}