/* Header search functions start */
	function togMoreHeader(sShow) {
	document.getElementById("smorehead").style.display = sShow == "hide"?"none":"block";
	}
function eventIsEnterKey(e) {
var keynum;
if(window.event) // IE
  {
  keynum = e.keyCode;
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  }
  
  if (keynum == 13 ) 
	return true;
  else
	return false;
}

	function srchSubFoodHead(ref) {
		var frm=document.bb_topform;
		var queryfrm = frm.query.value.replace( /\+/, " ");
                queryfrm = queryfrm.replace( "/", " " );
                var queryval = queryfrm +(frm.action.indexOf("video.aol.com")>-1?"/skin/home":"");
                var path= document.location.pathname;
                var url_array= path.split("/");
                if(url_array[1] == "video-search"){
                    filterVal = $('familyFilterChk').checked ? "1" : "0"
                    familyFilter = filterVal;
                    if(familyFilter == 0){
                        queryval += "/familyfilter/0";
                    }
                }      
		if(ref == 'a'){
		   var newurl = frm.action + queryval;
		   if (frm.target == '_blank') {
		   window.open(newurl, '_blank', '');
		} else {
		   window.location = newurl;
		}
		} else {
		window.location = ref.href + queryval;
	}
	return false;
	}

	function searchTarget(url, newWindow, newTarget) {
	// Set the target for the form
	document.bb_topform.action = url;
	//document.bb_topform.target = newWindow?"_blank":"";

	// Update the tabs classes to allow highlighting of the selected
		var tabList = ["search-tab-News","search-tab-Web","search-tab-Images","search-tab-Video","search-tab-Local"]
		for(var i=0;i<tabList.length;i++) {
		document.getElementById(tabList[i]).className = '';
		}
		document.getElementById(newTarget).className = 'searchCatBg';
		togMoreHeader('hide');
		return false;
		}
		function submitHeaderSearch(event) {
		return event == "onclick" || eventIsEnterKey(event)?srchSubFoodHead("a"):true;
		}

/* Bottom search functions end */

/* Footer Bottom search functions start */
function togMoreFooter(sShow) {
	document.getElementById("fsmore").style.display = sShow == "hide"?"none":"block";
}
function srchFooterSub(ref) {
	 var frm=document.bb_topform1;
	 var queryfrm = frm.query.value.replace( /\+/, " ");
         queryfrm = queryfrm.replace( "/", " " );
         var queryval = queryfrm +(frm.action.indexOf("video.aol.com")>-1?"/skin/home":"");
         var path= document.location.pathname;
         var url_array= path.split("/");
         if(url_array[1] == "video-search"){
              filterVal = $('familyFilterChk').checked ? "1" : "0"
              familyFilter = filterVal;
              if(familyFilter == 0){
                   queryval += "/familyfilter/0";
              }
         }      
	 if(ref == 'a'){
	     var newurl = frm.action + queryval;
	     if (frm.target == '_blank') {
		 window.open(newurl, '_blank', '');
	     } else {
		window.location = newurl;
	     }
	} else {
		window.location = ref.href + queryval;
	}
	return false;
}
function searchFooterTarget(url, newWindow, newTarget) {
	// Set the target for the form
	document.bb_topform1.action = url;
	//document.bb_topform1.target = newWindow?"_blank":"";

	// Update the tabs classes to allow highlighting of the selected
	var tabList = ["search-ftab-News","search-ftab-Web","search-ftab-Images","search-ftab-Video","search-ftab-Local"]
	for(var i=0;i<tabList.length;i++) {
		document.getElementById(tabList[i]).className = '';
	}
	document.getElementById(newTarget).className = 'searchCatBg';
	togMoreFooter('hide');
	return false;
	}
	function submitFooterSearch(event) {
	return event == "onclick" || eventIsEnterKey(event)?srchFooterSub("a"):true;
	}

/*Footer Bottom search functions end */

/*Send us feedback script begins */

// fbLink v1.0c

var _fBr=encodeURIComponent(window.location.href);
var _fBh=362;
var _fBw=452;
var _fByt=(((screen.height-_fBh)/2)-100);
var _fBxl=((screen.width-_fBw)/2);


function _fBsG () {
	var _chG = typeof 's_channel' == 'undefined'? "" : s_channel ;
	return _chG;
}

function _fBsH () {
	var _chH = 'channel' in s_265? s_265.channel : "";
	_chH = _chH=='undefined'?'':_chH;
	return _chH;
}

function fBch() {
	var _ch = typeof s_265 == 'undefined'?_fBsG():_fBsH();
	return _ch;
}


function fBo(_sid){
	var _fBhref = 'http://feedback.aol.com/rs/rs.php?sid='+_sid;
	window.open(_fBhref+'&referer='+_fBr+'&ch='+fBch(),'feedback','width='+_fBw+',height='+_fBh+',screenX='+_fBxl+',screenY='+_fByt+',top='+_fByt+',left='+_fBxl+',resizable=yes,copyhistory=yes,scrollbars=no');
	return false;
}

function fBo2(_sid){
	var _fBhref = 'http://feedback.aol.com/rs/rs.php?sid='+_sid;
	window.open(_fBhref+'&referer='+_fBr+'&ch='+fBch(),'feedback','width='+_fBw+',height='+_fBh+',screenX='+_fBxl+',screenY='+_fByt+',top='+_fByt+',left='+_fBxl+',resizable=yes,copyhistory=yes,scrollbars=no');
}
// added in sprint8.2

var url = document.location.pathname;
var url_array= url.split("/");
var query = "";
if(url_array[1] == "video-search" && url_array[2] == "tag"){
 query = 'tag:"'+url_array[3]+'"';
}else if(url_array[1] == "video-search"){
 query = url_array[3];
}
 while ( query.contains("%20") || query.contains("%22") || query.contains("%27")) {
   query = query.replace( "%20", " " ); query = query.replace( "%22", "''" ); query = query.replace( "%27", "'" ); query = query.replace( "%26", "&" ); 
 }
   var frmfoot=document.bb_topform;
   frmfoot.query.value =query ;
   if(frmfoot.query.value != "") $("topquery").className="search";  
