/*
 * DjengoWidget 0.3
 *
 * Copyright 2011 Djengo
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this work except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 */
(function(){DjengoWidget=function(a){this.init(a)};DjengoWidget.WIDGET_NUMBER=0;DjengoWidget.prototype=function(){var a="http://";var b="www.djengo.net";var c="/widget/";var d="v1";var e=c+d;var f=a+b;return{init:function(a){var b=this;this.event_id;this.locale;this._widgetNumber=++DjengoWidget.WIDGET_NUMBER;DjengoWidget["receiveCallback_"+this._widgetNumber]=function(a){b.display.call(b,a)};this._cb="DjengoWidget.receiveCallback_"+this._widgetNumber;this.params=a||{};this.id=this.params.id||"djengo-widget-container";return this},setEvent:function(a){this.event_id=a;return this},setLocale:function(a){this.locale=a;return this},get_url:function(){url=f;if(typeof this.locale!=="undefined"&&this.locale!==null){url+="/"+this.locale}url+=e;if(typeof this.event_id!=="undefined"&&this.event_id!==null){url+="/events/"+this.event_id}url+="?callback="+this._cb;return url},getJSONP:function(a,b){var c=document.createElement("script");var d=document.getElementsByTagName("head")[0];c.type="text/javascript";c.src=a;d.insertBefore(c,d.firstChild);b(c);return c},display:function(a){document.getElementById(this.id).innerHTML=a.html},start:function(){var a=this.get_url();this.getJSONP(a,function(a){});return this}}}()})()
