function AirpackContest() {
	this.messageId = 'welcome';
}
AirpackContest.prototype = new DowWidget;

AirpackContest.prototype.postInit = function() {
	this.bindEvent(document.getElementById(this.messageId),"dblclick","dblclickAction");
}

AirpackContest.prototype.dblclickAction = function(event) {
	gWidgets[this.messageId].do_edit();
}

AirpackContest.prototype.on_upload = function(who) {
	gWidgets.image_editor.startEditing(this,"10px","10px");
	swfu.browse();
}

AirpackContest.prototype.setImageData = function(thumb_src , zoom_src) {
	var containerElem = document.getElementById("uploaded_image");
	while (containerElem.firstChild) {
		containerElem.removeChild(containerElem.firstChild);
	}
	var imgElem = document.createElement("img");
	imgElem.src = thumb_src;
	containerElem.appendChild(imgElem);
	
	//this.enterContest(thumb_src , zoom_src);
}

AirpackContest.prototype.enterContest = function(thumb_src , zoom_src) {
	var action = this.createEmptyAction("appendGenericXML");
	action.setAttribute("what_key","entry");
	var doc = action.ownerDocument;
	var imageElem = doc.createElement("dow_image");
	imageElem.setAttribute("thumb_src", thumb_src );
	imageElem.setAttribute("zoom_src", zoom_src );
	action.appendChild(imageElem);
	this.sendAction(action.ownerDocument, "receiveAppend");
}

AirpackContest.prototype.removeContest = function(pkid) {
	var action = this.createEmptyAction("removeGenericXML");
	action.setAttribute("what_key","entry");
	action.setAttribute("pkid",pkid);
	this.sendAction(action.ownerDocument, "receiveDelete");
}

AirpackContest.prototype.receiveDelete = function(response) {
	window.location.reload();
	return true;
}

AirpackContest.prototype.receiveAppend = function(response) {
	window.location.reload();
	return true;
}

AirpackContest.prototype.on_delete = function(who) {
	var pkid = who.uid.substring("delete_".length);
	this.removeContest(pkid);
}

AirpackContest.prototype.on_load = function (who) {
	//nothing (from images)
}

AirpackContest.prototype.on_zoom = function (who) {
	var entryElem = this.findParent(who.getWidgetElement(), "DIV" , "entry");
	var zoomSrcElem = this.findElement(entryElem , "DIV" , "zoom_src");
	var zoomSrc = this.getTextValue(zoomSrcElem);
	gWidgets.zoomed_image.showZoom(zoomSrc);
}

AirpackContest.prototype.on_willselect = function (who) {
}

AirpackContest.prototype.on_hasselected = function (who) {
}


//*****





