
function SetDirection(direction){if(direction=='pause'){if(!confirm(lang("I wish to continue later")))return false;}else if(direction=='next'){var x=document.getElementsByTagName('*');var i;var answerA='';for(i=0;i<x.length;i++){if(x[i].id){if(x[i].id.substring(0,4)=='rdiv'){answered=0;for(j=0;j<x.length;j++){if(x[j].id){if(x[j].id.substring(0,16)=='RSPS'+x[i].id.substring(4,16)){switch(x[j].type){case'checkbox':case'radio':if(x[j].checked)answered=1;break;case'text':case'select-one':case'textarea':if(x[j].value)answered=1;break;default:break;}}}}
if(!answered){document.getElementById(x[i].id).className='repdivMandatory';if(!answerA)answerA=x[i].id.substring(4);}else document.getElementById(x[i].id).className='repdiv';}}}}
if(answerA){document.location='#'+answerA;alert(lang("the framed answers are mandatory"));}else{document.outputForm.direction.value=direction;document.outputForm.submit();}}
function validate(special,cpt){str='';for(i=0;i<cpt;i++){eval('flag=document.outputForm.cb_'+special+'_'+i+'.checked');eval('val=document.outputForm.'+special+'_'+i+'.value');if(flag){if(str)str=str+' | ';str=str+val;}}
eval('document.outputForm.'+special+'.value=str');update();}
function update(){return true;}
function form_updated(){return true;}
function zipToCity(foo1,foo2){return true;}
function pourcent_compute(obj){total=0;$$('.'+obj.className).each(function(o){total+=parseInt(o.value);});$(obj.className).style.backgroundColor=total==100?'#9F9':'#F99';$(obj.className).update(total+'%');$(obj.className+'_text').update(total==100?'':'Attention : vérifiez que votre total est égal à 100%');}
function editor_init(){tinyMCE.init({mode:"textareas",theme:"advanced",theme_advanced_buttons1:"bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",editor_selector:"mceEditor",convert_urls:false,gecko_spellcheck:true});}
function mark_change(obj){if(!$(obj.id))return;$('tr'+obj.id).setStyle({backgroundColor:'#FA0'});new Ajax.Request(url='/intranet-e/survey/correction.ies',{method:'post',parameters:{ieAction:'ws_mark_save',survey_id:$('survey_id').value,mark:obj.value,a_id:obj.id},onSuccess:function(xhr){content=xhr.responseText.evalJSON();if(content.status=='ok'){if(content.a_id&&$(content.a_id)){$('tr'+content.a_id).setStyle({backgroundColor:'#DF9'});}}}.bind(this)});}
