<?php $lang=Yii::app()->session['lang'] ;
header('Content-Type:text/javascript'); 
?>

$(document).ready(function(){
    $("#yw0_button").click();
    })

    $(document).ready(function(){
	
    var closePopupurl=false;
   $("#questionnaire_form").submit( function(e){
       e.preventDefault();
      
       $.ajax({
           type:"POST",
           url: "<?php //echo CController::createUrl('questionnaire') ?>",
           data: $("#questionnaire_form").serialize(),
           dataType: "json",
           success: function(response){
               if(response.status=="sucsess")
                  closePopupurl=true;
              else
                  closePopupurl=false;
               $(".modal-body").html(response.msg);
               $("#myModal").modal('show');
           },
           error: function (data) {
           console.log('An error occurred.');
           console.log(data);
           },
      });
  });
  
  $("#bclose").click(function(){
      if(closePopupurl)
       parent.window.location="<?php //echo CController::createUrl('/site/questionnaire') ?>";
  });

  $("#xclose").click(function(){
  if(closePopupurl)
      parent.window.location="<?php //echo CController::createUrl('/site/questionnaire') ?>";
  });
});