var TCApplication = {wsrurl:"/WebObjects/United.woa/1/wsr",wosid:null,l:function(k){if (TCApplication.loc && TCApplication.loc[k]) return TCApplication.loc[k]; else return '/'+k+'/';}};
function $tc_wosid() { if (TCApplication.wosid) {return "?"+TCApplication.wosid;} else {return "";} }
/** Start:app **/
var MessageManager = new function MessageManagerClass() {  
	var M = this;
			
	var T_FADE_IN = 0.35;
	var T_FADE_OUT = 0.5;
	var T_SHRINK = 0.25;
	var MAX_OPACITY = 1;
		
	function hasMessages() {
		return $$('div.message').length;
		return false;
	}
	
	
	this.init = function() { 
		// alert($$('div.message').length);
		
		if(Prototype.Browser.IE) {
			Event.stopObserving(window, "load", function() { MessageManager.init(); }); 
		}
		else {
			Event.stopObserving(document, "dom:loaded", function() { MessageManager.init(); });
		}

		$$('div.message').each(
			function(message) {
				Event.observe(message.select('a.close')[0], "click", M.hideMessage.bindAsEventListener(this, message));
				/* 
					new Effect.Opacity(message, { from: 0.0, to: MAX_OPACITY, duration: T_FADE_IN, 
						beforeSetup: function(){ message.setOpacity(0.0); message.style.visibility = 'visible'; }
					});
				*/
			}
		);
		
		try {
			$$('div.message')[0].scrollIntoView();
		} catch(e) {}
		
	};
	
	this.hideMessage  = function(_event, _message) {
	
		new Effect.Parallel([
				new Effect.Opacity(_message, {sync: true, from: MAX_OPACITY, to: 0.0 }),
				new Effect.BlindUp(_message, {sync: true, afterFinish: function() { _message.remove(); try { curvyCorners.redraw(); } catch(e) {} } })
			], { 
	  			duration: T_FADE_OUT,
  				queue: {scope:'messages', position:'front'}
  			});
	};
	
	this.hideMessages = function() {
		$$('div.message').each(function(message,index) {
			new Effect.Opacity(message, { from: MAX_OPACITY, to: 0.0, duration: T_FADE_OUT, afterFinish: function(){ message.hide(); }, queue: {scope:'messages', position:'front'} });
		});	
	};
	
	(function() { Event.observe(document, "dom:loaded", function() { MessageManager.init(); });	})();
}

function initInputHints() {
	
	$$('.hinted').each(
		function(element) {
			var label = element.select('label.hint')[0];
			var input = element.select('input')[0];
			
			if(input.present()) {
				label.hide();
			} 

			/* 
				element.observe('mouseover', _toggleVisability.bindAsEventListener(this, input, label));
				element.observe('mouseout', _toggleVisability.bindAsEventListener(this, input, label));
			*/	
			input.observe('focus', _toggleVisability.bindAsEventListener(this, input, label));
			input.observe('blur', _toggleVisability.bindAsEventListener(this, input, label));
			input.observe('keypress', _toggleVisability.bindAsEventListener(this, input, label));
			
		}		
	);

}


function _toggleVisability(event, pInput, pLabel) {
	
	
	if(event.type == "mouseover") {
		// pInput.focus();
	} 
	
	if(event.type == "focus" && pInput.present() || event.type == "keypress") {
			pLabel.hide();
	}
		
	if(event.type == "blur" /*  || event.type == "mouseout" */) {
		if(pInput.present()) {
			pLabel.hide();
		}
		else {
			pLabel.show();
		}
	}
}

function toggleVisability(_eId) {
	var T_FADE_IN = 0.35;
	var T_FADE_OUT = 0.5;
	var MAX_OPACITY = 1;
	
	var e = $(_eId);
	
	if(e == null) {
		return false;
	}
	
	var scaleFrom = 0;
	var scaleTo = 100;
	var duration = T_FADE_IN;
	var beforeSetup = (function(_e) { 
						return function() { 
								_e.show();
							}; 
						})(e);

	var afterFinish = (function(_e) { 
						return function() { 
								_e.show();
								try { curvyCorners.redraw(); } catch(ex) {}  
							}; 
						})(e);
	var opcityFrom = 0;
	var opacityTo = MAX_OPACITY;
	
	if(e.visible()) { 
		scaleFrom = 100;
		scaleTo = 0;
		duration = T_FADE_OUT;
		afterFinish = (function(_e) { 
						return function() { 
								_e.hide();
								try { curvyCorners.redraw(); } catch(ex) {}  
							}; 
						})(e);
		opcityFrom = MAX_OPACITY;
		opacityTo = 0;
		
	}	

		new Effect.Parallel([
				new Effect.Opacity(e, {sync: true, from: opcityFrom, to: opacityTo }),
				new Effect.BlindDown(e, {sync: true, scaleFrom:scaleFrom, scaleTo:scaleTo })
			], { 
	  			duration:duration,
	  		//	beforeSetup: beforeSetup, 
				afterFinish: afterFinish
  				//queue: {scope:'messages', position:'front'}
  			});
	
	return false;
}

Event.observe(document, "dom:loaded", function() { 
	initInputHints(); 
	try { 
		var loginForm = $('_lf'); 
		if(loginForm) { 
			loginForm.focusFirstElement()
		} 
	} catch(e) {} 
});

var PromoSlideshow = function(elementid, fxId, duration, navType) {
	this.duration = duration;
	this.navType = navType; 
	this.container = $(elementid).select(".slideShowContainer")[0];
	this.fxId = fxId;
	this.slides = this.container.select("li");
	this.slideCount = this.slides.size();
	this.current = this.slides.length-1;
	if (this.slideCount<=1) return; // no slide show if only one image
	var controlHTML = "<div class='control' style='display:none'>";
	if (navType==1) {
		controlHTML += "<a href='#back' rel='back' class='back'>&nbsp;</a><a href='#next' rel='next' class='next'>&nbsp;</a>";
	}
	else if (navType==2) {
		var slideCount = this.slideCount;
		this.slides.each(function(slide,index) {
			var linktext = slide.title;
			if (!linktext || linktext==="")
				linktext = slideCount-index;
			controlHTML += "<a href='#"+slide.title+"' class='item' rel='"+index+"'>"+linktext+"</a>";
		});
	}
	controlHTML += "</div>";
	this.container.insert(controlHTML ,{position: "bottom"});
	this.control = this.container.select('div.control')[0];
	Event.observe(this.container, "mouseover", this.over.bindAsEventListener(this));
	Event.observe(this.container, "mouseout", this.out.bindAsEventListener(this));
	Event.observe(this.container, "click", this.clickContent.bindAsEventListener(this));
	this.control.select('a').each(
		function(link) {  Event.observe(link, "click", this.clickNav.bindAsEventListener(this))  },
		this);
	this.start();
};

PromoSlideshow.prototype = {

	start: function() {
		this.timer = new PeriodicalExecuter(this.tick.bind(this), this.duration);	
	},
	
	pause: function() {
		this.timer.stop();
	},

	tick: function() {
		this.showNext();
	},
	
	currentSlide: function() {
		return this.slides[this.current];
	},
	
	nextSlide: function() {
		var index = 0;
		if (this.current==0) {
			index = this.slideCount - 1;
		}
		else {
			index = this.current - 1;
		}
		return this.slides[index];
	},
	
	prevSlide: function() {
		var index = 0;
		if (this.current==this.slideCount-1) {
			index = 0;
		}
		else {
			index = this.current + 1;
		}
		return this.slides[index];
	},
	
	showNext: function(instantly) {
		var currentSlide = this.currentSlide();
		
		if(this.navType==2)
			this.control.select('a')[this.current].className = 'item';
		
		var nextSlide = this.nextSlide();
		if (!instantly) {
			currentSlide.style.zIndex = 1;
			nextSlide.style.zIndex = 0;
			nextSlide.style.left = "0";
			nextSlide.show();
			switch (this.fxId) {
			case 1:
				new Effect.Move(currentSlide,{ x: -800, y: 0, mode: 'absolute', duration:1});
				break;
			case 2:
				new Effect.DropOut(currentSlide);
				break;
			default:
				new Effect.Fade(currentSlide);	
			}
		}
		else {
			nextSlide.style.left = "0";			
			currentSlide.hide();
			currentSlide.style.zIndex = 0;			
			nextSlide.style.zIndex = 1;
			nextSlide.show();			
		}
		this.current--;
		if (this.current<0) this.current = this.slideCount-1;
		
		if(this.navType==2)
			this.control.select('a')[this.current].className = 'item on';
	},
	
	showPrev: function() {
		var currentSlide = this.currentSlide();
		var prevSlide = this.prevSlide();
		currentSlide.hide();
		currentSlide.style.zIndex = 0;
		prevSlide.style.zIndex = 1;
		prevSlide.style.left = "0";
		prevSlide.show();
		this.current++;
		if (this.current==this.slideCount) this.current = 0;
	},
	
	showSlide: function(index) {
		var currentSlide = this.currentSlide();
		var newSlide = this.slides[index];

		currentSlide.hide();
		currentSlide.style.zIndex = 0;
		newSlide.style.zIndex = 1;
		newSlide.style.left = "0";
		newSlide.show();
		this.current = index;
	},
	
	over: function() {
		this.control.show();
		this.pause();
	},
	
	out: function() {
		this.control.hide();
		this.start();
	},
	
	clickContent: function() {
		var currentSlide = this.currentSlide();
		var link = currentSlide.getElementsByTagName("a")[0];
		if (link) {
			window.location.href = link.href;
		}
	},
	
	clickNav: function(e) {
		var direction = e.element().rel;
		if (direction=="next") {
			this.showNext(true);
		}
		else if (direction=="back") {
			this.showPrev();
		}
		else {
			this.control.select('a')[this.current].className = 'item';
			this.showSlide(direction);
			this.control.select('a')[this.current].className = 'item on';			
		}
		e.stop();
		e.element().blur();
	}
};
/** End:app **/
/** Start:UTDClubLeagueBrowser **/
var UTDClubLeagueBrowser={
				  
  selectLeagueContest: function() {
	  	
	var leagueBrowserForm = $("clubLeagueBrowserForm"); 
	var params=leagueBrowserForm.serialize(true);		
	params.action="selectLeagueContest";
	
	new Ajax.Updater("clubLeagueBrowserContainer", UTDClubLeagueBrowser.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );
	return false;
  },

  selectClubLeagueType: function(clubLeagueType) {
	  	
		var leagueBrowserForm = $("clubLeagueBrowserForm"); 
		var params=leagueBrowserForm.serialize(true);	
		params.clt=clubLeagueType;
		params.action="selectClubLeagueType";		
		new Ajax.Updater("clubLeagueBrowserContainer", UTDClubLeagueBrowser.contentURL,
	        {
	            method:"POST",
	            parameters: params,
	            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
	        }
	    );
		return false;
	  }
}
/** End:UTDClubLeagueBrowser **/
/** Start:UTDClubLeagueView **/
var UTDClubLeagueView={
		
  updateBatch: function(batchIndex) {
	//alert(batchIndex);
	if(!batchIndex) { 
		return false; 
	}
  	
	var userLeagueViewForm = $("clubLeagueViewForm"); 
	var params=userLeagueViewForm.serialize(true);
	params.batchIndex=batchIndex;
	params.action="updateBatch";
	new Ajax.Updater("clubLeagueViewContainer", UTDClubLeagueView.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );
	return false;
  }
}
/** End:UTDClubLeagueView **/
if (!UTDClubLeagueView) UTDClubLeagueView={};
UTDClubLeagueView.contentURL="/WebObjects/United.woa/ajax/UTDClubLeagueView"+$tc_wosid();
UTDClubLeagueView.dataURL="/WebObjects/United.woa/ajax/UTDClubLeagueView/data"+$tc_wosid();

/** Start:UTDLeagueBrowser **/
var UTDLeagueBrowser={
				  
  selectTab: function(leagueMemberType,leagueContest, clubLeagueType) {
	
	var leagueBrowserForm = $("leagueBrowserForm"); 
	var params=leagueBrowserForm.serialize(true);	
	//alert(leagueMemberType+":"+leagueContest+":"+clubLeagueType+"::"+params.lc) ;
	params.lmt=leagueMemberType;
	if (leagueContest){
		params.lc=leagueContest;
	}
	if (clubLeagueType){
		params.clt=clubLeagueType;
	}
	params.action="selectTab";
	
		
	new Ajax.Updater("leagueBrowserContainer", UTDLeagueBrowser.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );
	return false;
  },
  
  selectUserLeagueContest: function(leagueContest) {
	  	
	var leagueBrowserForm = $("leagueBrowserForm"); 
	var params=leagueBrowserForm.serialize(true);	
	params.lc=leagueContest;
	params.action="selectLeagueContest";
	
	new Ajax.Updater("leagueBrowserContainer", UTDLeagueBrowser.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );
	return false;
  },
  displayClubLeagueBrowser: function(displayClubLeagueBrowser) {	  		
	var leagueBrowserForm = $("leagueBrowserForm"); 
	var params=leagueBrowserForm.serialize(true);			
	params.action="displayClubLeagueBrowser";
	
	new Ajax.Updater("leagueBrowserContainer", UTDLeagueBrowser.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );	
	return false;
  }
		
}
/** End:UTDLeagueBrowser **/
if (!UTDLeagueBrowser) UTDLeagueBrowser={};
UTDLeagueBrowser.contentURL="/WebObjects/United.woa/ajax/UTDLeagueBrowser"+$tc_wosid();
UTDLeagueBrowser.dataURL="/WebObjects/United.woa/ajax/UTDLeagueBrowser/data"+$tc_wosid();

/** Start:UTDUserLeagueView **/
var UTDUserLeagueView={
		
  updateBatch: function(batchIndex) {
	//alert(batchIndex);
	if(!batchIndex) { 
		return false; 
	}
  	
	var userLeagueViewForm = $("userLeagueViewForm"); 
	var params=userLeagueViewForm.serialize(true);
	params.batchIndex=batchIndex;
	params.action="updateBatch";
	new Ajax.Updater("userLeagueViewContainer", UTDUserLeagueView.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );
	return false;
  },

  findUser: function(userId) {
	
	if(!userId) { 
		return false; 
	}      	
	var userLeagueViewForm = $("userLeagueViewForm"); 
	var params=userLeagueViewForm.serialize(true);	
	params.userId=userId;
	params.action="findUser";
	new Ajax.Updater("userLeagueViewContainer", UTDUserLeagueView.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );
	return false;
  }
		
}
/** End:UTDUserLeagueView **/
if (!UTDUserLeagueView) UTDUserLeagueView={};
UTDUserLeagueView.contentURL="/WebObjects/United.woa/ajax/UTDUserLeagueView"+$tc_wosid();
UTDUserLeagueView.dataURL="/WebObjects/United.woa/ajax/UTDUserLeagueView/data"+$tc_wosid();

/** Start:UTDWallPostView **/
var UTDWallPostView={
		
  updateBatch: function(batchIndex) {
	//alert(batchIndex);
	if(!batchIndex) { 
		return false; 
	}
  	
	var wallPostForm = $("wallPostForm"); 
	var params=wallPostForm.serialize(true);
	params.batchIndex=batchIndex;
	params.action="updateBatch";
	new Ajax.Updater("wallPostContainer", UTDWallPostView.contentURL,
        {
            method:"POST",
            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
        }
    );
	return false;
  },
  
  
  addWallPost: function() {
					
		var wallPostForm = $("wallPostForm"); 
		var params=wallPostForm.serialize(true);		
		params.action="addWallPost";
		new Ajax.Updater("wallPostContainer", UTDWallPostView.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
	        }
	    );
		return false;
  },
  
  editWallPost: function(wallPostId) {
		
		var wallPostForm = $("wallPostForm"); 
		var params=wallPostForm.serialize(true);	
		params.wpid=wallPostId;
		params.action="editWallPost";
		new Ajax.Updater("wallPostContainer", UTDWallPostView.contentURL,
	        {
	            method:"POST",
	            parameters: params
	        }
	    );
		return false;
  },
  
  updateWallPost: function(wallPostId) {
		
		var wallPostForm = $("wallPostForm"); 
		var params=wallPostForm.serialize(true);	
		params.wpid=wallPostId;
		params.action="updateWallPost";
		new Ajax.Updater("wallPostContainer", UTDWallPostView.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
	        }
	    );
		return false;
  },
  
  cancelUpdateWallPost: function(wallPostId) {
		
		var wallPostForm = $("wallPostForm"); 
		var params=wallPostForm.serialize(true);	
		params.wpid=wallPostId;
		params.action="cancelUpdateWallPost";
		new Ajax.Updater("wallPostContainer", UTDWallPostView.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
	        }
	    );
		return false;
  },
  
  censorWallPost: function(wallPostId) {
		
		var wallPostForm = $("wallPostForm"); 
		var params=wallPostForm.serialize(true);	
		params.wpid=wallPostId;
		params.action="censorWallPost";
		new Ajax.Updater("wallPostContainer", UTDWallPostView.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
	        }
	    );
		return false;
  },
  
  deleteWallPost: function(wallPostId) {
		
		var wallPostForm = $("wallPostForm"); 
		var params=wallPostForm.serialize(true);	
		params.wpid=wallPostId;
		params.action="deleteWallPost";
		new Ajax.Updater("wallPostContainer", UTDWallPostView.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
	        }
	    );
		return false;
  }
  
}
/** End:UTDWallPostView **/
if (!UTDWallPostView) UTDWallPostView={};
UTDWallPostView.contentURL="/WebObjects/United.woa/ajax/UTDWallPostView"+$tc_wosid();
UTDWallPostView.dataURL="/WebObjects/United.woa/ajax/UTDWallPostView/data"+$tc_wosid();

/** Start:UTDWMMatchBrowser **/
var UTDWMMatchBrowser={
		
	updateBatch: function(batchIndex) {
		//alert(batchIndex);
		if(!batchIndex) { 
			return false; 
		}
	  	
		var matchFiltersForm = $("matchFiltersForm"); 
		var params=matchFiltersForm.serialize(true);
		params.batchIndex=batchIndex;
		params.action="updateBatch";
		
		var mb = $("matchBrowserContainer");
		mb.update(''); 
 
		new Ajax.Updater(mb, UTDWMMatchBrowser.contentURL,
	        {
	            method:"POST",
	            parameters: params,
	            onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }
	        }
	    );

		return false;
 	},
	updateMatchFilters: function() {
		
		var matchFiltersForm = $("matchFiltersForm"); 
		var params=matchFiltersForm.serialize(true);
		params.action="updateMatchFilters";
		
		var scope = this;
		
		new Ajax.Updater("matchBrowserContainer", UTDWMMatchBrowser.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            	onComplete: function() { try { curvyCorners.redraw(); } catch(e) {} }	           
	        }	
	    );
		return false;
	}
				
};
/** End:UTDWMMatchBrowser **/
if (!UTDWMMatchBrowser) UTDWMMatchBrowser={};
UTDWMMatchBrowser.contentURL="/WebObjects/United.woa/ajax/UTDWMMatchBrowser"+$tc_wosid();
UTDWMMatchBrowser.dataURL="/WebObjects/United.woa/ajax/UTDWMMatchBrowser/data"+$tc_wosid();

/** Start:UTDWMMatchBrowserColumnPrediction **/
var UTDWMMatchBrowserColumnPrediction = {
		
	resetPrediction: function(matchId) {
		//alert(matchId);
		if(!matchId) { 
			return false; 
		}
	  	
		var predictionsForm = $("predictionForm_"+matchId);	
		var params=predictionsForm.serialize(true);
		params.action="resetPrediction";
		
		var scope = this;
		
		var container = $("prediction_"+matchId);
		var firstInputId = "predictionGoals1_"+matchId;	
		container.addClassName('loading');
		
		new Ajax.Updater(container, UTDWMMatchBrowserColumnPrediction.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            	onComplete: function() { 
            		container.removeClassName('loading');
            		$(firstInputId).select();
            		try { curvyCorners.redraw(); } catch(e) {}; 
            	}
	        }	
	    );
		return false;
	},	
	
	savePrediction: function(matchId) {
		//alert(matchId);
		if(!matchId) { 
			return false; 
		}
		
		
		var predictionGoals1=$("predictionGoals1_"+matchId);	
		var predictionGoals2=$("predictionGoals2_"+matchId);	
		
		if (predictionGoals1 && predictionGoals1.getAttribute('utd_set') == "true"
			&& predictionGoals2 && predictionGoals2.getAttribute('utd_set') == "true"){
		}
		
		
		var predictionsForm = $("predictionForm_"+matchId);				
		var params=predictionsForm.serialize(true);
		params.action="savePrediction";
		
		var scope = this;
		
		var container = $("prediction_"+matchId);
		
		container.addClassName('loading');
		
		new Ajax.Updater(container, UTDWMMatchBrowserColumnPrediction.contentURL,
	        {
	            method:"POST",
	            parameters: params,
            	onComplete: function() { 
            		container.removeClassName('loading');
            		try { curvyCorners.redraw(); } catch(e) {}
            	}
	        }
	
	    );
		return false;
	},
	
	handlePredictionChanged: function(input, matchId) {
		//alert(matchId);
		if(!matchId && !input) { 
			return false; 
		}

		if(input.value && input.value.length > 0 
			&& parseInt(input.value) != "NaN"
			&& typeof(parseInt(input.value)) == "number") {
			input.setAttribute('utd_set', "true");
		}
		else {
			input.setAttribute('utd_set', "false");
		}
		
		var predictionGoals1=$("predictionGoals1_"+matchId);	
		var predictionGoals2=$("predictionGoals2_"+matchId);	
		
		if (predictionGoals1 && predictionGoals1.getAttribute('utd_set') == "true"
			&& predictionGoals2 && predictionGoals2.getAttribute('utd_set') == "true"){
		    //alert(predictionGoals1+" / "+predictionGoals2);
			return UTDWMMatchBrowserColumnPrediction.savePrediction(matchId);
		}
		
		return false;
	}	
}
/** End:UTDWMMatchBrowserColumnPrediction **/
if (!UTDWMMatchBrowserColumnPrediction) UTDWMMatchBrowserColumnPrediction={};
UTDWMMatchBrowserColumnPrediction.contentURL="/WebObjects/United.woa/ajax/UTDWMMatchBrowserColumnPrediction"+$tc_wosid();
UTDWMMatchBrowserColumnPrediction.dataURL="/WebObjects/United.woa/ajax/UTDWMMatchBrowserColumnPrediction/data"+$tc_wosid();

/** Start:UTDWMMyPredictions **/
var UTDWMMyPredictions={
		
	updateMatchFilters: function(componentContentUrl) {
		//alert(componentContentUrl);
		if(!componentContentUrl) { 
			return false; 
		}
	  	
		var predictionsForm = $("predictionsForm"); 
		var params=predictionsForm.serialize(true);
		params.action="updateMatchFilters";
		
		var scope = this;
		
		new Ajax.Updater("predictionsContainer", componentContentUrl,
	        {
	            method:"POST",
	            parameters: params,
            	onComplete: function() { try { curvyCorners.redraw(); } catch(e) {}; } //,
	           // onComplete: function() { scope.previousBatch(componentContentUrl, messageBoardId); }
	        }
	
	    );
		return false;
	},	

	toggleNewEntryForm: function(messageBoardId, _element) {
		var e = $("messageBoardNewEntryControls_"+messageBoardId); 

		if(!e || !_element) { 
			return false; 
		}
		 
		if(e.style.display != 'block' || !e.visible()) {
			 e.style.display='block';
			 _element.className = 'on';
		} 
		else {
			e.style.display='none';			
			_element.className = 'off';
		} 

		_element.blur();
		 
		return false;
	},
		
	
	createNewEntry: function(componentContentUrl, messageBoardId) {
		if(!componentContentUrl || !messageBoardId) { 
			return false; 
		}
      	
		var messageBoardContainerForm = $("messageBoardContainerForm_"+messageBoardId); 
		var params=messageBoardContainerForm.serialize(true);
		params.action="createEntry";
		
		var scope = this;
		
		new Ajax.Updater("messageBoardEntriesContainer_"+messageBoardId, componentContentUrl,
            {
                method:"POST",
                parameters: params,
            	onComplete: function() { try { curvyCorners.redraw(); } catch(e) {}; }//,
               // onComplete: function() { scope.previousBatch(componentContentUrl, messageBoardId); }
            }

        );
		return false;
	},
	
	
	
	previousBatch: function(componentContentUrl, messageBoardId) {
		if(!componentContentUrl || !messageBoardId) { 
			return false; 
		}
      	
		var messageBoardContainerForm = $("messageBoardContainerForm_"+messageBoardId); 
		var params=messageBoardContainerForm.serialize(true);
		params.action="previousBatch";
		new Ajax.Updater("messageBoardEntriesContainer_"+messageBoardId, componentContentUrl,
            {
                method:"POST",
                parameters: params,
            	onComplete: function() { try { curvyCorners.redraw(); } catch(e) {}; }
            }

        );
		return false;
	},
	
	nextBatch: function(componentContentUrl, messageBoardId) {
		if(!componentContentUrl || !messageBoardId) { 
			return false; 
		}      	
		var messageBoardContainerForm = $("messageBoardContainerForm_"+messageBoardId); 
		var params=messageBoardContainerForm.serialize(true);
		params.action="nextBatch";
		new Ajax.Updater("messageBoardEntriesContainer_"+messageBoardId, componentContentUrl,
            {
                method:"POST",
                parameters: params,
            	onComplete: function() { try { curvyCorners.redraw(); } catch(e) {}; }
            }
        );
		return false;
	}
	
	
				
};
/** End:UTDWMMyPredictions **/

