/*
 * yui-ext
 * 
 */

var DOM = YAHOO.util.Dom;
function CheckInfo () {
    var dialog, txtUsername, txtPassword;
    var postBtn, redirectLink;
    var wait, error, errorMsg;
    var dialogW = 420;
    var dialogH = 380;
    
   return {
 	 iSubmit: 0,
 	 
	show : function(linkId, rL){

			this.submitComment();
      },
        // submit the comment to the server
      submitComment : function(){
			this.iSubmit=0;
	        YAHOO.util.Connect.setForm(DOM.get('dilivery-form'));	        

        var commentSuccess = function(o){
              //var result = eval('new Object(' + o.responseText + ')');
              var result = YAHOO.ext.util.JSON.decode(o.responseText);

              if(result.link != false){                    					
					document.continue_form.submit();

               }else{

                  DD.show('check_out','user_order_step_3n.php', 'refferals');                  
                  //error.radioClass('active-msg');
                  //var err = '';
                  //for(i in result.errors){
                   // err = result.errors[i];
                 // }
                  //var str_err=err+" does not deliver to your address. Would you like to view restaurants that do deliver to your address?\n
			        //           		Yes – show step 2 type page with all the restaurants available in this zip code\n
                    //            	No  - thanks, I’ll enter a new zip code.
                  //errorMsg.update(err);
               }
            };
            
            var commentFailure = function(o){
				
            };
		    if(this.iSubmit==0){

	            this.iSubmit=1;
	            YAHOO.util.Connect.asyncRequest('POST', 'user_order_step_1_ajax.php', 
	                    {success: commentSuccess, failure: commentFailure});          
	        }
        }
        
    };
};

var CI = new CheckInfo();
if(document.getElementById('check_out')){
	document.getElementById('check_out').style.display = '';
}

