function Thread(a){this.id=a.id;this.createdDatetime=a.createdDatetime;this.lastPostDatetime=a.lastPostDatetime;this.messages=a.messages;this.country=a.country;this.province=a.province;this.town=a.town;this.camping=a.camping;this.campingUin=a.campingUin;this.hostels=a.hostels;this.hostelUin=a.hostelUin;this.hostelAffiliate=a.hostelAffiliate;this.restaurants=a.restaurants;this.restaurantUin=a.restaurantUin;this.nightlife=a.nightlife;this.nightlifeUin=a.nightlifeUin;this.attractions=a.attractions;this.attractionUin=a.attractionUin;this.productCategory=a.productCategory;this.productSubcategory=a.productSubcategory;this.productBrand=a.productBrand;this.productCode=a.productCode;this.name=a.name;this.getId=function(){return this.id};this.getCreatedDatetime=function(){return this.createdDatetime};this.getLastPostDatetime=function(){return this.lastPostDatetime};this.getThreadMessages=function(){return this.messages};this.addThreadMessage=function(c){var b="/cgi-bin/ajax/addthreadmessage.pl?thread_id="+this.id+"&user_id="+c.userId+"&password="+c.password+"&password_crypt="+c.password_crypt+"&message="+encodeURIComponent(c.message);var d=this;jQuery.ajax({type:"GET",url:b,success:function(e){if(""==e||null==e){c.failureCallback()}else{var f=new ThreadMessage(e);d.messages.push(f);c.callback(f)}}})}}Thread.getThreads=function(b){var a="/cgi-bin/ajax/getthreads.pl?country="+encodeURIComponent(b.country?b.country:"")+"&province="+encodeURIComponent(b.province?b.province:"")+"&town="+encodeURIComponent(b.town?b.town:"")+"&camping="+(b.camping?1:"")+"&camping_uin="+(b.camping_uin?b.camping_uin:"")+"&hostels="+(b.hostels?1:"")+"&hostel_uin="+(b.hostel_uin?b.hostel_uin:"")+"&restaurants="+(b.restaurants?1:"")+"&restaurant_uin="+(b.restaurant_uin?b.restaurant_uin:"")+"&nightlife="+(b.nightlife?1:"")+"&nightlife_uin="+(b.nightlife_uin?b.nightlife_uin:"")+"&attractions="+(b.attractions?1:"")+"&attraction_uin="+(b.attraction_uin?b.attraction_uin:"")+"&product_category="+encodeURIComponent(b.productcategory?b.productcategory:"")+"&product_subcategory="+encodeURIComponent(b.productsubcategory?b.productsubcategory:"")+"&product_brand="+encodeURIComponent(b.productbrand?b.productbrand:"")+"&product="+(b.product?b.product:"")+"&max_threads="+(b.maxThreads?b.maxThreads:"")+"&start_from="+(b.startFrom?b.startFrom:"")+"&posts_since="+(b.postsSince?b.postsSince:"")+"&created_user_id="+(b.createdUserId?b.createdUserId:"")+"&user_id="+(b.userId?b.userId:"");jQuery.ajax({type:"GET",url:a,success:function(f){if(""==f||null==f){b.noThreadsCallback()}else{var g=new Array();var e=f;for(var d=0;d<e.length;d++){for(var c=0;c<e[d].messages.length;c++){e[d].messages[c]=new ThreadMessage(e[d].messages[c])}g[d]=new Thread(e[d])}b.callback(g)}}})};Thread.createThread=function(b){var a="/cgi-bin/ajax/createthread.pl?country="+encodeURIComponent(b.country?b.country:"")+"&province="+encodeURIComponent(b.province?b.province:"")+"&town="+encodeURIComponent(b.town?b.town:"")+"&camping="+(b.camping?1:"")+"&camping_uin="+(b.campingUin?b.campingUin:"")+"&hostels="+(b.hostels?1:"")+"&hostel_uin="+(b.hostelUin?b.hostelUin:"")+"&hostel_affiliate="+(b.hostelAffiliate?b.hostelAffiliate:"")+"&restaurants="+(b.restaurants?1:"")+"&restaurant_uin="+(b.restaurantUin?b.restaurantUin:"")+"&nightlife="+(b.nightlife?1:"")+"&nightlife_uin="+(b.nightlifeUin?b.nightlifeUin:"")+"&attractions="+(b.attractions?1:"")+"&attraction_uin="+(b.attractionUin?b.attractionUin:"")+"&product_category="+encodeURIComponent(b.productCategory?b.productCategory:"")+"&product_subcategory="+encodeURIComponent(b.productSubcategory?b.productSubcategory:"")+"&product_brand="+encodeURIComponent(b.productBrand?b.productBrand:"")+"&product="+(b.productCode?b.productCode:"")+"&user_id="+b.userId+"&password="+b.password+"&password_crypt="+b.passwordCrypt+"&message="+encodeURIComponent(b.message);jQuery.ajax({type:"GET",url:a,success:function(e){if(""==e||null==e){b.failureCallback()}else{var d;var c=e;c.messages[0]=new ThreadMessage(c.messages[0]);d=new Thread(c);b.callback(d)}}})};function ThreadMessage(a){this.id=a.id;this.threadId=a.threadId;this.userId=a.userId;this.userName=a.userName;this.message=a.message;this.postDatetime=a.postDatetime;this.getUserId=function(){return this.userId};this.getUserName=function(){return this.userName};this.getMessage=function(){return this.message};this.getPostDatetime=function(){return this.postDatetime}};

