function playVideo(_8) 
{
   window.open(_8, "", "width=800,height=800,location=yes,menubar=yes,resizable=yes,scrollbars=yes,toolbar=yes,status=yes,directories=yes");
}
/* Header functions*/
// Begin : Headers 2 code

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

function getEl( id ){ return document.getElementById( id ); }

// Login Functions
function AsnsSignIn( obj, leftOffSet, topOffSet, ele ) {
	if (!leftOffSet) leftOffSet = 0;
	if (!topOffSet) topOffSet = 0;
	var pSNS = getEl(ele);
	pSNS.innerHTML = "";
	pSNS.innerHTML += _sns_var_;
	if ( document.all ) {
		var pos = findPos(obj);
		pSNS.style.position = 'absolute';
		pSNS.style.left = (pos[0] + leftOffSet - 138) + 'px';
		pSNS.style.top =  (pos[1] + topOffSet + 12)  + 'px';
} else {
		obj.appendChild(pSNS);
		pSNS.style.left = leftOffSet + 'px';
		pSNS.style.top =  topOffSet  + 'px';
		pSNS.style.position = 'relative';
		}
	var close = document.createElement("span");
	var a = document.createElement("a");
	a.href = 'javascript:AsnsClose("'+ele+'")';
	a.title = "close";
	var img = document.createElement("img")
	img.src = "http://my.screenname.aol.com/images/10x10_x.gif";
	img.style.border = "0px"
	a.appendChild(img);
	close.appendChild(a);
	spans = pSNS.getElementsByTagName("span");
	spans[1].style.cssFloat = "right";
	spans[1].style.styleFloat = "right";
	spans[1].style.margin = "1px 0px 0px 10px";
	close.style.cssFloat = "right";
	close.style.styleFloat = "right";
	close.style.margin = "2px 2px 0px 0px";
	spanPar = spans[1].parentNode;
	spanPar.insertBefore(close,spans[1]);
	pSNS.style.zIndex = 5000;
	pSNS.style.display = "block";
}
function closeSNS(ele) {
	getEl(ele).innerHTML = '';
}

function AsnsClose(ele) {
	pSNS = getEl(ele);
	pSNS.style.display = "none";
}

function findPos(obj) {
	var curleft = curtop = 0;
	curleft = getX(obj);
	curtop = getY(obj);
	return [curleft,curtop];
}
function getY( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function getX( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}
/*
function srchSub(ref){
  var frm=p_o("search");
  var queryval = frm.topQuery.value.trim();
  queryval = queryval.replace( /\+/, " ");
  if(ref == 'a'){
   var newurl = frm.action + 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;
}

//Prevent IE flickr
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

/*end header functions*/

function showToolTip(oCaller, ttID){document.getElementById(ttID).style.display = "block";}
function hideToolTip(oCaller, ttID){document.getElementById(ttID).style.display = "none";}

// Tag Cloud/List (Blog Chatter)
function showTags()
{
	if (iTagType == 1) // Show as Cloud
		{
			caption = "List";
			iTagType = 2;
			document.getElementById("tagCloud").style.display = "block";
			document.getElementById("newsTagList").style.display = "none";
		} 
		else // Show as List
		{
			caption = "Cloud";
			iTagType = 1;
			document.getElementById("tagCloud").style.display = "none";
			document.getElementById("newsTagList").style.display = "block";
		}
			document.getElementById("newsTagTypeAnc").innerHTML = caption;
}
// End: Tag Cloud/List (Blog Chatter)
function showToolTip(oCaller, ttID){document.getElementById(ttID).style.display = "block";}
function hideToolTip(oCaller, ttID){document.getElementById(ttID).style.display = "none";}

/*video-hub-grid*/
function changeBkgrnd(vidHub){
	if(vidHub.className == "item"){
           vidHub.className="active";
		   }
    else{
	vidHub.className="item";
	}
}

function showHide(){
	var adSrch = document.getElementById("drpBox");
	if(adSrch.style.display == "block"){
		adSrch.style.display="none";
		}
	else{
		adSrch.style.display = "block";
	}
}

function changeSort(obj){
  setPref("sort", obj.id);
  document.getElementById('frmHubSrt').submit()
  return false;
}

function changeSource(element)
{
  //var sources = new Array();
  //var sourcesIndex = 0;
  //for (var i=0; i < document.sourceForm.source.length; i++)
  //{
  //  if (document.sourceForm.source[i].checked)
  //    {
  //      sources[sourcesIndex] = document.sourceForm.source[i].value;
  //      sourcesIndex++;
   //   }
  // }
  setPref("sources",element.id);
  document.sourceForm.submit();
}

function goToHub() {
    var searchField = document.getElementById("searchField");
    var query = searchField.value;
    if((query != null) && (query.length > 0)) {
        window.location = "/vce/video-hub/?query=" + escape(query);
    }
 }
 
 function changeVw(bkgrnd,vw){
	  if(vw == "grid"){
		  if(bkgrnd.className == "grdViwBttn"){
                       bkgrnd.className = "gridViwOff";
					   document.getElementById("listBk").className="lstViwBttn";
		        }
          else{
	                 bkgrnd.className="grdViwBttn";
					 document.getElementById("listBk").className="listViwOff";
	         }
     }
	 else{
		 if(bkgrnd.className == "lstViwBttn"){
                       bkgrnd.className = "listViwOff";
					   document.getElementById("gridBk").className="grdViwBttn";
		        }
          else{
	                 bkgrnd.className="lstViwBttn";
					 document.getElementById("listBk").className="gridViwOff";
	         }
	 }
	 document.getElementById("hubContainer").className = vw;
	 setPref("view", vw);
	 //document.frmHubSrt.hubVw.value=vw;
     return true;
	
	
	
}

/*user ratings starts */
function iterateHover(mode, curNum, selectedNum, linkId) {
  for (var n=1; n <= selectedNum; n++) {
    var linkObj = getEl(linkId+n);
    var c;
    ((curNum > 0) && (curNum < 1)) ? (curNum = 1) : (curNum = curNum)
    if (mode == 'over') {
      c = 'over';
    } else if (mode == 'out') {
      (n <= curNum) ? (c = 'on') : (c = 'off')
    }
    linkObj.setAttribute('class',c); // FF & Safari
    linkObj.className = c; // IE
  }
}

function submitRating(trriAppName, videoUri, category, assetType, screenName, newRating, ratingScale, url){
	var request = getHTTPObject();
	var starList = getEl('ratingStarList');
  starList.innerHTML = '<img src="http://o.aolcdn.com/art/aol-body/ajax_loader" style="padding-right:5px;float:left;"/><p style="background:#fff;border:1px solid #C8E4F0;padding:2px 4px;float:left;color:#76B6D2;margin-top:6px;margin-right:15px;">SAVING...</p>'; 
  if(request){
		request.onreadystatechange = function(){
      displayRatingResponse(request, newRating);
    };
    request.open("POST", url, true);
    request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    request.send("trriAppName="+trriAppName+"&videoUri="+videoUri+"&category="+category+"&assetType="+assetType+"&screenName="+screenName+"&newRating="+newRating+"&ratingScale="+ratingScale);
  }
}

function displayRatingResponse(request, newRating){
  var starList = getEl('ratingStarList');
	if(request.readyState != 4){
    
	} else {
		var element = getEl('dtRatings');
    element.innerHTML = request.responseText;
    switch(newRating){
      case '1':
        starList.innerHTML = '<li><span id="ratingStar1" class="on"> </span></li><li><span id="ratingStar2" class="off"> </span></li><li><span id="ratingStar3" class="off"><li><span id="ratingStar4" class="off"> </span></li><li><span id="ratingStar5" class="off"> </span></li>';
        break;
      case '2':
        starList.innerHTML = '<li><span id="ratingStar1" class="on"> </span></li><li><span id="ratingStar2" class="on"> </span></li><li><span id="ratingStar3" class="off"><li><span id="ratingStar4" class="off"> </span></li><li><span id="ratingStar5" class="off"> </span></li>';
        break;
      case '3':
        starList.innerHTML = '<li><span id="ratingStar1" class="on"> </span></li><li><span id="ratingStar2" class="on"> </span></li><li><span id="ratingStar3" class="on"><li><span id="ratingStar4" class="off"> </span></li><li><span id="ratingStar5" class="off"> </span></li>';
        break;
      case '4':
        starList.innerHTML = '<li><span id="ratingStar1" class="on"> </span></li><li><span id="ratingStar2" class="on"> </span></li><li><span id="ratingStar3" class="on"><li><span id="ratingStar4" class="on"> </span></li><li><span id="ratingStar5" class="off"> </span></li>';
        break;
      case '5':
        starList.innerHTML = '<li><span id="ratingStar1" class="on"> </span></li><li><span id="ratingStar2" class="on"> </span></li><li><span id="ratingStar3" class="on"><li><span id="ratingStar4" class="on"> </span></li><li><span id="ratingStar5" class="on"> </span></li>';
        break;
    }    
  }
}

/*user ratings ends */

function changeCnt(cnt) {
   //document.navcountgen.numrecrd.value=cnt;
   setPref("resultsNbr", document.navcountgen.resultsNbr.value)
   document.navcountgen.submit();
   return true;
}

var type_error = "error";
var type_debug = "debug";
var isdebug = false;

function log( type, msgs ) {
    var result = "";
	for (var i = 0; i < arguments.length; i++){
		result += " " + arguments[i];
	}
	if (type == type_debug && isdebug ) alert(result);
}

var logger = new function() {
	this.error = function(msgs){ log(type_error,msgs); };
	this.debug = function(msgs){ log(type_debug,msgs); };
}

if (typeof console == "undefined" || !console.error) {
	var console = {};
	console= logger;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setPref(param, value){
	var prefCookieName = "VCE-PREFS";
	var prefCookieString = "";
	var prefDelim = "&";
	var keyvalDelim = ":";
	var prefArray;
	var prefCookie = getCookie(prefCookieName);
	if ( prefCookie ) {
		prefArray = prefCookie.split(prefDelim);
	} else {
		prefArray = new Array();
	}

	var re = "^" + param + keyvalDelim;
	for (var i=0;i<prefArray.length;i++){
		if ( prefArray[i].search(re) <  0 ){
			if (prefCookieString != "" ){
				prefCookieString += prefDelim;
			}
			prefCookieString += prefArray[i];
		}
	}
	if (prefCookieString != "" )
		prefCookieString += prefDelim;

	prefCookieString += (param + keyvalDelim + value);
  setCookie(prefCookieName,prefCookieString,null);
	//document.cookie = prefCookieName + "=" + prefCookieString + "; path=/";
	console.debug("prefCookieString: ",prefCookieString);
	}

function getHTTPObject() {
 var xhr = null;
 if (window.XMLHttpRequest) {
  xhr = new XMLHttpRequest();
 } else {
  if (window.ActiveXObject) {
   try {
    xhr = new ActiveXObject("Msxml2.XMLHTTP");
   }
   catch (e) {
    try {
     xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e) {
     xhr = null;
    }
   }
  }
 }
 return xhr;
}

function cutString (str, maxchars) {
		if(str&&str.length<maxchars) return str;
		else if(str) return (str.substring(0,maxchars).lastIndexOf(" ")>0)?str.substring(0,str.substring(0,maxchars).lastIndexOf(" ")):str.substring(0,maxchars);
		else return "";
	}

//ajax callback function
function displayResponse(request, elementId){
  if(request.readyState == 4){
    var element = document.getElementById(elementId);
    element.innerHTML = request.responseText;
  }
}


//sets a cookie with the specified
//name, value and expiration date
function setCookie(name,value,expiredays){
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  document.cookie=name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+";path=/";
}

//returns the value of the
//specified cookie
function getCookie(cookieName){
  if (document.cookie.length>0){
    var start=document.cookie.indexOf(cookieName + "=");
    if (start!=-1){ 
      start=start + cookieName.length+1; 
      var end=document.cookie.indexOf(";",start);
      if (end==-1){
        end=document.cookie.length;
      }
      return unescape(document.cookie.substring(start,end));
    } 
  }
  return null;
}


//removes the specified element from the
//current array
function removeFromArray(array, element){
  var newArray = new Array(array.length - 1);
  var ni = 0;
  var i = 0;
  for(; i < array.length;){
    if(array[i].indexOf(element) == -1){
      newArray[ni] = array[i];
      ni=ni+1; 
    }
    i=i+1;
  } 
  return newArray; 
}

//adds the specified element to the
//current array
function addToArray(array, element){
  var newArray = new Array(array.length + 1);
  var l = array.length;
  var i = 0;
  for(; i < array.length; ){
    newArray[i] = array[i];
    i=i+1;
  }
  newArray[i] = element;
  return newArray;     
}

function otherVidsHoverStyle(id) {
  var idImgTags = id.getElementsByTagName('IMG');
  idImgTags[0].style.background = '#b2b9bc';
  idImgTags[0].style.border = '1px solid #b2b9bc';
  var idAnchorTags = id.getElementsByTagName('A');
  idAnchorTags[0].style.color = '#555';
  idAnchorTags[0].style.textDecoration = 'underline';
  id.style.background = '#E7E7E9';
}

function otherVidsHoverOutStyle(id) {
  var idImgTags = id.getElementsByTagName('IMG');
  idImgTags[0].style.background = '#fff';
  idImgTags[0].style.border = '1px solid #c7e3ef';
  var idAnchorTags = id.getElementsByTagName('A');
  idAnchorTags[0].style.color = '#3952a2';
  idAnchorTags[0].style.textDecoration = 'none';
  id.style.background = '#fff';
}

function tabSwitcher(id) {
  var activeId = document.getElementById(id);
  var tabOne = document.getElementById('tabMod_tabOne');
  var tabTwo = document.getElementById('tabMod_tabTwo');
  var tabThree = document.getElementById('tabMod_tabThree');
  var oneBody = document.getElementById('tabMod_oneLayer');
  var twoBody = document.getElementById('tabMod_twoLayer');
  var threeBody = document.getElementById('tabMod_threeLayer');

  if (activeId == tabOne) {
    activeTab(tabOne, oneBody);
    inActiveTab(tabTwo, twoBody);
    inActiveTab(tabThree, threeBody);
  } else if (activeId == tabTwo) {
    activeTab(tabTwo, twoBody);
    inActiveTab(tabOne, oneBody);
    inActiveTab(tabThree, threeBody);
  } else if (activeId == tabThree) {
    activeTab(tabThree, threeBody);
    inActiveTab(tabOne, oneBody);
    inActiveTab(tabTwo, twoBody);
  }
}

function activeTab(tabId, bodyId) {
  if (tabId == document.getElementById('tabMod_tabOne')) {
    tabId.innerHTML = '<span>BOOK</span>';
  } else if (tabId == document.getElementById('tabMod_tabTwo')) {
    tabId.innerHTML = '<span>BIO</span>';
  } else if (tabId == document.getElementById('tabMod_tabThree')) {
    tabId.innerHTML = '<span>POLL</span>';
  }
  bodyId.style.display = 'block';
  tabId.style.background = '#DAEDF4 url(http://o.aolcdn.com/art/aol-body/coaches_rtrl_selected) repeat-x';
}

function inActiveTab(tabId, bodyId) {
  if (tabId == document.getElementById('tabMod_tabOne')) {  
    tabId.innerHTML = '<a href="#" onClick="javascript:tabSwitcher(\'tabMod_tabOne\');return false;">BOOK</a>';
  } else if (tabId == document.getElementById('tabMod_tabTwo')) {
    tabId.innerHTML = '<a href="#" onClick="javascript:tabSwitcher(\'tabMod_tabTwo\');return false;">BIO</a>';
  } else if (tabId == document.getElementById('tabMod_tabThree')) {
    tabId.innerHTML = '<a href="#" onClick="javascript:tabSwitcher(\'tabMod_tabThree\');return false;">POLL</a>';
  }  
  bodyId.style.display = 'none';
  tabId.style.background = '#DAEDF4 url(http://o.aolcdn.com/art/aol-body/coaches_rtrl_tab) repeat-x';
}

function printDiv() {
    var d = window.open('','','width=300,height=300,resizable=yes');
    d.document.open('text/html');
    d.document.write(document.getElementById('article').innerHTML);
    d.document.close();
    d.print();
}

function addComment() {
  if (_sns_isLoggedIn!=true) {
    AsnsSignIn(getEl('commentAddForm'), 100, -80,'snsMiniUI');
  } else {
    if ((getEl('commentBox').value == '') || (getEl('commentBox').value == 'Type your own comment here.')) {
      return;
    } else {
      getEl('commentAddForm').submit();
    }
  }
}

//begin HP Tabblo code
function __TABBLO_TPT_LOAD() {
  Tabblo.embedded.sites.SettingsObject.preprocess.apply({

    Properties:
      {
      template: 'news_large'
    },
    FixedContent:
      {
      accentcolor: '#555',
      accentcolor2: '#ccc'
    },
    // content definition:
    Content:
      {
      'pagetitle':   { match: 'css', selector:'.artHeader h1' },
      'text':        { match: 'css', selector:'#mainArtNavHead' },
      'logo':        { match: 'match',  attr: 'src', value:'gmc-title', continueHooks: false, nodeContentType: 'image' }                       
    }
  },[]);
  Tabblo.embedded.printabulous();
}

function MakePDF() {
  // append tabblo print script on demand
  var _tpt_script_loaded = false;
  if (!_tpt_script_loaded) {
    _tpt_script_loaded = true;
    var tpS = document.createElement('script');
    tpS.setAttribute('type','text/javascript');
    tpS.setAttribute('charset', 'utf-8');
    tpS.setAttribute('src','http://h30405.www3.hp.com/edit/tptboot/1.0');
    document.getElementsByTagName('body').item(0).appendChild(tpS);
  } else {
    Tabblo.embedded.detect.setup(Tabblo.embedded.printabulous.bind(null,false));
  }
}
//end HP Tabblo code

function shareWin(url) {
    var sharePanel = document.createElement("div");
    var shareOverlay = document.createElement("div");
    $(sharePanel).attr("id", "shareWin");
    $(shareOverlay).attr("id", "shareOverlay");
    $("body").prepend(sharePanel);
    $("body").prepend(shareOverlay);
    var shareOffSet = $(".shareList").offset();
    $("#shareWin").css({ top:shareOffSet.top, left:shareOffSet.left });
var html =$.ajax({
  type: "GET",
  url: url,
  success: function(html){
    $("#shareWin").append(html);
    loadWin();
  }
});


}

// GPL'd courtesy of http://www.jeffothy.com/weblog/clipboard-copy
// Needs swf file at http://www.aolcdn.com/_media/ch_music2/_clipboard.swf
function copyElToClip(el) {
  var inElement = document.getElementById(el);
  if (inElement.createTextRange) {
    var range = inElement.createTextRange();
    if (range)
      range.execCommand('Copy');
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="http://www.aolcdn.com/_media/ch_music2/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}
/* SNS Login Verification */
function loginCheck() {
    var sitedomain1 = 'sitedomain='+sitedomain;
	var url="siteState="+encodeURIComponent("OrigUrl="+encodeURIComponent(window.location));
	if(_sns_isLoggedIn) {
		getEl("userspan").innerHTML="Hi, "+_user_display_name;
		getEl("loginlink").href="https://my.screenname.aol.com/_cqr/logout/mcLogout.psp?"+sitedomain1+"&"+url;
		getEl("loginlink").title="Sign Out";  
		getEl("loginlink").innerHTML="Sign Out";
	} else {
		getEl("loginlink").href="https://my.screenname.aol.com/_cqr/login/login.psp?"+sitedomain1+"&"+url;
		getEl("loginlink").title="Sign In";        	
		getEl("loginlink").innerHTML="Sign In";
	 }
}

// Header2.0  (SEARCH BAR)
function p_o(o){return document.getElementById(o);}

function ai_posX(obj){
 var left=0;
 if(obj.offsetParent){
 while(obj.offsetParent){
 left+=obj.offsetLeft;
 obj=obj.offsetParent;
 }
 }else if(obj.x)left+=obj.x;
 return left;
}
function ai_posY(obj){
 var top=0;
 if(obj.offsetParent){
 while(obj.offsetParent){
 top+=obj.offsetTop;
 obj=obj.offsetParent;
 }
 } else if(obj.x)top+=obj.y;
 return top;
}

function togMore(e,state){
 var oDiv=p_o('smore');
 if(state=='show'){
 posMore(e);
 oDiv.style.zIndex='99999999';
 oDiv.style.display='block';
 } else {
 oDiv.style.display='none';
 }
 return false;
}
function posMore(e){
 var oDiv=p_o('smore');
 var oLnk=p_o('smorea');
 posY = findMousePos(e);
 oDiv.style.left='638px';
 oDiv.style.top='28px';
}

function fttogMore(e,state){
 var oDiv=p_o('ft-smore');
 if(state=='show'){
 ftposMore(e);
 oDiv.style.zIndex='99999999';
 oDiv.style.display='block';
 } else {
 oDiv.style.display='none';
 }
 return false;
}
function ftposMore(e){
 var oDiv=p_o('ft-smore');
 var oLnk=p_o('ft-smorea');
 posY = findMousePos(e);
 oDiv.style.left='582px';
 oDiv.style.top='28px';
}


// Begin : Headers 2 code
String.prototype.trim = function() {
 return this.replace(/^\s+|\s+$/g,"");
}


function searchTarget(url, newWindow, newTarget, searchFrm) {
    // Set the target for the form
if (searchFrm == 1){
    document.bot_form.action = url;
    if (newWindow) {
        document.bot_form.target = '';
    } else {
        document.bot_form.target = '';
    }
    // Update the tabs classes to allow highlighting of the selected
    var arrElements = getElementsByClassName ('ft-searchCatBg', 'li');
    for (var i=0; i<arrElements.length; i++) {
        arrElements[i].className = '';
    }
    document.getElementById(newTarget).className = 'ft-searchCatBg';    
}else {
    document.top_form.action = url;
    if (newWindow) {
        document.top_form.target = '_blank';
    } else {
        document.top_form.target = '';
    }
    
    // Update the tabs classes to allow highlighting of the selected
    var arrElements = getElementsByClassName ('selected', 'li');
    for (var i=0; i<arrElements.length; i++) {
        arrElements[i].className = '';
    }
    document.getElementById(newTarget).className = 'selected';    
}

var searchfield=document.getElementById('queryname');
  if(document.getElementById(newTarget).id == 'search-tab-blog'){
  searchfield.name='q';
  } else {
   searchfield.name='query';
  }
  var searchfield=document.getElementById('queryname1');
  if(document.getElementById(newTarget).id == 'search-tab-blog2'){
  searchfield.name='q1';
  } else {
   searchfield.name='query';
  }


    return false;
}


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;
}

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 submitHeaderSearch(event) {
 if (event == "onclick" || eventIsEnterKey(event)) {
 return srchSub2();
 } else {
 return true;
 }
}

function srchSub2() {
 var frm=p_o("search");
 var queryval = frm.topquery.value.trim();
 queryval = queryval.replace( /\+/, " ");
 var newurl = frm.action + queryval;
 if (frm.target == '_blank') {
 window.open(newurl, '_blank', '');
 } else {
 window.location = newurl;
 }
 return false;
}

// Shared functions

function findMousePos(e) {
	var posY = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posY = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posY = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	return posY;
}


//This function hides the more popup on the //header when a user clicks anywhere on the document

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 != 'smorea' && p_o('smore')) {
        var oDiv=p_o('smore');
         
        if(oDiv.style.display.toLowerCase() == "block") 
            oDiv.style.display='none';
    }
    if(targ.id != 'ft-smorea' && p_o('ft-smore')) {
        var oDiv=p_o('ft-smore');
         
        if(oDiv.style.display.toLowerCase() == "block") 
        oDiv.style.display='none';
    }    
}
document.onclick = hideHeaderMore;

 var submitReq = function () {

        if ($("form #emailTo").val() =='' || $("form #emailMsg").val() =='') {
          alert('To and Message fields are required.');
          return;
        }
        var emailMsg = $("form #message2").val();
        var emailTo = $("form #emailTo").val();
        var emailSubject = $("form #emailSubject").val();
        var emailFrom = $("form #emailFrom").val();
        //$.post('eventHandler.jsp?emailMsg=' + escape(emailMsg) + '&emailSubject=' + escape(emailSubject)+ '&emailFrom=' + escape(emailFrom)+ '&emailTo=' + escape(emailTo)+ '&linkTitle='+ linkTitle + '&linkUrl='+ pageId);
        $.ajax({
        type:"POST",
        url: "/experts/eventhandler",
        data: 'emailMsg=' + escape(emailMsg) + '&emailSubject=' + escape(emailSubject)+ '&emailFrom=' + escape(emailFrom)+ '&emailTo=' + escape(emailTo)+ '&linkTitle='+ linkTitle + '&linkUrl='+ pageId ,
        async: false,
        success: function(msg){
         $("#formMsg").text("Message Successful");
        },
        error: function(msg){
        $("#formMsg").text("There was a problem with the request.");
        }
        
    });
  }
      

      function sendDisabled(val,btnId) {
        if (val == 1) {
 
          $(btnId).attr("disabled","disabled");  
        }
        if (val == 0) {
          $(btnId).attr("disabled","");
        }                
      }
  
      
      function onFieldFocus(id,msg) {
        if($(id).val() == msg){
            $(id).val(''); 
        }
      }
      
      function onFieldBlur(id,msg) {
        
        if($(id).val() == ''){
            $(id).val(msg); 
        }
      }
/* Jquery events */
/* onload functions */
onload = function(){

   // Share Asset
   $("#emailShar, #imShar, #bookMarkShar").click(function(){
       var tab =null;
       switch(this.id){
       case 'emailShar':
       tab = 'email';
       break;
       case 'imShar':
       tab = 'im';
       break;
       case 'bookMarkShar':
       tab = 'bookmark';
       break;         
       default:
       break;
        }
       if(_sns_isLoggedIn!=true) AsnsSignIn(getEl('ShareModule'), 82, -10,'snsMiniUI');
       else{return shareWin('/experts/share?page='+currentUrl+'&tab='+tab+'&asset='+assetName);}
   });
   $(".feedImg").click(function(){
    aol_feeds_subscribe.show(this,null,this.href);return false;
    });
    
    //Print
    $(".print").click(function(){
    MakePDF();
    });
    
    // Copy onclick select
    $("#snaggableInput").click(function(){
       this.select();
    });

 };

// Loads and binds events for share window
function loadWin() {

    $("#bookMarkTb, #imTb, #emailTb").click(function(){
        $(".leftpnlMain li").removeClass("selectedTab");
        $(this).addClass("selectedTab");
        $("#container .container").removeClass("select");
        switch(this.id){
            case 'bookMarkTb':
                $('#BookMarks').addClass("select");
            break;
            case 'imTb':
                $('#IM').addClass("select");
            break;
            case 'emailTb':
                $('#EMail').addClass("select");
            break;            
            default:
            break;
        }
    });
    // EMAIL to bound events
    $("#emailTo").focus(function(){
    onFieldFocus('#emailTo','Enter your recipients\' e-mail addresses.');
    });
    $("#emailTo").blur(function(){
    onFieldBlur('#emailTo','Enter your recipients\' e-mail addresses.');
    });
    $("#emailTo").click(function(){
    sendDisabled(0,'#sendauth');
    });
    
    //TextArea Bound Events
    $("#message2").focus(function(){
    onFieldFocus('#message2','Enter your personal message here.');
    });
    $("#message2").blur(function(){
    onFieldBlur('#message2','Enter your personal message here.');
    });
    $("#message2").click(function(){
    sendDisabled(0,'#sendauth');
    });

   // RESET Button
   $(".frmdivclearbttn").click(function(){
       $(forms[0]).reset();
   });
   // Submit Mail form
   $("#sendauth").click(function(){
        if ($("form #emailTo").val() =="Enter your recipients' e-mail addresses." || $("form #emailMsg").val() =='Enter your personal message here.') {
          alert('To and Message fields are required.');
          return;
        }
       submitReq();
   });

 //share remove popup window
    $(".closeBtn").click(function(){
    $("#shareWin").remove();
    $("#shareOverlay").remove();
    });
    
};
/*this is for clearing the textarea of the Ask the pro modules starts*/
  function checkTxt(id, defaulttxt){
    if(id == "prosTxt"){
      if(defaulttxt == "Have a question for the pros? Every week they'll pick two as part of the featured Pros' Pick below. But the pros can't get to everyone, so the community will help too.") {
        getEl(id).value = "";
      }      
    } else if(id == "innxbox"){			
      if(defaulttxt == "Ask "+expNameDenormalized+" a question here."){
        getEl(id).value = "";
      }
    }
  }
  function txtReset(id, defaulttxt){
    if(defaulttxt == "") {
      if(id == "prosTxt"){
        getEl(id).value = "Have a question for the pros? Every week they'll pick two as part of the featured Pros' Pick below. But the pros can't get to everyone, so the community will help too."; 
      } else if(id == "innxbox"){
        getEl(id).value = "Ask "+expNameDenormalized+" a question here.";
      }
    }
  }
  /*this is for clearing the textarea of the Ask the pro modules ends*/


/*  Parentdish SEARCH function */

  function SubmitForm(){

					document.solrSearchForm.searchTerm.value = document.solrSearchForm.searchTerm.value.replace(/[^a-z0-9\-\+\s]*/gi,"").replace(/\s{2,}/g," ");
					if(document.solrSearchForm.searchTerm.value.replace(/\s/g,"")=="") { return; }

					document.solrSearchForm.action='/experts/'+document.solrSearchForm.sExpert.value+'/search-results/'+document.solrSearchForm.searchTerm.value;
                    document.solrSearchForm.submit();
					
                } 
  
  
  /* global header/footer js code */
  
  /* header and footer search box */
  /* header and footer search box */
(function(a){a.fn.globalHeader=function(d){var c={activeTab:null,moreLinks:[],morePromoCount:2,moreText:"You might also like:",moreAnd:"and",moreMore:"More",moreTextHeadline:"More Sites You Might Like",uiHat:"#GH_hat",uiHatLinks:"#GH_hat_links",uiHatTools:"#GH_hat_tools",uiNavLi:"li.GH_nav_LI",uiNavADd:".GH_nav_dd_A",auth:{doAuth:false,authenticated:false,authState:null,unauthState:null},search:{uiSearch:"#GH_search",params:{}},fn:{}},e={},h=this,g={},f={activeTab:null,moreLinksBuilt:false},b={init:function(i){g.$d=a(document);g.$c=a(i);g.hat=a(e.uiHat)[0];g.hatLinks=a(e.uiHatLinks)[0];g.$hatTools=a(e.uiHatTools);g.$search=a(e.search.uiSearch);g.$searchInput=g.$search.find("input:first");g.$searchSubmit=g.$search.find("input:last");g.$navLi=g.$c.find(e.uiNavLi);g.$navADd=g.$c.find(e.uiNavADd);b.setActiveTab(null,e.activeTab);if(e.auth.doAuth){b.buildAuth()}b.buildMoreLinks();b.buildDropDowns();g.$c.bind("setActiveTab",function(k,j){b.setActiveTab(k,j)});g.$c.bind("setAuthState",function(k,j){b.buildAuth(k,j)});if(e.search.params.initFocus!==undefined&&e.search.params.initFocus){g.$search.globalSearchBox(e.search.params)}else{g.$searchInput.bind("focus.GH",function(j){b.buildSearch(j)}).attr("autocomplete","off");g.$searchSubmit.bind("mouseover.GH",function(j){b.buildSearch(j)});if(e.search.params.searchText!==undefined&&e.search.params.searchText!==""){g.$searchInput.val(e.search.params.searchText)}}},getVars:function(){return{options:e,ui:g,local:f}},buildSearch:function(i){g.$searchInput.unbind("focus.GH");g.$searchSubmit.unbind("mouseover.GH");if(i.target===g.$searchInput[0]){g.$searchInput.addClass("GH_search_active").attr("value","")}g.$search.globalSearchBox(e.search.params)},buildAuth:function(j,i){if(i!==undefined){a.extend(true,e.auth,i)}g.$hatTools.empty().append((e.auth.authenticated)?e.auth.authState:e.auth.unauthState)},buildMoreLinks:function(){var o=e.moreLinks,m=0,j=o.length;if(j>=e.morePromoCount){var n,k=a("<li />").addClass("GH_hat_LI").append(n=a("<ul />").attr("id","GH_hat_more").addClass("GH_hat_UL").append(a("<li />").addClass("GH_hat_LI").text(e.moreText+"\xa0 ")));for(;m<e.morePromoCount;m++){n.append(a("<li />").addClass("GH_hat_LI").append(a("<a />").attr({href:o[m][1],target:(o[m][2]!==undefined)?o[m][2]:"_self"}).addClass("GH_hat_A GH_hat_more_A").text(o[m][0])).append((m<e.morePromoCount-1)?",\xa0":""))}if(j>e.morePromoCount){n.append(g.$hatLIMore=a("<li />").addClass("GH_hat_LI GH_hat_LI_more").append("\xa0"+e.moreAnd+"\xa0").append(g.$hatMoreLink=a("<a />").attr({id:"GH_hat_more_link",href:"#"}).addClass("GH_hat_A GH_hat_more_A").text(e.moreMore).bind("mouseover.GH",function(i){b.showMoreLinks(i)})))}k.appendTo(g.hatLinks)}},showMoreLinks:function(p){p.preventDefault();if(f.moreLinksBuilt===false){var n=e.moreLinks.slice(e.morePromoCount),o=0,m=n.length,j=Math.ceil(m/3),k=Math.ceil(m/3*2),s,r,q,t;g.$hatMoreList=a("<div />").attr("id","GH_more_list").append(a("<b />").attr("id","GH_more_list_lab").text(e.moreTextHeadline)).append(s=a("<ul />").addClass("GH_more_list_UL")).append(r=a("<ul />").addClass("GH_more_list_UL")).append(q=a("<ul />").addClass("GH_more_list_UL"));for(;o<m;o++){t=a("<li />").append(a("<a />").attr({href:n[o][1],target:(n[o][2]!==undefined)?n[o][2]:"_self"}).text(n[o][0]));if(o<j){t.appendTo(s)}else{if(o<k){t.appendTo(r)}else{t.appendTo(q)}}}g.$hatMoreList.css("left",g.$hatLIMore.offset().left-g.$c.offset().left+14).appendTo(g.hat);f.moreLinksBuilt=true}if(g.$hatMoreList.css("display")==="none"){g.$d.bind("mousemove.GHTEMP",function(i){b.kill(i)});g.$hatMoreList.fadeIn("fast")}},kill:function(j){var i=a(j.target);if(i.closest("#GH_hat_more_link").length===0&&i.closest("#GH_more_list").length===0){g.$d.unbind("mousemove.GHTEMP");g.$hatMoreList.fadeOut("fast")}},setActiveTab:function(j,i){if(i!==undefined&&i!==null){if(f.activeTab!==null){f.activeTab.removeAttr("id");if(f.activeTab.hasClass("GH_nav_list")){a("#GH_nav_act_B").removeAttr("id")}}f.activeTab=g.$navLi.eq(i).attr("id","GH_nav_act");f.activeTab.children().eq(0).css("clear","both");if(f.activeTab.hasClass("GH_nav_list")){f.activeTab.children().eq(0).wrapInner('<b id="GH_nav_act_B"></b>')}}},buildDropDowns:function(){g.$navLi.each(function(){var i=a(this);if(i.hasClass("GH_nav_list")){i.mouseover(function(){if(i.showtimer){clearInterval(i.showtimer);i.showtimer=null}i.addClass("GH_nav_list_open").find("ul").fadeIn("fast")}).mouseout(function(){i.showtimer=setTimeout(function(){if(i.showtimer){clearInterval(i.showtimer);i.showtimer=null}i.removeClass("GH_nav_list_open").find("ul").fadeOut("fast")},250)})}})}};a.extend(true,e,c,d);a.extend(true,b,e.fn);b.init(h);return h}})(jQuery);(function(a){a.fn.globalSearchBox=function(d){var c={apiUrl:"http://autocomplete.search.aol.com/autocomplete/get",apiIt:"ops-test",apiOutput:"json",apiCount:8,apiQueryParam:"q",apiDictionary:"",ui_form:"#GH_search_form",ui_input:"#GH_search_field",ui_submit:"#GH_search_button",ui_output:"#GH_search_results",initSmartSearch:true,searchText:"",preserveGhostText:false,initFocus:false,fn:{}},e={},h=this,g={},f={ghostText:"",query:"",results:[],highlight:-1,$highlight:null,timer:null},b={init:function(i){g.$c=a(i);g.$input=a(e.ui_input);g.$output=a(e.ui_output);g.form=a(e.ui_form)[0];g.submit=a(e.ui_submit)[0];f.ghostText=g.$input.attr("defaultValue");g.$input.attr("autocomplete","off").bind("focus.GH",function(j){b.processInputFocus(j)}).bind("blur.GH",function(j){b.processInputBlur(j)});a(g.form).bind("submit.GH",function(j){b.selectSuggestion(j)});if(e.initSmartSearch){e.apiUrl=e.apiUrl+"?it="+e.apiIt+"&count="+e.apiCount+"&output="+e.apiOutput;if(e.apiDictionary!==""){e.apiUrl=e.apiUrl+"&dict="+e.apiDictionary}g.$input.bind("keyup.GH",function(j){b.processKeyPress(j)});g.$output.bind("mouseover.GH",function(j){b.moveHighlightMouse(j)}).bind("mouseover.GH",function(j){b.suspendBlurDetection(j)}).bind("mouseleave.GH",function(j){b.resumeBlurDetection(j)}).bind("click.GH",function(j){b.selectSuggestion(j)})}if(e.initFocus){g.$input.focus()}if(e.preserveGhostText){g.$label=a("<label />").attr("id","GH_search_label").text(f.ghostText).appendTo(g.form);g.$label.bind("click.GH_SL",function(j){b.preserveGhostText(true)});g.$input.bind("keyup.GH_SL",function(j){b.preserveGhostText(j)}).bind("click.GH_SL",function(j){b.preserveGhostText(j)}).bind("blur.GH_SL",function(j){setTimeout(function(){b.preserveGhostText(j)},250)})}if(e.searchText!==""){g.$input.val(e.searchText)}},getVars:function(){return{options:e,ui:g,local:f}},processInputFocus:function(i){g.$input.addClass("GH_search_active").val((g.$input.val()===f.ghostText)?"":g.$input.val())},processInputBlur:function(i){g.$input.removeClass("GH_search_active").val((g.$input.val()==="")?f.ghostText:g.$input.val());b.displaySuggestions()},preserveGhostText:function(i){if(typeof i==="boolean"&&i){g.$input.focus()}g.$input.unbind("keyup.GH_SL").unbind("click.GH_SL").unbind("blur.GH_SL");g.$label.remove()},processKeyPress:function(l){var j=l.keyCode;if(j===38){b.moveHighlightKey(-1)}else{if(j===40){b.moveHighlightKey(1)}else{var i=l.target,k=a.trim(i.value);if(k!==""){if(f.timer!==null){clearTimeout(f.timer)}f.timer=setTimeout(function(){b.getSuggestions(k)},200)}else{b.displaySuggestions()}}}},moveHighlightKey:function(j){if(f.$highlight!==null){f.$highlight.removeClass("GH_highlight")}f.highlight=f.highlight+j;if(f.highlight>=f.results.length||f.highlight===-1){f.highlight=-1;g.$input.val(f.query)}else{if(f.highlight<-1){f.highlight=f.results.length-1}}if(f.highlight>-1){f.$highlight=a(f.results[f.highlight]);f.$highlight.addClass("GH_highlight");g.$input.val(f.$highlight.text())}},moveHighlightMouse:function(j){var i=j.target;if(i.nodeName==="B"){i=i.parentNode}if(f.$highlight!==null){f.$highlight.removeClass("GH_highlight")}f.highlight=f.results.index(i);f.$highlight=a(i).addClass("GH_highlight")},selectSuggestion:function(j){j.preventDefault();if(j!==undefined&&j.type==="click"){var i=j.target;if(i.nodeName==="B"){i=i.parentNode}g.$input.val(a(i).text())}g.$input.val(a.trim(g.$input.val()));if(g.$input.val()!==""&&g.$input.val()!==f.ghostText){g.form.submit()}},getSuggestions:function(j){var i=e.apiUrl+"&"+e.apiQueryParam+"="+j;a.ajax({dataType:"jsonp",url:i,jsonp:"cb",success:function(k){b.displaySuggestions(k)},error:function(){b.displaySuggestions()}})},suspendBlurDetection:function(){g.$input.unbind("blur.GH")},resumeBlurDetection:function(){g.$input.bind("blur.GH",function(i){b.processInputBlur(i)})},displaySuggestions:function(p){f.highlight=-1;f.$highlight=null;if(p!==undefined&&p[1].length>0){f.query=p[0];var o=p[1],j=a("<ul />"),m,k=o.length,n=new RegExp(f.query,"i"),q="<b>"+f.query+"</b>";for(m=0;m<k;m++){a("<li />").html(o[m].replace(n,q)).appendTo(j)}f.results=j.find("li");g.$output.empty().append(j).fadeIn("fast")}else{f.query="";f.results=[];g.$output.fadeOut("fast").empty()}}};a.extend(true,e,c,d);a.extend(true,b,e.fn);b.init(h);return h}})(jQuery);
(function(a){a.fn.globalSearchBox=function(d){var c={apiUrl:"http://autocomplete.search.aol.com/autocomplete/get",apiIt:"ops-test",apiOutput:"json",apiCount:8,apiQueryParam:"q",apiDictionary:"",ui_form:"#GH_search_form",ui_input:"#GH_search_field",ui_submit:"#GH_search_button",ui_output:"#GH_search_results",initSmartSearch:true,searchText:"",preserveGhostText:false,initFocus:false,fn:{}},e={},h=this,g={},f={ghostText:"",query:"",results:[],highlight:-1,$highlight:null,timer:null},b={init:function(i){g.$c=a(i);g.$input=a(e.ui_input);g.$output=a(e.ui_output);g.form=a(e.ui_form)[0];g.submit=a(e.ui_submit)[0];f.ghostText=g.$input.attr("defaultValue");g.$input.attr("autocomplete","off").bind("focus.GH",function(j){b.processInputFocus(j)}).bind("blur.GH",function(j){b.processInputBlur(j)});a(g.form).bind("submit.GH",function(j){b.selectSuggestion(j)});if(e.initSmartSearch){e.apiUrl=e.apiUrl+"?it="+e.apiIt+"&count="+e.apiCount+"&output="+e.apiOutput;if(e.apiDictionary!==""){e.apiUrl=e.apiUrl+"&dict="+e.apiDictionary}g.$input.bind("keyup.GH",function(j){b.processKeyPress(j)});g.$output.bind("mouseover.GH",function(j){b.moveHighlightMouse(j)}).bind("mouseover.GH",function(j){b.suspendBlurDetection(j)}).bind("mouseleave.GH",function(j){b.resumeBlurDetection(j)}).bind("click.GH",function(j){b.selectSuggestion(j)})}if(e.initFocus){g.$input.focus()}if(e.preserveGhostText){g.$label=a("<label />").attr("id","GH_search_label").text(f.ghostText).appendTo(g.form);g.$label.bind("click.GH_SL",function(j){b.preserveGhostText(true)});g.$input.bind("keyup.GH_SL",function(j){b.preserveGhostText(j)}).bind("click.GH_SL",function(j){b.preserveGhostText(j)}).bind("blur.GH_SL",function(j){setTimeout(function(){b.preserveGhostText(j)},250)})}if(e.searchText!==""){g.$input.val(e.searchText)}},getVars:function(){return{options:e,ui:g,local:f}},processInputFocus:function(i){g.$input.addClass("GH_search_active").val((g.$input.val()===f.ghostText)?"":g.$input.val())},processInputBlur:function(i){g.$input.removeClass("GH_search_active").val((g.$input.val()==="")?f.ghostText:g.$input.val());b.displaySuggestions()},preserveGhostText:function(i){if(typeof i==="boolean"&&i){g.$input.focus()}g.$input.unbind("keyup.GH_SL").unbind("click.GH_SL").unbind("blur.GH_SL");g.$label.remove()},processKeyPress:function(l){var j=l.keyCode;if(j===38){b.moveHighlightKey(-1)}else{if(j===40){b.moveHighlightKey(1)}else{var i=l.target,k=a.trim(i.value);if(k!==""){if(f.timer!==null){clearTimeout(f.timer)}f.timer=setTimeout(function(){b.getSuggestions(k)},200)}else{b.displaySuggestions()}}}},moveHighlightKey:function(j){if(f.$highlight!==null){f.$highlight.removeClass("GH_highlight")}f.highlight=f.highlight+j;if(f.highlight>=f.results.length||f.highlight===-1){f.highlight=-1;g.$input.val(f.query)}else{if(f.highlight<-1){f.highlight=f.results.length-1}}if(f.highlight>-1){f.$highlight=a(f.results[f.highlight]);f.$highlight.addClass("GH_highlight");g.$input.val(f.$highlight.text())}},moveHighlightMouse:function(j){var i=j.target;if(i.nodeName==="B"){i=i.parentNode}if(f.$highlight!==null){f.$highlight.removeClass("GH_highlight")}f.highlight=f.results.index(i);f.$highlight=a(i).addClass("GH_highlight")},selectSuggestion:function(j){j.preventDefault();if(j!==undefined&&j.type==="click"){var i=j.target;if(i.nodeName==="B"){i=i.parentNode}g.$input.val(a(i).text())}g.$input.val(a.trim(g.$input.val()));if(g.$input.val()!==""&&g.$input.val()!==f.ghostText){g.form.submit()}},getSuggestions:function(j){var i=e.apiUrl+"&"+e.apiQueryParam+"="+j;a.ajax({dataType:"jsonp",url:i,jsonp:"cb",success:function(k){b.displaySuggestions(k)},error:function(){b.displaySuggestions()}})},suspendBlurDetection:function(){g.$input.unbind("blur.GH")},resumeBlurDetection:function(){g.$input.bind("blur.GH",function(i){b.processInputBlur(i)})},displaySuggestions:function(p){f.highlight=-1;f.$highlight=null;if(p!==undefined&&p[1].length>0){f.query=p[0];var o=p[1],j=a("<ul />"),m,k=o.length,n=new RegExp(f.query,"i"),q="<b>"+f.query+"</b>";for(m=0;m<k;m++){a("<li />").html(o[m].replace(n,q)).appendTo(j)}f.results=j.find("li");g.$output.empty().append(j).fadeIn("fast")}else{f.query="";f.results=[];g.$output.fadeOut("fast").empty()}}};a.extend(true,e,c,d);a.extend(true,b,e.fn);b.init(h);return h}})(jQuery);

(function(a){a.fn.globalFooter=function(d){var c={activeTab:null,moreLinks:[],morePromoCount:2,moreText:"You might also like:",uiHat:"#GF_hat",uiHatLinks:"#GF_hat_links",uiHatTools:"#GF_hat_tools",uiNavLi:"li.GF_nav_LI",uiNavADd:".GF_nav_dd_A",auth:{doAuth:false,authenticated:false,authState:null,unauthState:null},search:{uiSearch:"#GF_search",params:{initOnDemand:true}},fn:{}},e={},i=this,h={},f={activeTab:null,moreLinksBuilt:false},g=e.fn||{},b={init:function(j){h.$c=a(j);h.hat=a(e.uiHat)[0];h.hatLinks=a(e.uiHatLinks)[0];h.$hatTools=a(e.uiHatTools);h.$search=a(e.search.uiSearch);h.$searchInput=h.$search.find("input:first");h.$searchSubmit=h.$search.find("input:last");h.$navLi=h.$c.find(e.uiNavLi);h.$navADd=h.$c.find(e.uiNavADd);b.setActiveTab(null,e.activeTab);(e.auth.doAuth)?b.buildAuth():false;b.buildMoreLinks();b.buildDropDowns();h.$c.bind("setActiveTab",b.setActiveTab);h.$searchInput.bind("focus.GF",b.buildSearch).attr("autocomplete","off");h.$searchSubmit.bind("mouseover.GF",b.buildSearch)},getVars:function(){return{options:e,ui:h,local:f}},buildSearch:function(j){h.$searchInput.unbind("focus.GF");h.$searchSubmit.unbind("mouseover.GF");if(j.target===h.$searchInput[0]){h.$searchInput.addClass("GF_search_active").attr("value","")}h.$search.globalSearchBoxFooter(e.search.params)},buildAuth:function(){if(e.auth.authenticated){h.$hatTools.append(e.auth.authState)}else{h.$hatTools.append(e.auth.unauthState)}},buildMoreLinks:function(){var o=e.moreLinks,m=0,j=o.length;if(j>=e.morePromoCount){var n,k=a("<li />").addClass("GF_hat_LI").append(n=a("<ul />").attr("id","GF_hat_more").addClass("GF_hat_UL").append(a("<li />").addClass("GF_hat_LI").text(e.moreText+"\xa0 ")));for(;m<e.morePromoCount;m++){n.append(a("<li />").addClass("GF_hat_LI").append(a("<a />").attr({href:o[m][1],target:(o[m][2]!==undefined)?o[m][2]:"_self"}).addClass("GF_hat_A GF_hat_more_A").text(o[m][0])).append((m<e.morePromoCount-1)?",\xa0":""))}if(j>e.morePromoCount){n.append(a("<li />").addClass("GF_hat_LI").append("\xa0and\xa0").append(a("<a />").attr({id:"GF_hat_more_link",href:"#"}).addClass("GF_hat_A GF_hat_more_A").text("More").bind("click.GF",b.toggleMoreLinks)))}k.appendTo(h.hatLinks)}},toggleMoreLinks:function(p){p.preventDefault();if(f.moreLinksBuilt===false){var n=e.moreLinks.slice(e.morePromoCount),o=0,m=n.length,j=Math.ceil(m/3),k=Math.ceil(m/3*2),s,r,q,t;h.$hatMoreList=a("<div />").attr("id","GF_more_list").append(a("<b />").attr("id","GF_more_list_lab").text("More Sites You Might Like")).append(s=a("<ul />").addClass("GF_more_list_UL")).append(r=a("<ul />").addClass("GF_more_list_UL")).append(q=a("<ul />").addClass("GF_more_list_UL"));for(;o<m;o++){t=a("<li />").append(a("<a />").attr({href:n[o][1],target:(n[o][2]!==undefined)?n[o][2]:"_self"}).text(n[o][0]));if(o<j){t.appendTo(s)}else{if(o<k){t.appendTo(r)}else{t.appendTo(q)}}}h.$hatMoreList.appendTo(h.hat);f.moreLinksBuilt=true}if(h.$hatMoreList.css("display")==="none"){h.$hatMoreList.fadeIn("fast")}else{h.$hatMoreList.fadeOut("fast")}return false},setActiveTab:function(k,j){if(j!==null){if(f.activeTab!==null){f.activeTab.removeClass("GF_nav_act")}f.activeTab=h.$navLi.eq(j).addClass("GF_nav_act")}},buildDropDowns:function(){h.$navLi.each(function(){var j=a(this);if(j.hasClass("GF_nav_list")){j.mouseover(function(){if(j.showtimer){clearInterval(j.showtimer);j.showtimer=null}j.addClass("GF_nav_list_open").find("ul").fadeIn("fast")}).mouseout(function(){j.showtimer=setTimeout(function(){if(j.showtimer){clearInterval(j.showtimer);j.showtimer=null}j.removeClass("GF_nav_list_open").find("ul").fadeOut("fast")},250)})}})}};a.extend(true,b,g);a.extend(true,e,c,d);b.init(i);return i}})(jQuery);
(function(a){a.fn.globalSearchBoxFooter=function(d){var c={apiUrl:"http://autocomplete.search.aol.com/autocomplete/get",apiIt:"ops-test",apiOutput:"json",apiCount:8,apiQueryParam:"q",ui_form:"#GF_search_form",ui_input:"#GF_search_field",ui_submit:"#GF_search_button",ui_output:"#GF_search_results",initOnDemand:false,initSmartSearch:true,fn:{}},e={},i=this,h={},f={ghostText:"",query:"",results:[],highlight:-1,$highlight:null,timer:null},g=e.fn||{},b={init:function(j){h.$c=a(j);h.form=a(e.ui_form)[0];h.input=a(e.ui_input)[0];h.submit=a(e.ui_submit)[0];h.output=a(e.ui_output)[0];f.ghostText=h.input.value;a(h.input).attr("autocomplete","off").bind("focus.GF",b.processInputFocus).bind("blur.GF",b.processInputBlur);a(h.form).bind("submit.GF",b.selectSuggestion);if(e.initSmartSearch){a(h.input).bind("keyup.GF",b.processKeyPress);a(h.output).bind("mouseover.GF",b.moveHighlightMouse).bind("mouseover.GF",b.suspendBlurDetection).bind("mouseout.GF",b.resumeBlurDetection).bind("click.GF",b.selectSuggestion)}},getVars:function(){return{options:e,ui:h,local:f}},processInputFocus:function(j){a(h.input).addClass("GF_search_active").attr("value","")},processInputBlur:function(j){a(h.input).removeClass("GF_search_active").attr("value",(h.input.value==="")?f.ghostText:h.input.value);b.displaySuggestions()},processKeyPress:function(n){var l=n.keyCode;if(l===38){b.moveHighlightKey(-1)}else{if(l===40){b.moveHighlightKey(1)}else{var j=n.target,m=a.trim(j.value);if(m!==""){if(f.timer!==null){clearTimeout(f.timer)}var k=(function(){f.timer=null;b.getSuggestions(m)});f.timer=setTimeout(function(){b.getSuggestions(m)},200)}else{b.displaySuggestions()}}}},moveHighlightKey:function(j){if(f.$highlight!==null){f.$highlight.removeClass("GF_highlight")}f.highlight=f.highlight+j;if(f.highlight>=f.results.length||f.highlight===-1){f.highlight=-1;h.input.value=f.query}else{if(f.highlight<-1){f.highlight=f.results.length-1}}if(f.highlight>-1){f.$highlight=a(f.results[f.highlight]);f.$highlight.addClass("GF_highlight");h.input.value=f.$highlight.text()}},moveHighlightMouse:function(k){var j=k.target;if(j.nodeName==="B"){j=j.parentNode}if(f.$highlight!==null){f.$highlight.removeClass("GF_highlight")}f.highlight=f.results.index(j);f.$highlight=a(j).addClass("GF_highlight")},selectSuggestion:function(k){k.preventDefault();if(k!==undefined&&k.type==="click"){var j=k.target;if(j.nodeName==="B"){j=j.parentNode}h.input.value=a(j).text()}if(h.input.value!==""&&h.input.value!==f.ghostText){h.form.submit()}},getSuggestions:function(k){var j=e.apiUrl+"?it="+e.apiIt+"&count="+e.apiCount+"&output="+e.apiOutput+"&"+e.apiQueryParam+"="+k;a.ajax({dataType:"jsonp",url:j,jsonp:"cb",success:function(l){b.displaySuggestions(l)},error:function(){b.displaySuggestions()}})},suspendBlurDetection:function(){a(h.input).unbind("blur.GF")},resumeBlurDetection:function(){a(h.input).bind("blur.GF",function(j){b.displaySuggestions()});h.input.focus()},displaySuggestions:function(q){f.highlight=-1;f.$highlight=null;if(q!==undefined&&q[1].length>0){f.query=q[0];var p=q[1],j=a("<ul />"),n,k=p.length,o=new RegExp(f.query,"i"),r="<b>"+f.query+"</b>";for(n=0;n<k;n++){var m=a("<li />").html(p[n].replace(o,r)).appendTo(j)}f.results=j.find("li");a(h.output).empty().append(j).fadeIn("fast")}else{f.query="";f.results=[];a(h.output).fadeOut("fast").empty()}}};a.extend(true,b,g);a.extend(true,e,c,d);b.init(i);return i}})(jQuery);


  $(document).ready(function() {


  	$('#GH_').globalHeader({
  		activeTab : -1,
  		moreLinks : 
  			[['AOL Health', 'http://www.aolhealth.com'],
			["That's Fit",'http://www.thatsfit.com/'],
			['AisleDash','http://www.aisledash.com/'],
			['AOL Horoscopes','http://horoscopes.aol.com/'],
			['DIY Life','http://www.diylife.com/'],
			['Green Daily','http://www.greendaily.com/'],
			['Holidash','http://www.holidash.com/'],
			['Food','http://food.aol.com/'],
			['Lemondrop','http://www.lemondrop.com/'],
			['Morning Rush','http://www.morningrush.com/'],
			['Pawnation','http://www.pawnation.com/'],			
			['Shelterpop','http://www.shelterpop.com/'],
			['Slashfood','http://www.slashfood.com/'],
			['StyleList','http://www.stylelist.com/']],					
  		auth : {
  			
  		}			
  	});
  	$('#GH_').globalFooter({});
  	$('#GH_search_form, #GF_search_form').attr('action','http://www.parentdish.com/search/');
	$('#GH_search_field, #GF_search_field').attr('name','q');


  });
  /* end global  header/footer js code */
