$(document).ready(function(){
						  				   
	//replaceText(selector, weight override, link colour, link hover colour, link decoration, link hover decoration, lineheight, font file)
	replaceText('h1', 'normal', '', '#000000', 'none', 'underline', '-9', 'avantGardeBold.swf');
	replaceText('h2', 'normal', '', '#000000', 'none', 'underline', '-6', 'avantGardeBold.swf');
	replaceText('h3', '', '', '#000000', 'none', 'underline', '0', 'avantGarde.swf');
	replaceText('h4', '', '', '#000000', 'none', 'underline', '2', 'avantGarde.swf');
	
	$('.middleCallout').each(function(e){
		if(e % 3 == 0){
			$(this).css('clear','both');
		}
	});
	
	$('#leftNav').each(function(){
		if(parseInt($(this).children().size()) <= 0){
			$(this).remove();
		}
	});
		$('.feature').each(function(e){
		if(e % 2 == 0){
			$(this).css('clear','both');
		}
	});
	swfobject.embedSWF("/static/flash/pharmacy_countdown.swf", "countdown", "180", "140", "8.0.0", "/static/flash/expressInstall.swf", "false", {wmode:"transparent"});
});
function navSpace(myWidth, mySpace, mySelector) {
      tabTotal = 0;
      var totalWidth = myWidth;
      var remainingWidth = myWidth;
      $(mySelector).not(mySelector + ' li').each(function(e) {
            totalWidth -= $(this).width();
            tabTotal++;
      });
      var newWidth = Math.floor((totalWidth / tabTotal) - mySpace);
      $(mySelector).not(mySelector + ' li').each(function(e) {
            $(this).width($(this).width() + newWidth);
            remainingWidth -= ($(this).width() + mySpace);
            if (e == (tabTotal - 1)) {
                  $(this).width($(this).width() + remainingWidth);
            }
      });
	  //$('#mainnav a:last').css('border-right','none');
}
function FG_fixfloats(selector){
  lastParent = 0;
  galleryitems = $(selector);
  galleryitems.each(function(i){
    if(this.parentNode != lastParent){
      lastTop = 0;
      rowHeight = 0;
      rowStart = i;
      lastParent = this.parentNode;
    }
    this.style.height = "auto";
    this.style.clear="none";
    if(this.offsetTop != lastTop){
      this.style.clear="left";
      rowHeight = this.offsetTop - lastTop - (this.style.marginTop + this.style.marginBottom);
      for(j=rowStart;j<i;j++) {
        galleryitems.get(j).style.height = rowHeight+"px";
      }
      lastTop = this.offsetTop;
      rowStart = i;
    } 
  });
}


$(document).ready(function(){
	navSpace(960, 0, '#topNav li');
	FG_fixfloats('.middleCallout');
});


