<!--//
// Opacity and Fade in script.
// Script copyright (C) 2008 http://www.cryer.co.uk/.
// Script is free to use provided this copyright header is included.
function SetOpacity(object,opacityPct)
{
 try {
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
 } catch(err) {}
}

function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
 try { 
  var element=document.getElementById(id);
  var opacity = element.style.opacity * 100;
  var msNow = (new Date()).getTime();
  opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity<0) 
   SetOpacity(element,0)
  else if (opacity>100)
   SetOpacity(element,100)
  else
  {
   SetOpacity(element,opacity);
   element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
  }
 } catch(err) {}
}

function FadeIn(id)
{
 try {
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",0,100)",1);
 } catch(err) {}
}

function FadeOut(id)
{
 try {
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",100,0)",1);
 } catch(err) {}
}

function FadeInImage(foregroundID,newImage,backgroundID)
{
 try {
  var foreground=document.getElementById(foregroundID);
  if (backgroundID)
  {
   var background=document.getElementById(backgroundID);
   if (background)
   {
    background.style.backgroundImage = 'url(' + foreground.src + ')';
    background.style.backgroundRepeat = 'no-repeat';
   }
  }
  SetOpacity(foreground,0);
  foreground.src = newImage;
  if (foreground.timer) window.clearTimeout(foreground.timer); 
  var startMS = (new Date()).getTime();
  foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "',1000," + startMS + ",0,100)",10);
 } catch(err) {}
}

var changetext;
var changelink;
var changenewstext;
var changenewslink;
var c=0;
var t=0;
var tn=0;
var n=0;
var fadenum=0;
var imgnum=0;
var changenum=0;
var newsnum=0;
var timer_is_on=0;
var news_is_on=0;
var theswitch=0;
var initswitch=0;

function startTimer()
{
 try {
  t=setTimeout("timedCount()",5000);
 } catch(err) {}
}

function imgTimer(imgnum)
{
 try {
  if (imgnum>28) c=0;
  else c=imgnum+1;
  theswitch=1;
  t=setTimeout("timedCount()",5000);
 } catch(err) {}
}

function switchIt()
{
 try {
  if (theswitch==0) {
   c++;
   if (c==30) c=0;
   theswitch=1;
  }
 } catch(err) {}
}

function switchIt2()
{
 try {
  if (theswitch==0) {
   c++;
   if (c==30) c=0;
   theswitch=0;
  }
 } catch(err) {}
}

function imgFadePrev()
{
 try {
  if (theswitch==1||initswitch==0) {
   c--;
   theswitch=0;
   initswitch=1;
  }
  if (c<1) c=29;
  else c--;
  changeIt(c);
  FadeInImage('mainpic','images/img'+c+'.jpg','mainpicimage');
 } catch(err) {}
} 

function imgFadeNext()
{
 try {
  if (theswitch==0) {
   c++;
   theswitch=1;
  }
  if (initswitch==0) {
   c=1;
   initswitch=1;
  }
  if (c==29) {
   changeIt(c);
   FadeInImage('mainpic','images/img'+c+'.jpg','mainpicimage');
   c=0;
  }
  else if (c<29) {
   changeIt(c);
   FadeInImage('mainpic','images/img'+c+'.jpg','mainpicimage');
   c=c+1;
  }
 } catch(err) {}
} 

function imgFade(fadenum)
{
 try {
  stopCount();
  theswitch=0;
  changeIt(fadenum);
  FadeInImage('mainpic','images/img'+fadenum+'.jpg','mainpicimage');
 } catch(err) {}
} 
  
function timedCount()
{
 try {
  if (c<29) {
   changeIt(c);
   FadeInImage('mainpic','images/img'+c+'.jpg','mainpicimage');
   c=c+1;
   t=setTimeout("timedCount()",5000);
  }
  else if (c>28) {
   changeIt(c);
   FadeInImage('mainpic','images/img'+c+'.jpg','mainpicimage');
   c=0;
   t=setTimeout("timedCount()",5000);
  }
  else {
   stopCount();
  } 
 } catch(err) {}
}

function timedNews()
{
 try {
  if (n<18) {
   changeNews(n);
   n=n+1;
   tn=setTimeout("timedNews()",10000);
  }
  else if (n>17) {
   changeNews(n);
   n=0;
   tn=setTimeout("timedNews()",10000);
  }
  else {
   stopNews();
  } 
 } catch(err) {}
}

function stopNews()
{
 try {
  clearTimeout(tn);
  news_is_on=0;
 } catch(err) {}
}

function stopCount()
{
 try {
  clearTimeout(t);
  timer_is_on=0;
 } catch(err) {}
}

function doTimer()
{
 try {
  if (!timer_is_on)
  {
   timer_is_on=1;
   timedCount();
  }     
 } catch(err) {}
}

function doNews()
{
 try {
  if (!news_is_on)
  {
   news_is_on=1;
   timedNews();
  }     
 } catch(err) {}
}

function changeNews(newsnum) 
{
 try {  
  if (newsnum==0) {
   changenewstext = "<h2>envinews</h2>CONGRATS to all the envibaby photo submissions, you are ALL winners and will be receiving a free envibum bumbag!!!"
   changenewslink = "reviews.html";
  }
  else if (newsnum==1) {
   changenewstext = "<h2>envinews</h2>NEW edition color envi<span class=goyellow>yellow</span> diaper supporting Helping Hands in Africa giving $2 for every one purchased!"
   changenewslink = "products.html#enviyellow";
  }
  else if (newsnum==2) {
   changenewstext = "<h2>envinews</h2>We have just reduced our diaper prices! envibums now include a new thin, quick dry cotton absorbency - its like getting a free pad!"
   changenewslink = "products.html";
  } 
  else if (newsnum==3) {
   changenewstext = "<h2>envinews</h2>Our new reviews page is now up! Send us a comment or review along with a picture of your little envibaby and we will be sure to add it!"
   changenewslink = "reviews.html";
  } 
  else if (newsnum==4) {
   changenewstext = "<h2>envinews</h2>The mom4mom <span class=gopink>pink</span> diaper cover is now available! We are offering a pink version of our mom4mom cover from all your requests."
   changenewslink = "products.html#mom4mompink";
  } 
  else if (newsnum==5) {
   changenewstext = "<h2>envinews</h2>Our newest organizations we are supporting and new diaper colors are now available! envi<span class=goaqua>aqua</span> and envi<span class=gopink>pink</span>."
   changenewslink = "products.html";
  } 
  else if (newsnum==6) {
   changenewstext = "<h2>envinews</h2>envibum was reviewed on The Cloth Diaper Report. Click here to read the review on the envibum diaper and mom4mom cover."
   changenewslink = "http://www.theclothdiaperreport.com/2010/03/envibum-one-size-diaper-cover-review.html";
  }
  else if (newsnum==7) {
   changenewstext = "<h2>envinews</h2>envibum was reviewed on All About Cloth Diapers. Click here to read the review on the envibum diaper and mom4mom cover."
   changenewslink = "http://allaboutclothdiapers.com/a-review-of-envibum-cloth-diapers/";
  } 
  else if (newsnum==8) {
   changenewstext = "<h2>envinews</h2>envibum was reviewed on Passionate Homemaking. Click here to read the review on the envibum diaper and mom4mom cover."
   changenewslink = "http://www.passionatehomemaking.com/2010/02/envibum-a-creative-cloth-diaper-solution.html";
  } 
  else if (newsnum==9) {
   changenewstext = "<h2>envinews</h2>Check out our new blog <span class=undie>www.envibaby.com</span>!<br>The place for great tips, latest envibum diaper info, and contest information."
   changenewslink = "http://www.envibaby.com";
  } 
  else if (newsnum==10) {
   changenewstext = "<h2>envinews</h2>NEW edition color envi<span class=gopink>pink</span> diaper supporting crisis pregnancy center giving $2 for every one purchased!"
   changenewslink = "products.html#envipink";
  }
  else if (newsnum==11) {
   changenewstext = "<h2>envinews</h2>NEW edition color envi<span class=goaqua>aqua</span> diaper supporting clean drinking water giving $2 for every one purchased!"
   changenewslink = "products.html#envired";
  } 
  else if (newsnum==12) {
   changenewstext = "<h2>envinews</h2>envibum's new patent pending closable compartment allows access to adjust the absorbency for the phase, not the day!"
   changenewslink = "products.html#envigtrrn";
  }
  else if (newsnum==13) {
   changenewstext = "<h2>envinews</h2>Compliant with the Consumer Product Safety Act (CPSA) - no lead or choking hazards (snaps) to worry about in our products."
   changenewslink = "products.html";
  }  
  else if (newsnum==14) {
   changenewstext = "<h2>envinews</h2>For every envi<span class=gogreen>green</span> cloth diaper purchased, two dollars is donated to Food For The Hungry. Buy a diaper - help others grow!"
   changenewslink = "products.html#envigreen";
  } 
  else if (newsnum==15) {
   changenewstext = "<h2>envinews</h2>For every mom4mom diaper cover purchased, another mom4mom cover is donated to a mom and baby that are in need."
   changenewslink = "products.html#mom4mom";
  } 
  else if (newsnum==16) {
   changenewstext = "<h2>envinews</h2>envibum - a new and better kind of diaper!<br><br>re-envisioned.<br>re-designed.<br>re-engineered."
   changenewslink = "products.html#envigreen";
  } 
  else if (newsnum==17) {
   changenewstext = "<h2>envinews</h2>Tired of stink, stain, or falling apart with other diapers?  envibum is the right place for premium lasting fabrics and fabrication."
   changenewslink = "products.html";
  }    
  document.getElementById('newstext').innerHTML=changenewstext;
  document.getElementById('newstext').href=changenewslink;
  if (newsnum==6 || newsnum==7 || newsnum==8 || newsnum==9) {
   document.getElementById('newstext').target="_blank";
  }
  else {
   document.getElementById('newstext').target="_self";
  }
 } catch(err) {}
}

function changeIt(changenum)
{
 try {
  if (changenum==0) {
   changetext = "be <span class=gogreen>green</span> with envi! choose envibum";
   changelink = "products.html#envigreen";
  }
  else if (changenum==1) {
   changetext = "soft Minkee keeps baby dry & protected";
   changelink = "products.html";
  }    
  else if (changenum==2) {
   changetext = "five great colors to choose from";
   changelink = "products.html";
  }
  else if (changenum==3) {
   changetext = "auto adjusting waist and legs fit newborns and up";
   changelink = "products.html";
  }
  else if (changenum==4) {
   changetext = "helping others see the world through color";
   changelink = "products.html";
  }
  else if (changenum==5) {
   changetext = "mom4mom covers fit newborns and as baby grows";
   changelink = "products.html#mom4mom";
  }  
  else if (changenum==6) {
   changetext = "envi<span class=gogreen>green</span> premium affordable cloth diaper";
   changelink = "products.html#envigreen";
  }  
  else if (changenum==7) {
   changetext = "envi<span class=goaqua>aqua</span> premium affordable cloth diaper";
   changelink = "products.html#enviaqua";
  }    
  else if (changenum==8) {
   changetext = "envi<span class=goyellow>yellow</span> premium affordable cloth diaper";
   changelink = "products.html#enviyellow";
  }
  else if (changenum==9) {
   changetext = "envi<span class=gored>red</span> premium affordable cloth diaper";
   changelink = "products.html#envired";
  }  
  else if (changenum==10) {
   changetext = "envi<span class=gopink>pink</span> premium affordable cloth diaper";
   changelink = "products.html#envipink";
  }   
  else if (changenum==11) {
   changetext = "envibum <span class=gogreen>green</span> and <span class=gopink>pink</span> mom4mom cover";
   changelink = "products.html#mom4mom";
  } 
  else if (changenum==12) {
   changetext = "make your baby the envi of the playgroup";
   changelink = "products.html#envigreen";
  }
  else if (changenum==13) {
   changetext = "envibum diapers grow to fit most babies 8 - 40 lbs.";
   changelink = "products.html#envigreen";
  }
  else if (changenum==14) {
   changetext = "leaf applique doubles as newborn size adjuster";
   changelink = "products.html#envigreen";
  }
  else if (changenum==15) {
   changetext = "our streamline fit allows for lots of play";
   changelink = "products.html#envigreen";
  }
  else if (changenum==16) {
   changetext = "closable compartment for customized absorbency";
   changelink = "products.html#envigreen";
  }
  else if (changenum==17) {
   changetext = "super soft natural gussets that holds the yuckies in";
   changelink = "products.html#envigreen";
  }
  else if (changenum==18) {
   changetext = "soft elastic back ensures comfy custom fit everytime";
   changelink = "products.html#envigreen";
  }
  else if (changenum==19) {
   changetext = "gender neutral envileaf <span class=gogreen>green</span> color";
   changelink = "products.html";
  }
  else if (changenum==20) {
   changetext = "two great ways to diaper your babies";
   changelink = "products.html";
  }
  else if (changenum==21) {
   changetext = "mom4mom covers grow to fit most babies 8 - 40 lbs.";
   changelink = "products.html#mom4mom";
  }
  else if (changenum==22) {
   changetext = "seamless design for a truely reusable cover";
   changelink = "products.html#mom4mom";
  }
  else if (changenum==23) {
   changetext = "customizable t-shape liner absorbs without the bulk";
   changelink = "products.html#liners";
  }
  else if (changenum==24) {
   changetext = "our diaper covers work with almost any absorbency";
   changelink = "products.html#mom4mom";
  }
  else if (changenum==25) {
   changetext = "absorbency pads with stay put fixtures";
   changelink = "products.html#pads";
  }
  else if (changenum==26) {
   changetext = "envibum gift pack";
   changelink = "products.html#envibumgift";
  }
  else if (changenum==27) {
   changetext = "designer waterproof bumbags with easy closure";
   changelink = "products.html#bumbags";
  }
  else if (changenum==28) {
   changetext = "envibum diaper overview";
   changelink = "products.html";
  }
  else if (changenum==29) {
   changetext = "super soft Minkee fabric that you & your baby will love!";
   changelink = "products.html";
  } 
  document.getElementById('prodtext').innerHTML=changetext;
  document.getElementById('prodtext').href=changelink;
  document.getElementById('prodtext').target="_self";
 } catch(err) {}
}

if (navigator.appVersion.indexOf("MSIE")!=-1) 
{
 var bName = 'MSIE';
 var temp = navigator.appVersion.split("MSIE");
 var bVer = parseFloat(temp[1]);
} else {
 var bName = navigator.appName;
 var bVer = parseFloat(navigator.appVersion);
}
//-->