
// Tog More for Search
// Begin : Headers 2 code


		// Tog More for Search
		function headShow(sShow)
		{
			if (sShow == "hide")
			{
				document.getElementById("srchMoreId").style.display = "none";
			}
			else
			{
				document.getElementById("srchMoreId").style.display = "block";
			}
			return false;
		}
		function searchTarget(url, newWindow, newTarget) {
			// Set the target for the form
			document.bb_topform.action = url;
			if (newWindow) {
				document.bb_topform.target = '_blank';
			} else {
				document.bb_topform.target = '';
			}

			// Update the tabs classes to allow highlighting of the selected
			var tabList = ["searchTabNews","searchTabWeb","searchTabImages","searchTabVideo","searchTabLocal"]
			for(var i=0;i<tabList.length;i++){
			document.getElementById(tabList[i]).className = '';
			}
			document.getElementById(newTarget).className = 'srchCatBg';

			return false;
		}

		function p_o(o){return document.getElementById(o);}

			String.prototype.trim = function() {
				return this.replace(/^\s+|\s+$/g,"");
			}

			function srchSubj(ref){
			  var frm=p_o("search");
			  var queryval = frm.topQuery.value.trim();
			  queryval = queryval.replace( /\+/, " ");
			  if(queryval.trim() != ""){
				  if(ref == 'a'){
					var uArr=new Array(3);
					uArr=frm.action.split('form-post');
					var newurl="";
					var frmact = document.bb_topform.action;
					var uri = videopagehostUrl  + "/video-search/query/";
					if(frmact == uri)
						newurl =uArr[0] + queryval + "/skin/philanthropy";
					else
						newurl =uArr[0] + queryval;
					 if (frm.target == '_blank') {
						window.open(newurl, '_blank', '');
					  } else {
						window.location = newurl;
					  }
				  }else{
				  var newurl = ref.href + queryval;
				  window.location = newurl;
				 }
			  }
			  return false;
			}

			function eventIsEnterKey(event) {
				if (event && event.which == 13 || window.event && window.event.keyCode == 13 || event && event.which == 3 || window.event && window.event.keyCode == 3) {
					return true;
				}
				return false;
			}

			function callSearch(event) {
				if (event == "onclick" || eventIsEnterKey(event)) {
					return srchSubj("a");        
				} else {
					return true;
				}
			}

					function searchFooterTarget(url, newWindow, newTarget) {
						// Set the target for the form
						document.bb_topform1.action = url;
						if (newWindow) {
							document.bb_topform1.target = '_blank';
						} else {
							document.bb_topform1.target = '';
						}

						// Update the tabs classes to allow highlighting of the selected
						var tabList = ["searchFootTabNews","searchFootTabWeb","searchFootTabImages","searchFootTabVideo","searchFootTabLocal"]
						for(var i=0;i<tabList.length;i++){
						document.getElementById(tabList[i]).className = '';
						}
						document.getElementById(newTarget).className = 'srchCatBg';

						return false;
					}
					function togFootMore(sShow)
						{
							if (sShow == "hide")
							{
								document.getElementById("srchFootMoreId").style.display = "none";
							}
							else
							{
								document.getElementById("srchFootMoreId").style.display = "block";
							}
							return false;
						}


	String.prototype.trim1 = function() {
		return this.replace(/^\s+|\s+$/g,"");
	}

	function srchFooterSub(ref){
	  var frm=p_o("searchFooter");
	  var queryval = frm.footQuery.value.trim1();
	  queryval = queryval.replace( /\+/, " ");
	if(queryval.trim() != ""){
	  if(ref == 'a'){
		var uArr=new Array(3);
		uArr=frm.action.split('form-post');
		var newurl="";
		var frmact = document.bb_topform1.action;
		var uri = videopagehostUrl  + "/video-search/query/";
		if(frmact == uri)
			newurl =uArr[0] + queryval + "/skin/philanthropy";
		else
			newurl =uArr[0] + queryval;
		 if (frm.target == '_blank') {
			window.open(newurl, '_blank', '');
		  } else {
			window.location = newurl;
		  }
	  }else{
	  var newurl = ref.href + queryval;
	  window.location = newurl;
	 }
	}
	  return false;
	}


	function submitFooterSearch(event) {
		if (event == "onclick" || eventIsEnterKey(event)) {
			return srchFooterSub("a");        
		} else {
			return true;
		}
	}


//Prevent IE flickr
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

function hideHeaderMore(e) {
    var targ;
    if (!e) var e = window.event;
    if (e.target) targ = e.target;
    else if (e.srcElement) targ = e.srcElement;
 
    if (targ.nodeType == 3) // defeat Safari bug
        targ = targ.parentNode;
 
    if(targ.id != 'srchMoreAnc') {
     var oDiv=p_o('srchMoreId');
  
     if(oDiv.style.display.toLowerCase() == "block") 
      oDiv.style.display='none';
    }
    if(targ.id != 'srchFootMoreAnc') {
     var oDiv=p_o('srchFootMoreId');
  
     if(oDiv.style.display.toLowerCase() == "block") 
      oDiv.style.display='none';
    }
}
document.onclick = hideHeaderMore;

//New Footer Js


//Highlight Navigation
function highlightHdrNav() {
    var category,ob,h=document.location.href;
    var locArray=new Array(15);
    var categoryElements=new Array();
    var highlight=1;
    locArray=h.split('/');
    var headerNav=locArray[3];
    if(headerNav!=null) {
        ob=document.getElementById('btmNav');
        if(ob){
            categoryElements=ob.getElementsByTagName('li');
            var currCat = headerNav + "Nav";
            for (i=0;i<categoryElements.length;i++) {
                if(categoryElements[i].id==currCat){
                    highlight=0;     
                    document.getElementById(categoryElements[i].id).className="mnuSltd";
                }
            }
        }
    } 
    if(headerNav==null || highlight==1) {
        document.getElementById('defaultNav').className="mnuSltd";
    }
}
highlightHdrNav();

