TreesCarousel=function(a){this.init(a);initHover()};TreesCarousel.prototype={init:function(a){this.ajaxHandler=a.ajaxHandler;this.ajaxParams=a.ajaxParams!=undefined?a.ajaxParams:"";this.treeId=a.treeId;this.personId=a.personId;this.userId=a.userId;this.userName=a.userName;this.ancestryDomain=a.ancestryDomain;this.treesDomain=a.treesDomain;this.currPgArgs=a.currPgArgs;this.rightArrow=a.rightArrow;this.rightArrowDisabled=a.rightArrowDisabled;this.leftArrow=a.leftArrow;this.leftArrowDisabled=a.leftArrowDisabled;this.audioIcon=a.audioIcon;this.showTitle=a.showTitle;this.addPhotoImg=a.addPhotoImg;this.addPhotoUrl=a.addPhotoUrl;this.viewId=a.viewId;this.isReadonly=a.isReadonly;this.totalCount=a.totalCount;this.useIndex=a.useIndex!=undefined?a.useIndex:true},loadInitialAudioAjax:function(b,a){alert("here");var d=a[0];var c=a[1];ajaxFetchItems(this,d,c,"audio")}};var loadInitialPhotosAjax=function(c,a){var b=photoTreesCarousel.totalCount;if(photoTreesCarousel.addPhotoUrl!=undefined&&photoTreesCarousel.addPhotoUrl.length>0){var d=this.cfg.getProperty("numVisible");if(b<d){b++}}loadInitialAjax(this,c,a,"photo",b)};var loadNextPhotosAjax=function(b,a){loadAjax(this,b,a,"photo")};var loadPrevPhotosAjax=function(b,a){loadAjax(this,b,a,"photo")};var loadInitialAudioAjax=function(b,a){loadInitialAjax(this,b,a,"audio",audioTreesCarousel.totalCount)};var loadNextAudioAjax=function(b,a){loadAjax(this,b,a,"audio")};var loadPrevAudioAjax=function(b,a){loadAjax(this,b,a,"audio")};var loadInitialVideoAjax=function(b,a){loadInitialAjax(this,b,a,"video",videoTreesCarousel.totalCount)};var loadNextVideoAjax=function(b,a){loadAjax(this,b,a,"video")};var loadPrevVideoAjax=function(b,a){loadAjax(this,b,a,"video")};var loadInitialAjax=function(e,b,a,f,d){var g=a[0];var c=a[1];ajaxFetchItems(e,g,c,f);e.cfg.setProperty("size",parseInt(d),true)};var loadAjax=function(e,b,a,f){var g=a[0];var c=a[1];var d=a[2];if(!d){ajaxFetchItems(e,g,c,f)}};var ajaxFetchItems=function(f,h,d,b){var e=f.cfg.getProperty("numVisible");var a=e;var c="";switch(b){case"photo":c="/"+photoTreesCarousel.ajaxHandler+"?typ=ph&tid="+photoTreesCarousel.treeId+"&pid="+photoTreesCarousel.personId+"&uid="+photoTreesCarousel.userId+"&unm="+photoTreesCarousel.userName+"&beg="+h+"&num="+a+photoTreesCarousel.ajaxParams;if(photoTreesCarousel.addPhotoImg!=undefined&&photoTreesCarousel.isReadonly!=true){c+="&addi=1&sz="+f.cfg.getProperty("numVisible")}if(photoTreesCarousel.viewId!=undefined){c+="&vid="+photoTreesCarousel.viewId}break;case"audio":c="/"+audioTreesCarousel.ajaxHandler+"?typ=au&tid="+audioTreesCarousel.treeId+"&pid="+audioTreesCarousel.personId+"&uid="+audioTreesCarousel.userId+"&unm="+audioTreesCarousel.userName+"&beg="+h+"&num="+a+photoTreesCarousel.ajaxParams;break;case"video":c="/"+videoTreesCarousel.ajaxHandler+"?typ=vi&tid="+videoTreesCarousel.treeId+"&pid="+videoTreesCarousel.personId+"&uid="+videoTreesCarousel.userId+"&unm="+videoTreesCarousel.userName+"&beg="+h+"&num="+a+photoTreesCarousel.ajaxParams;break}var g={success:handleSuccess,failure:handleFailure,argument:[h,d,f]};YAHOO.util.Connect.asyncRequest("GET",c,g,null)};var handleSuccess=function(callbackResponse){var start=callbackResponse.argument[0];var last=callbackResponse.argument[1];var carousel=callbackResponse.argument[2];if(callbackResponse.responseText!=undefined){var res=eval("("+callbackResponse.responseText+")");var hoverArray=hoverInfoArray;var itemsInList=0;for(var i=0;i<res.whatsnew.objects.length;i++){var item=res.whatsnew.objects[i];var x=parseInt(start)+i;carousel.addItem(x,fmtInnerHTML(x,item.type,item.name,item.tid,item.pid,item.oid,item.url));switch(item.type){case"audio":hoverArray=hoverAudioArray;break;case"video":hoverArray=hoverVideoArray;break;case"photo":default:hoverArray=hoverInfoArray;break}hoverArray[x]=item;itemsInList++}showButtons(carousel)}};var handleFailure=function(a){};var addHoverInfo=function(a,e,d,b){var c={name:e,desc:d,addedby:b};hoverInfoArray[a]=c};var fmtInnerHTML=function(m,h,a,f,g,d,b){var e="/pt/ViewPhoto.aspx";var k="";var n="thumb";switch(h){case"image":var l="";if(d==undefined){if(photoTreesCarousel.addPhotoUrl!=undefined){e=photoTreesCarousel.addPhotoUrl}else{e="/pt/UploadPhoto.aspx"}b=photoTreesCarousel.addPhotoImg}else{e="/pt/ViewPhoto.aspx";l="&oid="+d}k="http://"+photoTreesCarousel.treesDomain+e+"?tid="+f+"&pid="+g+l+photoTreesCarousel.currPgArgs;if(photoTreesCarousel.useIndex){k+="&idx="+m}if(photoTreesCarousel.viewId!=undefined){k+="&vid="+photoTreesCarousel.viewId}break;case"audio":e="/pt/ViewAudio.aspx";k="http://"+audioTreesCarousel.treesDomain+e+"?tid="+f+"&pid="+g+"&oid="+d+audioTreesCarousel.currPgArgs;b=audioTreesCarousel.audioIcon;n="thumbAudio";break;case"video":e="/pt/Video/ViewVideo.aspx";k="http://"+videoTreesCarousel.treesDomain+e+"?tid="+f+"&pid="+g+"&oid="+d+videoTreesCarousel.currPgArgs;break;case"story":e="/pt/ViewStory.aspx";break;case"record":e="/pt/ViewRecordRedir.aspx";break}var i='<a class="'+n+'" href="'+k+'"><img onmouseover="javascript:onHover(\''+h+"', this, '"+m+'\');javscript:clearHoverboxTimer();" onmouseout="javscript:hoverboxTimeout();" src="'+b+'" /></a>';var c="";if(photoTreesCarousel.showTitle){var j=a;if(j.length>32){j=j.substring(0,29)+"..."}c='<span class="thumb-title">'+j+"</span>"}return i+c};var handlePrevPhotosButtonState=function(c,a){var b=a[0];var d=a[1];if(photoTreesCarousel!=null&&d!=null){if(b){d.src=photoTreesCarousel.leftArrow;d.className="left-button-image"}else{d.src=photoTreesCarousel.leftArrowDisabled;d.className="left-button-inactive"}}};var handleNextPhotosButtonState=function(d,b){var c=b[0];var a=b[1];if(photoTreesCarousel!=null){if(c){a.src=photoTreesCarousel.rightArrow;a.className="right-button-image"}else{a.src=photoTreesCarousel.rightArrowDisabled;a.className="right-button-inactive"}}};var handlePrevAudioButtonState=function(c,a){var b=a[0];var d=a[1];if(audioTreesCarousel!=null&&d!=null){if(b){d.src=audioTreesCarousel.leftArrow;d.className="left-button-image"}else{d.src=audioTreesCarousel.leftArrowDisabled;d.className="left-button-inactive"}}};var handleNextAudioButtonState=function(d,b){var c=b[0];var a=b[1];if(audioTreesCarousel!=null){if(c){a.src=audioTreesCarousel.rightArrow;a.className="right-button-image"}else{a.src=audioTreesCarousel.rightArrowDisabled;a.className="right-button-inactive"}}};var handlePrevVideoButtonState=function(c,a){var b=a[0];var d=a[1];if(videoTreesCarousel!=null&&d!=null){if(b){d.src=videoTreesCarousel.leftArrow;d.className="left-button-image"}else{d.src=videoTreesCarousel.leftArrowDisabled;d.className="left-button-inactive"}}};var handleNextVideoButtonState=function(d,b){var c=b[0];var a=b[1];if(videoTreesCarousel!=null){if(c){a.src=videoTreesCarousel.rightArrow;a.className="right-button-image"}else{a.src=videoTreesCarousel.rightArrowDisabled;a.className="right-button-inactive"}}};var showButtons=function(e){var b=e.cfg.getProperty("nextElement");var a=e.cfg.getProperty("prevElement");var d=e.cfg.getProperty("size");var c=e.cfg.getProperty("numVisible");if(d<=c){YAHOO.util.Dom.setStyle(b,"visibility","hidden");YAHOO.util.Dom.setStyle(a,"visibility","hidden")}else{YAHOO.util.Dom.setStyle(b,"visibility","visible");YAHOO.util.Dom.setStyle(a,"visibility","visible")}};