function smartTrunc(targetDiv,maxHeight,defaultFontSize){if(!targetDiv){return;}
if(targetDiv&&targetDiv.scrollHeight&&targetDiv.scrollHeight>maxHeight){targetDiv.innerHTML=targetDiv.innerHTML+'...';while(targetDiv.scrollHeight>maxHeight&&targetDiv.innerHTML.length>3){targetDiv.innerHTML=targetDiv.innerHTML.substring(0,targetDiv.innerHTML.length-4)+'...';}}}
function favByObject(imageurl,userProfileId){this.imageurl=imageurl;this.loginId=userProfileId;this.itemHTML=getFavByItemHTML(imageurl,userProfileId);}
function getFavByItemHTML(url,loginName){var html='<a href=/users/'+loginName+'><img src="'+url+'" width="52" height="52" border="0" alt="" title="'+loginName+'"/></a>';return html;};function resizeHeader(image,width,height){if(image.width>width){image.style.width=width+"px";}
if(image.height>height){image.style.height=height+"px";}}
function changeExternalEmbedCode(vidBoxText){if(vidBoxText.indexOf("www.youtube.com")>1){if(vidBoxText.indexOf("wmode")<1){vidBoxText=vidBoxText.replace('allowfullscreen=','wmode="transparent" allowfullscreen=');}
if(vidBoxText.indexOf('height="344"')>1||vidBoxText.indexOf('width="425"')>1){vidBoxText=vidBoxText.replace(/height="344"/g,'height="386"');vidBoxText=vidBoxText.replace(/width="425"/g,'width="480"');}
if(vidBoxText.indexOf('height=344')>1||vidBoxText.indexOf('width=425')>1){vidBoxText=vidBoxText.replace(/height=344/g,'height=386');vidBoxText=vidBoxText.replace(/width=425/g,'width=480');}}
return vidBoxText;}
function fixExternalEmbedCode(){document.getElementById('videocontainer').innerHTML=changeExternalEmbedCode(document.getElementById('videocontainer').innerHTML);};var hoverDelay=200;var cancelDelay=200;var loadingTimer=500;var isHoverActive=true;var onfocusFunction=window.onfocus;window.onfocus=new Function("if(onfocusFunction != null) {eval('onfocusFunction');}isHoverActive = true;");window.onblur=new Function("isHoverActive = false;");var hoverDebug=false;var divWithMouse=null;var currentHoverOnTask=null;var currentHoverOffTask=null;var divWithActiveHover=null;var lastDivIdIn=null;var xOffsets=new Array();var yOffsets=new Array();var defaultMainDiv="header-myaccount";function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);}
return[curleft,curtop];}
function proposeDivForHover(mainDivId,xOff,yOff){var mainDiv=document.getElementById(mainDivId);if(!mainDiv){talert('mainDiv is null: '+mainDivId);}
if(divWithActiveHover&&mainDiv.id==divWithActiveHover.id){talert('not hovering (already on)');return;}
if(currentHoverOnTask!=null){clearTimeout(currentHoverOnTask);currentHoverOnTask=null;}
divWithMouse=mainDiv;currentHoverOnTask=setTimeout(function(){turnOnDivHover(mainDivId,xOff,yOff);},hoverDelay);}
function proposeCancelHover(mainDivId){var mainDiv=document.getElementById(mainDivId);if(!mainDiv){talert('mainDiv is null: '+mainDivId);}
if(mainDiv!=divWithActiveHover&&mainDiv!=divWithMouse){return;}
divWithMouse=mainDiv;currentHoverOffTask=setTimeout(function(){ifOutCancelHover(mainDivId);},cancelDelay);}
function ifOutCancelHover(mainDivId){turnOffDivHover(mainDivId);}
function turnOnDivHover(mainDivId,xOff,yOff){talert("beg hover on for "+mainDivId);var mainDiv=document.getElementById(mainDivId);if(!mainDiv){talert('mainDiv is null: '+mainDivId);return;}
if(divWithActiveHover){turnOffDivHover(divWithActiveHover.id);}else{talert('no active hover');}
divWithActiveHover=mainDiv;var hoverDiv=document.getElementById(mainDivId+'-hover');if(!hoverDiv){talert('no hoverDiv for divId '+mainDivId);return;}
var mainDivPos=findPos(mainDiv);hoverDiv.style.left=(mainDivPos[0]+xOff)+'px';hoverDiv.style.top=(mainDivPos[1]+yOff)+'px';hoverDiv.style.visibility='visible';var list1=document.getElementById("selectedFavListing-dashboard-widget");if(list1!=null&&mainDivId==defaultMainDiv){list1.style.visibility='visible';}
var list2=document.getElementById("selectedListing-dashboard-widget");if(list2!=null&&mainDivId==defaultMainDiv){list2.style.visibility='visible';}
var hoverHook=document.getElementById(mainDivId+'-hoverhook');if(hoverHook){hoverHook.focus();hoverHook.style.display='none';}
talert("end hover on for "+mainDivId);}
function turnOffDivHover(mainDivId){if(currentHoverOffTask!=null){clearTimeout(currentHoverOffTask);currentHoverOffTask=null;}
talert("hover off for "+mainDivId);var hoverDiv=document.getElementById(mainDivId+'-hover');if(!hoverDiv){talert('no hoverDiv for divId '+mainDivId);return;}
divWithActiveHover=null;hoverDiv.style.visibility='hidden';var list1=document.getElementById("selectedFavListing-dashboard-widget");if(list1!=null&&mainDivId==defaultMainDiv){list1.style.visibility='hidden';}
var list2=document.getElementById("selectedListing-dashboard-widget");if(list2!=null&&mainDivId==defaultMainDiv){list2.style.visibility='hidden';}}
function onMouseInHandler(mainDivId,xOff,yOff){if(!isHoverActive){}
if(xOff==null){xOff=18;}
if(yOff==null){yOff=18;}
lastDivIdIn=mainDivId;if(divWithActiveHover&&mainDivId==divWithActiveHover.id&&currentHoverOffTask!=null){clearTimeout(currentHoverOffTask);currentHoverOffTask=null;}
proposeDivForHover(mainDivId,xOff,yOff);}
function onMouseOutHandler(mainDivId){if(currentHoverOnTask!=null){clearTimeout(currentHoverOnTask);currentHoverOnTask=null;}
if(divWithActiveHover&&mainDivId==divWithActiveHover.id){proposeCancelHover(mainDivId);}else{talert('ignoring mouse out for '+mainDivId);}}
function talert(message){}
function setuphoverDebug(){if(hoverDebug){talertDiv=document.getElementById('talert');talertDiv.style.display="block";talertDiv.style.backgroundColor="white";talertDiv.style.border=2;talertDiv.style.position="absolute";talertDiv.style.top="1030px";talertDiv.style.left="400px";talert=new Function("message","var talertDiv =document.getElementById('talert'); talertDiv.innerHTML = message + '<br/>' + talertDiv.innerHTML;");thoverDebugDiv=document.getElementById('thoverDebug');thoverDebugDiv.style.display="block";thoverDebugDiv.style.backgroundColor="white";thoverDebugDiv.style.border=2;thoverDebugDiv.style.position="absolute";thoverDebugDiv.style.top="730px";thoverDebugDiv.style.left="400px";starthoverDebugOutput();}}
function starthoverDebugOutput(){thoverDebugDiv=document.getElementById('thoverDebug');var thoverDebugHtml='';thoverDebugHtml+='hoverDelay = '+hoverDelay+'<br/>';thoverDebugHtml+='cancelDelay = '+cancelDelay+'<br/>';thoverDebugHtml+='loadingTimer = '+loadingTimer+'<br/>';thoverDebugHtml+='divWithMouse = '+divWithMouse+'<br/>';thoverDebugHtml+='currentHoverOnTask = '+currentHoverOnTask+'<br/>';thoverDebugHtml+='currentHoverOffTask = '+currentHoverOffTask+'<br/>';thoverDebugHtml+='divWithActiveHover = '+divWithActiveHover+'<br/>';thoverDebugHtml+='lastDivIdIn = '+lastDivIdIn+'<br/>';thoverDebugHtml+='isHoverActive = '+isHoverActive+'<br/>';thoverDebugDiv.innerHTML=thoverDebugHtml;setTimeout('starthoverDebugOutput()',500);}