/**
 * TweetPhoto - http://tweetphoto.com
 * Copyright (C) 2010 TweetPhoto
 * Author: John Eisberg (john@tweetphoto.com)
 *
 * V 1.4 TweetPhoto photo widget
 * http://tweetphoto.com/widget
 */
var TPprofileJSON=null;var TPphotoJSON=null;var TPretry=0;var TPretries=10;var TPcolor=null;function TPinit(user_id,count,color){TPcolor=color;TPjsonpSearch('http://tweetphotoapi.com/api/TPAPI.svc/jsonp/users/'+user_id+'?','TPhandleProfileData',0);TPjsonpSearch('http://tweetphotoapi.com/api/TPAPI.svc/jsonp/users/'+user_id+'/photos?ps='+count,'TPhandlePhotoData',1);TPrender();}function TPjsonpSearch(url,callback,index){var head=document.getElementsByTagName('head');var scriptElement=document.createElement('script');scriptElement.type='text/javascript';scriptElement.src=url+'&callback='+callback;scriptElement.id='TPjsonp_'+index;head[0].appendChild(scriptElement);}function TPhandleProfileData(data){TPprofileJSON=data;}function TPhandlePhotoData(data){TPphotoJSON=data;}function TPclean(index){var script=document.getElementById('TPjsonp_'+index);if(script){for(var property in script){if(property){delete script[property];}}var parent=script.parentNode;for(i=0;i<parent.children.length;i++){if(parent.children[i].id=='TPjsonp_'+index){delete parent.children[i];}}}}function TPrender(){if(TPprofileJSON&&TPphotoJSON){TPdraw(TPprofileJSON,TPphotoJSON);}else{if(TPretry++<TPretries){setTimeout('TPrender()',1000);}}}function TPdraw(profileData,photoData){var widget=document.getElementById('TPwidget');var widgetHtml='<div style="width:265px;font-size:12px;color:#333333;font-family:Arial,Helvetica,Sans-Serif;line-height:1.231em;">';widgetHtml+='';widgetHtml+='<div style="border-right-style:solid;border-right-width:3px;border-left-style:solid;border-left-width:3px;padding:5px 5px 6px 5px;border-left-color:'+TPcolor+';border-right-color:'+TPcolor+';">';widgetHtml+='<ul style="position:relative;margin:0px;padding:0px;list-style-image:none !important;list-style-position:outside !important;list-style-type:none !important;overflow:hidden !important;">';var photos=photoData.List;for(i=0;i<photos.length;i++){if((i%3)==0){widgetHtml+=TPinsertPhoto(photos[i],false);}else{widgetHtml+=TPinsertPhoto(photos[i],true);}}widgetHtml+='</ul>';widgetHtml+='</div></div>';widget.innerHTML=widgetHtml;}function TPinsertPhoto(photo,odd){var li='<li';if(odd){li=li+' style="padding:5px 6px 6px 5px;float:left;margin:0px;position:relative;">';}else{li=li+' style="float:left;padding:5px 6px 6px 5px;margin:0px;position:relative;">';}return li+'<a href="http://tweetphoto.com/'+photo['Id']+'" target="_blank"><img style="height:69px;width:69px;border:none;" align="top" alt="" src="'+photo['ThumbnailUrl']+'"/></a></li>';}