     
function reasonsReport_text_textShort(){
	obj1 = document.getElementById( 'reasonsReport_text' );
	obj2 = document.getElementById( 'reasonsReport_textShort' );
	obj1.value = obj2.value;
}

var DialogReportImage = function( idDialog, oQ, idForm, sUrl, sCommand ) {
	var _idForm = idForm;
	var _ref = this;
	var _sUrl = sUrl;
	
	var handleSubmit = function() {
  	this.sendForm();
	};
	
	var handleCancel = function() {
	  this.cancel();
	};
	
	
	DialogReportImage.superclass.constructor.call(this, idDialog,{ width : "340px", fixedcenter : true, visible : false, constraintoviewport : true,
			buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
			{ text:"Cancel", handler:handleCancel } ]
		} );
	var kl_close = new YAHOO.util.KeyListener(document, {keys:27 },
												  { fn: this.hide,
														scope: this,
														correctScope:true }, "keyup" ); 
													
	this.cfg.queueProperty("keylisteners", kl_close);
	
	this.render( );
	this.show = function( o, id ) {
    var frm = document.getElementById( _idForm );
    if (frm.idFigure){
    	frm.idFigure.value = id[1];
    }
    if (frm.idAnimation){
    	frm.idAnimation.value = id[1];
    }
    DialogReportImage.superclass.show.call( _ref );
	}
	
	this.sendForm = function() {
	  var formObject = document.getElementById( _idForm );
	  _ref.Success = function(o) {
	  	var jsonString = o.responseText;
	 		try {
	  		var obj = YAHOO.lang.JSON.parse( jsonString );
		  	if ( obj.type == 'complex' ){
					var status = 'error';
					if ( obj.status == 'error' ) { 
						status = Message.STATUS_ERR;
					}
					if ( obj.status == 'ok' ){
						status = Message.STATUS_OK;
						//window.location.reload( true );
						_ref.hide();
					}
					oQ.add( new Message( status, obj.textMessage ) );
				}
	  	}
	  	catch( e ) {
	  		oQ.add( new Message( Message.STATUS_ERR, "Error while executing command: " + e + ';json: ' + jsonString ) );
	  	}
	    return true;
	  }
	
	  this.Failure = function(o) {
	    alert( 'Connection fail.' );
	  }
	
	  var response =
	  {
	    upload: _ref.Success,
	    failure: _ref.Failure
	  }
	  
	  this.validate = function() {
			var data = this.getData();
			var clS = data.reasonReport.replace( /\s/g, '' );
			if ( clS == '' || data.reasonReport == 'Enter text here') {
				alert("Please, choose a reason for Report.");
				return false;
			} else {
				return true;
			}
		}
		var check = false;
	  try {
	  	var check = this.validate();
			if( check ) {
				var _stUrl =  _sUrl.replace(/&amp;/g,"&") + '&command=' + sCommand;
				YAHOO.util.Connect.setForm( formObject,true );
				var cObj = YAHOO.util.Connect.asyncRequest( 'GET', _stUrl , response );
			}
		}
		catch( e ) {
			 oQ.add( e );
		}	
	} 
   
}

YAHOO.lang.extend( DialogReportImage, YAHOO.widget.Dialog );


function fReportAnimation() {
	oQue = new MessageQueue();
	var oMR = new MessageRepresentation( 'hd', 'message error', 'message ok', oQue );
	var ButtonReportImage = function( id ) {
		ButtonReportImage.superclass.constructor.call( this, 'bDialogReportImage_' + id );
		this.id =  id;
	}
	YAHOO.lang.extend( ButtonReportImage, YAHOO.widget.Button );
	oDialogReportImage = new DialogReportImage( 'dialogDialogReportImage', oQue ,'idReportImage', sUrl, command );
	
	for( var i = 0; i < arr.length; i++ ) {
	  YAHOO.util.Event.addListener("showDialogReportImage_"+arr[i], "click", oDialogReportImage.show, [ oDialogReportImage ,arr[i] ], true);
	   
	}
	for( var i = 0; i < arr1.length; i++ ) {
	  YAHOO.util.Event.addListener("showDialogReportImage"+arr1[i], "click", oDialogReportImage.show, [ oDialogReportImage ,arr1[i] ], true);
	   
	}
	
	
}
