var qilroy=qilroy?qilroy:new Object();qilroy.plixi=new function(){var a={getPhotos:function(d,c,e,g,b){var f="http://tweetphotoapi.com/api/tpapi.svc/jsonp/photos?lat="+d+"&lon="+c+"&dist="+5000+"&getuser=true&ps=20";debugOut("getting plixi photos: "+f);$j.ajax({type:"GET",url:f,cache:false,dataType:"jsonp",success:function(h){if(g){g(h.List)}},error:function(h){debugOut("error getting plixi");if(b){b()}}})},seedPhotos:function(f,i,b){var h=0;var g=qilroy.location.postLat;var d=qilroy.location.postLong;var c=qilroy.location.postLocationId;var e=qilroy.location.postAddress;qilroy.plixi.getPhotos(g,d,h,function(j){qilroy.plixi.storePhotos(j,g,d,c,e,function(k){if(i){i(k)}},function(k){if(b){b(k)}})},function(j){if(b){b()}})},loadPhotos:function(e,g,b,c){var f=qilroy.location.postLat;var d=qilroy.location.postLong;qilroy.plixi.getPhotos(f,d,0,function(h){qilroy.plixi.convertPhohtos(h,function(i){$j(e).append(html);if(g){g()}},function(i){if(b){b(i)}},c)},function(h){if(b){b()}})},storePhotos:function(i,c,h,j,f,g,e){if(i&&i.length>0){var d=qilroy.appContext+"/post/storePlixi";var b=new Object();b.photos=$j.toJSON(i);b.postLat=c;b.postLong=h;b.postAddress=f;b.postLocationId=j;$j.ajax({type:"POST",url:d,cache:false,dataType:"json",data:b,success:function(k){if(g){g(k)}},error:function(k){debugOut("error: "+k)}})}else{debugOut("no tweets");if(g){g()}}},convertPhotos:function(g,f,c,d){var e=qilroy.appContext+"/post/convertPlixi";var b=new Object();b.photos=$j.toJSON(g);b.mobile=(d==true)?true:false;b=qilroy.location.addPostLocationParams(b);debugOut("storing: "+b);$j.ajax({type:"POST",url:e,cache:false,dataType:"html",data:b,success:function(h){if(f){f(h)}},error:function(h){if(c){c(h)}}})}};return a};
