var panel = null; $(document).ready( function(){ panel = new cmsPanel( {"width":500}); }); var pollPanel = null; function submitPoll(fm) { var errormsg = ''; if( pollPanel == null ) { pollPanel = new cmsPanel( {"width":500}); } pollPanel.setWaitingContent(); pollPanel.show(); var optionSel = getRadioValue(fm['poll'] ); if( optionSel == null ) { pollPanel.setTitle('Poll Submission'); pollPanel.setContent('Please make a selection.'); return false; } else { $.ajax({ type: "POST", url: baseUrl() +"a/Poll/vote", async:true, data: 'polloption='+optionSel, success: function(msg,ret){ pollPanel.setTitle( 'Poll Submission' ); if( ret != 'success' ) { pollPanel.setContent('
Poll submission failed, please refresh.
'); return; } try { var result = eval( '(' + msg +')' ); pollPanel.setContent('
'+result.msg+'
') if( result.status == '1' ) { pollPanel.hide(); showPollResult(result.data); } } catch(E) { pollPanel.setContent('
Network connection error, please try again later.
'); return; } } }); } return false; } function showPollResult(data) { var str = ''; for(var i=0; i' +data[i].name + ''+ '
'+ '
'+ '
'+ '
'+data[i].vote+' votes ('+data[i].percentage+'%) '+ '

'; } $('#pollAnswer').html( str ); var bars = $('.surveyperc').each( function() { var id = this.id.split('_')[1]; $('#inner_'+id).animate({ width: $(this).html()+'%' }, 1500); }); }