function searchValidate(event,location)
{
	if (event == "onclick" || eventIsEnterKey(event)) {
	if (location == "header"){
	if(document.bb_topform.query.value!="") {submitHeaderSearch('onclick');}
	}else {
	if(document.bb_botform.query.value!="") { submitFooterSearch('onclick');}
	}
	}else {return true;}
	return false;
}

function tabSelect(sId, dsId, showTab, hideTab)
{
document.getElementById(sId).className = 'select'; 
document.getElementById(dsId).className = ' '; 
document.getElementById(showTab).className= ' details';
document.getElementById(hideTab).className= 'hideUL'; return false;} 



if( typeof com === "undefined" ) { var com = {}; }
if( typeof com.aol === "undefined" ) { com.aol = {}; }
if( typeof com.aol.bv === "undefined" ) { com.aol.bv = {}; }


com.aol.bv.shareLink = new Class({
    Implements: [Options, Events],
  
        options : {
	ShareHeight : '556',
        ShareWidth : '430'
        
                                        
	},
     initialize : function (options)
	{
          this.setOptions(options);
          this.setInitialClasses();
                          		
	},
     setInitialClasses : function()
        { 
        $$('ul.postmetaLine li.shareLink a').each( function(item){$(item).addEvent('click', this.ShareLink.bind(this, item));}, this); 
        },
        ShareLink : function(item)
        {
        
          var sUL = item.getParent('ul').getNext();
          var sLI = item.getParent('li');
          if(sLI.hasClass('shareLink')) 
          {
           //sUL.setStyle('display','block');
           sUL.setStyle('height', 0).setStyle('overflow','hidden').setStyle('display', 'block').setStyle('position', 'absolute').morph({'height':[0,this.options.ShareHeight]});
           //sUL.setStyle('display', 'block').morph({'height':[0,20]});
           sLI.toggleClass('shareLink','UnshareLink');
           item.set('html',' ');
          } else {
           sUL.setStyle('overflow','hidden').morph({'height':[this.options.ShareHeight,0]});
          //sUL.morph({'height':['100%','0']});
           sLI.toggleClass('shareLink','UnshareLink');
          item.set('html',' ');           
          }
          
        }
      
   });



function CreateBookmarkLink(url, title) {


	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { 
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { 
		return true; }
 }



function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
  var arr = new Array();
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
  var arrClass = strClass.split(delim);
  for (var i = 0, j = objColl.length; i < j; i++) {
    var arrObjClass = objColl[i].className.split(' ');
    if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k]) c++;
        if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr[arr.length] = objColl[i];
          //arr.push(objColl[i]);
          break comparisonLoop;
        }
      }
    }
  }
  return arr;
}

//<![CDATA[
/*
	name : HorizontalTweenSlider
	author : gregory tomlinson
	© 2008 AOL LLC
    modified by Melwyn Furtado
	Date: 15 December 2008
	////////////////////////////////
	////////////////////////////////	
	dependencies : mootools 1.2
	////////////////////////////////
	////////////////////////////////		
*/
var HorizontalTweenSlider = new Class({
	
	Implements: [Options, Events],
	
	slides : [],
	currIndex : 0,
	autoPlayId : null,	
	slideObj : null,
	slideWidth : 0,
	sOffSet : 0,
	currPos : 0,
	carouselWidth : 0,
	
	options : {
		slides : [],
		wrapperElement : null, 
		innerElement : null,
		prevBttn : null,
		nextBttn : null,
		duration : 1500,
		timerLength : 8000,		
		slideTransition : Fx.Transitions.Quart.easeInOut,
		autoPlay : true,
		shownSlideCount : 3,
		adjustDirection : 'left',
		shuffle : false
	},

	initialize : function (options)
	{
		this.setOptions(options);
		
		if( this.options.prevBttn ) this.addPrevBttn( this.options.prevBttn );
		if( this.options.nextBttn ) this.addNextBttn( this.options.nextBttn );	

		if( this.options.slides.length > this.options.shownSlideCount ) {
			if( this.options.shuffle ) this.shuffleSlides( this.options.slides );
			this.addSlides( this.options.slides );
			this.setSlideWidth();
			this.setOffSet();
		}
		this.carouselIllusion(); 
		this.createTransition();		
		this.startAutoPlay(); // start if true
	},
	
	carouselIllusion : function()
	{
		if( this.slides.length > this.options.shownSlideCount )
		{
			// make extras to create illusion of carousel
			this.addSet(this.options.innerElement);
			this.addSet(this.options.innerElement);	
			this.resetSlider();					
		}
		else
		{
			this.options.prevBttn.setStyle('display', 'none');
			this.options.nextBttn.setStyle('display', 'none');
		}
	},
	
	addSet : function( iElm )
	{
		this.slides.each( function( el ) {
			var c = el.clone().inject( iElm );
		});		
	},

	resetSlider : function()
	{
		// this centers the slides in the viewport
		this.currPos = -(this.slides.length * this.slideWidth) + this.sOffSet - 18;
		this.currIndex = 0;
		this.options.innerElement.setStyle( 'left', this.currPos);
		this.carouselWidth = ((this.slideWidth*this.options.shownSlideCount) * (this.slides.length+2)) + (-this.currPos);
		this.options.innerElement.setStyle( 'width', this.carouselWidth);
	},
	
	setSlideWidth : function()
	{
		this.slideWidth = this.slides[this.currIndex+1].getPosition().x - this.slides[this.currIndex].getPosition().x; 		
	},
		
	setOffSet : function()
	{
		var pOffSet = this.options.wrapperElement.getPosition();
		var offSet = this.options.innerElement.getPosition();
		this.sOffSet =  offSet.x - pOffSet.x;
	},

	shuffleSlides : function ( slides )
	{
		var randomSlide = slides.getRandom();
		var indx = slides.indexOf(randomSlide);
		var tmp = slides[0].innerHTML;
		slides[0].innerHTML = randomSlide.innerHTML;
		slides[indx].innerHTML = tmp;
	},	

	addSlides : function( slides )
	{	
		$$(slides).each( function(slide) {
			this.slides.include( $(slide) );
		}, this );
	},
		
	addPrevBttn : function( element )
	{
		$(element).addEvent('click', this.cycleBackward.bind(this) );
	},
	
	addNextBttn : function( element )
	{
		$(element).addEvent('click', this.cycleForward.bind(this) );
	},	
	checkLoop : function( event )
	{
		this.startAutoPlay();
		if( this.currIndex <= (this.slides.length*-1) || (this.currIndex >= this.slides.length) ) this.resetSlider();
	},
	createTransition : function()
	{
		var method = this.checkLoop;
		var timer = this.clearAutoPlay;
		var dur = this.options.duration;
		var trans = this.options.slideTransition;
		var dir = this.options.adjustDirection;
		
		this.slideObj = new Fx.Tween(this.options.innerElement, {
			property: dir,
			duration: dur, 
			transition: trans,
			onComplete: method.bind(this),
			onStart : timer.bind(this)
		});		
	},
	
	startAutoPlay : function()
	{
		if( ! this.options.autoPlay ) return false;
		this.autoPlayId = this.cycleForward.periodical( this.options.timerLength, this );
	},
	clearAutoPlay : function()
	{
		if( this.autoPlayId )$clear( this.autoPlayId )
	},
	
	cycleBackward : function()
	{
		this.slideObj.start(this.currPos + this.slideWidth );
		this.currPos += this.slideWidth;
		this.currIndex--
		return false;		

	},
	cycleForward : function()
	{
		this.slideObj.start(this.currPos - this.slideWidth );
		this.currPos -= this.slideWidth;
		this.currIndex++
		return false;
	}

});

//]]>





function hoverFunIn()
{ document.getElementById('popupDiv').className = 'popup'; return false; } 
function hoverFunOut()
{document.getElementById('popupDiv').className = 'dispNone'; return false; }


 window.addEvent('domready', function(){ShareL.attempt();affSlider.attempt();});

 ShareL = function()
        { 
            this.share= new com.aol.bv.shareLink({ShareHeight : '556'});
        }
        
affSlider= function()
        {
          this.HorizontalTweenSlider = new HorizontalTweenSlider( { 
				slides : $$( $('slidercontainer').getElementsByTagName('li') ), 
				prevBttn : $$( '#slidercontainer div.arrows a#prevBtn' )[0],
				nextBttn : $$( '#slidercontainer div.arrows a#nxtBtn' )[0],									
				wrapperElement : $('slidercontainer'),
				innerElement : $('slidermain'),
				autoPlay : false
			} );

                
        }
