var ReviewEditor = Class.create({
    
    initialize: function(){

    },
    insert: function(){
    	
    	if($('employees').value==""|| 
    	   $('comfort').value==""||
    	   $('employees').value==""|| 
    	   $('moneyvalue').value==""||
    	   $('service').value=="")
    		{
        		alert("bitte alles bewerten.");
        		return false;
    		}
    	
    	reviewDWRManager.insertReview($F('name'),
    								  $F('email'),
    								  $F('homeCountry'),
    								  $F('employees'),
    								  $F('service'),
    								  $F('comfort'),
    								  $F('clean'),
    								  $F('moneyvalue'),
    								  tinyMCE.get('comment').getContent(),
    								  $F('guestType'),
    								  $F('recaptcha_challenge_field'),
    								  $F('recaptcha_response_field'),
    								  
    								  
		  {callback:function(data){
		  
			if(data != "false"){
			  	alert("vielen Dank fuer Ihre Bewertung");
			  	document.location.href="reviewResult.html"
			}else{
				alert("bitte nochmal probieren.")
				$('recaptcha_response_field').value = "";
				Recaptcha.reload();
			}
		  
		  }}
		  
		  );
    },  
    rateReview: function(which,how){
    	reviewDWRManager.rateReview(which,how);
    	Prompt.display("danke ", {autoHide:true});
    },
    showPopup: function(){
    	var x         = $('popup');
    }

});
var Prompt = {
	      autoHideTime: 2000

	      ,display: function( msg, options ) {
	       // $('prompt_message').innerHTML = msg;
	        Prompt.show();
	        if( options && options.autoHide )
	          setTimeout('Prompt.hide()', options.autoHideTime || Prompt.autoHideTime );
	      }

	      ,working: function(msg, options) {
	        msg = '<img src="progress.gif">  ' + msg;
	        Prompt.display( msg, options );
	      }

	      , _center: function(){
	        $('prompt').style.left = ( ( document.viewport.getWidth() - parseInt( $('prompt').offsetWidth ) ) / 2 ) + 'px' ;
	      }

	      ,show: function(){
	        Prompt._center();
	        new Effect.Move ($('prompt'),{ x: parseInt( $('prompt').style.left ), y: 0, mode: 'absolute', duration: 0.2 });
	      }
	      ,hide: function( msg) {
	        new Effect.Move ($('prompt'),{ x: parseInt( $('prompt').style.left ), y: -30, mode: 'absolute', duration: 0.1 });
	      }
	    }
 var reviewEditor = new ReviewEditor();


