function objectEval(text){
  // eval() breaks when we use it to get an object using the { a:42, b:'x' }
  // syntax because it thinks that { and } surround a block and not an object
  // So we wrap it in an array and extract the first element to get around
  // this.
  // The regex = [start of line][whitespace]{[stuff]}[whitespace][end of line]
  text = text.replace(/\n/g, ' ');
  text = text.replace(/\r/g, ' ');
  if(text.match(/^\s*\{.*\}\s*$/)){
   text = '[' + text + '][0]';
  }
  return eval('' + text + '');
}
var timeoutId = 0;


FormValidator.uidIsUnique=function(){
clearTimeout ( timeoutId );
timeoutId = setTimeout("dwr.engine._execute(FormValidator._path, 'FormValidator', 'uidIsUnique', dwr.util.getValue('movieUid'), dwr.util.getValue('movieEnvironmentId'), uidIsUniqueCallback)", 1000)
}
var uidIsUniqueCallback=function(data){
	if(data[0]=="false"){
		dwr.util.setValue(
			'movieUidCallback',
			data[1],
			{ escapeHtml: false }
		);
	}else{
		dwr.util.setValue(
			'movieUidCallback',
			""
		);
	}
}

FormValidator.addComment=function(mID){
 dwr.engine._execute(FormValidator._path, 'FormValidator', 'addComment',mID,dwr.util.getValue('envId'),dwr.util.getValue('language'),dwr.util.getValue('movieComment'),dwr.util.getValue('userNick'),dwr.util.getValue('kontroll'),dwr.util.getValue('rnd'),addCommentCallback);
}
var addCommentCallback=function(data){
 if(data[0]=="true"){
  dwr.util.setValue('movieComment',"");
  var existingComments=dwr.util.byId('comments').innerHTML;
  var newComment="";
  newComment=newComment+"<div class=\"commenticon\"> </div><div class=\"commentheader\"><div class=\"user\">"+data[3]+" ("+data[2]+")</div></div>"
  newComment=newComment+"<div class=\"commentbody\"><span class=\"commentcontent\">"+data[1]+"</span></div>"
  dwr.util.setValue('comments',newComment+existingComments,{ escapeHtml:false });
 
  hideLayer('register_comment');
 }else{
  dwr.util.setValue('commentsError',data[0],{ escapeHtml:false });
 }
}

