var fl8 = document.getElementsByTagName("title")[0].text;
fl8 = fl8.replace(/Bach Flower /g,"");
var fls = new Array("","Mustard","Chicory","Impatiens","Agrimony","Mimulus","Pine","Chestnut Bud","Larch","Olive","ELM","Gentian","Aspen","Honeysuckle",
"Crab Apple","Hornbeam","Cherry Plum","Beech","Gorse","Holly","White Chestnut","Rock Rose","Clematis","Red Chestnut","Sweet Chestnut","Centaury","Oak",
"Heather","Rock Water","Wild Oat","Cerato","Water Violet","Vervain","Willow","Scleranthus","Vine","Wild Rose","Star of Bethlehem","Walnut");
var flsn9 = new Array(0,180,167,177,160,179,183,166,178,182,170,171,161,175,169,176,165,162,172,174,194,185,168,184,189,163,181,173,186,195,164,193,190,197,187,191,196,188,192);
var vg8 = "";
var ms4 = "<br/><font color='#FF0000' style='font-size:9pt;line-height:100%;'><u>PLEASE NOTE:</u> Usually, it is optimal that your personal Bach formula not contain more than four Bach flower essences. The fewer the number of essences";
ms4 = ms4 + ", the more effective the formula. We recommend that customers who need more than four Bach flower essences rank the urgency of the problem for which each essence";
ms4 = ms4 + " has been specified, and then proceed to take the essence for the most urgent problem. In many cases, after taking one essence, the overall situation changes, and there may be no need for the others.";
var tCook9 = "";
expD8 = new Date;
expD8.setTime(expD8.getTime()+(60*1000*360));
var tCook8 = "";
rbf();

function rbf(){
tCook8 = document.cookie.split("flc=");
tCook9 = "";
var vps = "";
//var vpe = "<div style='padding:2px;'><form action='search.htm' id='cse-search-box'><input type='hidden' name='cx' value='000987136360238816025:gkc4whxibzm' />";
var vpe = "<div style='padding:2px;'><a href='http://feelbach.com/scripts/prodView.asp?idproduct=~prd&refID=glff' onClick='javascript:_gaq.push([\"_trackPageview\", \"/act/product\"]);'> » 20ml Bottle - $6.95 Only!! </a><br/><form action='search.htm' id='cse-search-box'><input type='hidden' name='cx' value='000987136360238816025:gkc4whxibzm' />";
vpe = vpe + "<input type='hidden' name='cof' value='FORID:9' /><input type='hidden' name='ie' value='UTF-8' />";
vpe = vpe + "<input type='text' name='q' size='18' /><input type='submit' name='sa' value='Search »' />";
vpe = vpe + "<br/><font style='font-size:9pt;'>* Search by symptom/character/personality</font></form></div>";
vpe = vpe + "~f<br/>~m<br/>";
var vpk = "<font color='#000080' style='font-size:9pt;'>* You may have 1-6 essences in one formula.</font>~ms4<br/>";
vpk = vpk + "<form name='QT' method='post' action='http://feelbach.com/checkout.asp?r=rf10'>";
vpk = vpk + "<input name='QT3' type='hidden' id='QT3' />";
vpk = vpk + "<input name='savename' type='hidden' id='savename' />";
vpk = vpk + "<input name='QTID3' type='hidden' id='QTID3' value='PrevalentEN'/>";
vpk = vpk + "<input type='button' value='Save/order your Bach formula »' onclick='javascript:ordr8()' /></form>";
if ((tCook8[1]!=null) && (tCook8[1]!="undefined") && (tCook8[1]!="") && (tCook8[1]!="NaN")){
tCook9 = tCook8[1].split(";")[0].split(",");
}

var g3 = 0;
for (var e = 1; e <= 38; e++){
if (fls[e]==fl8){g3=e;}
}
var g2 = "<br/><a href='javascript:void(0);' onclick='javascript:addFlower(" + g3 + ")' id='nun2' title='Add " + fl8 + " to my formula'>[+]</a> Add " + fl8 + "<br/>to my Bach formula";
for (var z = 0; z <= tCook9.length; z++){
if ((tCook9[z]!=null) && (tCook9[z]!="undefined") && (tCook9[z]!="") && (tCook9[z]!="NaN")){
var i = parseInt(tCook9[z])
if (fls[i] == fl8){
g2 = "";
}
vps = vps + "<a href='javascript:void(0);' onclick='javascript:delFlower(" + i + ");' id='nun2' title='Subtract " + fls[i] + " from my formula'>[-]</a> " + fls[i] + "<br/>";
}
}
if(isNaN(tCook9[0])==true){
vpk="";
}
else{
vpe = vpe.replace(/~m/g,"<b><u>My Bach Formula:</u></b>");
}
vpe = vpe.replace(/~f/g,g2);
vpe = vpe.replace(/~m/g,"");
vpe = vpe.replace(/~prd/g,flsn9[g3]);
if(z>=5){
vpk = vpk.replace(/~ms4/g,ms4);
}
vpk = vpk.replace(/~ms4/g,"");
document.getElementById("fbfr").innerHTML = vpe + vps + vpk;
}

function addFlower(mfl){
tCook8 = document.cookie.split("flc=");
tCook9 = "";
var rg5 = 4;
if ((tCook8[1]!=null) && (tCook8[1]!="undefined") && (tCook8[1]!="") && (tCook8[1]!="NaN")){
tCook9 = tCook8[1].split(";")[0].split(",");
}
for (var p = 0; p <= tCook9.length; p++){
if (isNaN(tCook9[p])==true){rg5=rg5+1; }
}
if (tCook9.length<=rg5){
if (tCook9 == ""){
vg8 = mfl;
}
else{
vg8 = mfl + "," + tCook8[1].split(";")[0];
}
document.cookie = "flc="+chk6(vg8)+";expires=" + expD8.toGMTString();
rbf();
}
else{
alert("You may have one to six Bach flower essences in your formula");
}
}

function delFlower(mfl){
tCook8 = document.cookie.split("flc=");
tCook9 = "";
var rg7 = "";
if (tCook8[1].split(";")[0]!=null){tCook9 = tCook8[1].split(";")[0].split(",");}
if (tCook9.length>=1){

for (var p = 0; p <= tCook9.length; p++){
if (tCook9[p]!=mfl){
if (rg7==""){
rg7 = parseInt(tCook9[p]);
}
else{
rg7 = rg7 + "," + parseInt(tCook9[p]);
}
}
}
rg7 = rg7.toString();
vg8 = rg7;
document.cookie = "flc="+chk6(rg7)+";expires=" + expD8.toGMTString();
rbf();
}
}
function ordr8() {
_gaq.push(['_trackPageview', '/act/rf10']);
var rg5 = "";
tCook8 = document.cookie.split("flc=");
tCook9 = tCook8[1].split(";")[0].split(",");
for (var p = 0; p <= tCook9.length; p++){
if (isNaN(tCook9[p])==false){
if (rg5==""){
rg5 = tCook9[p];
}
else {
rg5 = rg5 + "," + tCook9[p];
}
}
}
vg8 = rg5;
var rnz = (Math.floor(Math.random()*99998))+1;
document.QT.QT3.value = rg5;
document.QT.savename.value = "MyFormula"+rnz;
document.QT.submit();
}
function chk6(gkk){
var gkz = "";
gkk = gkk.toString();
var zk = gkk.split(",");
if (zk.length>0){
for (var b = 0; b <= zk.length; b++){
if (isNaN(zk[b])==false){
if (gkz==""){
gkz = zk[b];
}
else {
gkz = gkz + "," + zk[b];
}
}
}
}
return gkz;
}
  var _gaq = _gaq || []; 
  _gaq.push(['_setAccount', 'UA-283322-6']); 
  _gaq.push(['_trackPageview']); 
 
  (function() { 
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); 
  })();
