function rOPP(){var nonEmptyChoices=0;$("#OPP-create-tab-create input").each(function(){if($(this).val()!=""){nonEmptyChoices++;}});if($("#OPP-question-text").val()==""){yOPP('Invalid input','The poll needs a question text.');}else if(0==nonEmptyChoices){yOPP('Invalid input','The poll needs at least one choice.');}else if(0<pollData.responseCount){aOPP("You can not edit a poll with responses.",true,$("#OPP-design-poll-tips"));}else{pollData.anchorText=OPPlinkMessages[Math.floor(Math.random()*OPPlinkMessages.length)];var styleString="{";jQuery.each(pollData.style,function(attribute,val){styleString+='"'+attribute+'":"'+val+'",';});styleString=styleString.substring(0,styleString.length-1)+"}";pollData.styleString=styleString;$("#OPP-save-poll-button").text("Saving...").attr('disabled',true);if(pollUserId){var pollDataClone=$.extend({},pollData);pollDataClone.question=encodeURIComponent(pollData.question);for(i=0;i<$("#OPP-choice-tables input").size();i++){eval("pollDataClone.choice"+i+" = encodeURIComponent(pollData.choice"+i+");");}$.ajax({url:OPP_PG_BASEURL+"?command=savePoll",type:"POST",data:pollDataClone,dataType:"json",contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:"5000",success:function(resultObj,textStatus){if(resultObj.resultCode==RESULT_CODE_OK){pollData.pollId=resultObj.pollId;if($("#"+pollData.pollId).length==0){xOPP(pollData.pollId,pollData.question);}else{HOPP(pollData.pollId);xOPP(pollData.pollId,pollData.question);}vOPP();aOPP("Poll was saved",true,$("#OPP-design-poll-tips"));oOPP();YOPP();uOPP();}else if(resultObj.resultCode==RESULT_CODE_NOT_LOGGED_IN){jOPP();$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true,rOPP);},Cancel:function(){$(this).dialog('close');}}).dialog('open');}else if(resultObj.resultCode==RETURN_CODE_CONNECTOR_RESPONDENTS_EXIST){jOPP();aOPP("The poll has responses, and can not be edited.",true,$("#OPP-design-poll-tips"));}else{WOPP();}},error:WOPP});}else{$('#OPP-dialog-account').dialog('open');}}};function vOPP(){if(OPPaccStatus=="NOTCONFIRMED"){$("#OPP-publish-info").hide();$("#OPP-publish-not-validated").show();}else{$("#OPP-publish-info").show();$("#OPP-publish-not-validated").hide();var pollPageUrl=OPPpollAddress+OPPpollPage+"?p="+pollData.pollId;var pollEmbedUrl=OPPpollAddress+OPPembedScript+"?p="+pollData.pollId;var tempQuestion=pollData.question;var shareFacebookUrl="http://www.facebook.com/share.php?u="+OPPpollAddress+OPPpollPageJsp+"?t="+encodeURIComponent(tempQuestion+"&p=")+pollData.pollId;var shareTwitterUrl="http://twitter.com/home?status="+encodeURIComponent(pollData.question)+" "+encodeURIComponent(pollPageUrl);$("#OPP-poll-public-link").html("<div style='font: bold 13px arial; color: #6fa7d1;'>Poll page:</div><a style='text-decoration: none; color: gray;' target='POLL"+pollData.pollId+"' href='"+pollPageUrl+"'>"+pollPageUrl+"</a>");var textToAppend='<script type="text/javascript" src="'+pollEmbedUrl+'"></script>';textToAppend=textToAppend+'<a class="OPP-powered-by" href="http://www.objectplanet.com/opinio/" style="text-decoration:none;"><div style="font: 9px arial; color: gray;">'+pollData.anchorText+'</div></a>';if($("#OPP-no-script-code").is(':checked')){textToAppend=textToAppend+"\n<noscript>JavaScript is disabled!</noscript>";}if($("#OPP-non-block-code").is(':checked')){}$("#OPP-poll-embed-code").val(textToAppend);$("#OPP-share-social").html("<div style='font: bold 13px arial; color: #6fa7d1;'>Share:</div>"+"<a style='text-decoration: none; color: gray;' target='_blank' href='"+shareFacebookUrl+"' class='OPP-tooltip' title='Share poll on Facebook'><img border='0' alt='Facebook' src='http://static.ak.facebook.com/images/share/facebook_share_icon.gif' /></a>"+"<a style='text-decoration: none; color: gray;' target='_blank' href='"+shareTwitterUrl+"' class='OPP-tooltip' title='Share poll on Twitter'><img border='0' alt='Twitter' src='images/share_twitter.png' /></a>");cOPP("#OPP-share-social > a");}};function avOPP(){pollData.pollId="";pollData.responseCount=0;pollData.reportData="";rOPP();};function anOPP(){POPP(pollData.pollId);bOPP();};function WOPP(xhr){aOPP("An error occurred when saving.",true,$("#OPP-design-poll-tips"));$("#OPP-save-poll-button").text("Save").attr('disabled',false);};function jOPP(){var nonEmptyChoices=0;$("#OPP-create-tab-create input").each(function(){if($(this).val()!=""){nonEmptyChoices++;}});if($("#OPP-question-text").val()!=""&&0<nonEmptyChoices){$("#OPP-save-poll-button").text("Save").attr('disabled',false);aOPP("",false,$("#OPP-design-poll-tips"));if(0<pollData.pollId){$("#OPP-save-as-new-poll-button").show();$("#OPP-save-poll-button").show();$("#OPP-clear-poll-button").show();}else{if(0<$("#OPP-bottom-area button:visible").length){$("#OPP-save-poll-button").show();$("#OPP-clear-poll-button").show();}else{$("#OPP-save-poll-button").show('blind');$("#OPP-clear-poll-button").show('blind');}}}};function oOPP(){$("#OPP-save-poll-button").qtip("hide");$("#OPP-save-as-new-poll-button").qtip("hide");$("#OPP-clear-poll-button").qtip("hide");$("#OPP-save-poll-button").hide();$("#OPP-save-as-new-poll-button").hide();$("#OPP-clear-poll-button").hide();};function YOPP(){$("#OPP-delete-poll-button").show();};function abOPP(){$("#OPP-delete-poll-button").qtip("hide");$("#OPP-delete-poll-button").hide();};function SOPP(animate){if($("#OPP-choice-tables input:last").val()!=''){var OPPlastChoice=$("#OPP-choice-tables").append($("#OPP-choice-table-hidden").clone().attr("id","OPP-choice-table"));if(animate){$("#OPP-choice-tables").children(":last").show('blind');}else{$("#OPP-choice-tables").children(":last").show();}fOPP();$("#OPP-choice-tables input:last").val('');}};function MOPP(event){$('#OPP-choice-separator').removeClass('OPP-choice-separator-hover');var OPPinsert=$("#OPP-choice-table-hidden").clone().attr("id","OPP-choice-table");$('input',OPPinsert).val('');$(event.target).parents("#OPP-choice-table").before(OPPinsert);OPPinsert.show('blind');fOPP();jOPP();};function JOPP(){if(((new Date().getTime())-lastEditTime)<300){jOPP();pollData.question=$('#OPP-question-text').val();var questionExist=pollData.question.length>0;var choiceNumber=0;pollData.reportData={};$('#OPP-choice-tables input').each(function(i){eval("pollData.choice"+i+"= ''");if($(this).val().length>0){eval("pollData.choice"+choiceNumber+"= $(this).val()");eval("pollData.reportData.c"+choiceNumber+" = "+Math.floor(Math.random()*101));choiceNumber++;}});if(0<choiceNumber){questionExist=true;}pollData.voteButtonText=$('#OPP-opt-vote-button-label').val();pollData.resultLinkText=$('#OPP-opt-see-results-label').val();pollData.totalVotesText=$('#OPP-opt-total-votes-label').val();if(0<$('#OPP-opt-multiple-selections-td :checked').length){pollData.pollChoiceType="checkbox";}else{pollData.pollChoiceType="radio";}pollData.style.maxPollWidth=$('#OPP-opt-max-poll-width').slider('option','value');if(0<$('#OPP-opt-advanced-anti-cheat-td :checked').length){pollData.antiCheatLevel=2;$("#OPP-opt-anti-cheat-text-div").show();}else{pollData.antiCheatLevel=0;$("#OPP-opt-anti-cheat-text-div").hide();}pollData.style.divAroundPollBgColor=$("#OPP-bg-color").val();pollData.style.cornersStyle=$('#OPP-corner-radius-value').text();pollData.style.pollQuestionColor=$("#OPP-question-text-color").val();pollData.style.pollChoiceTextColor=$("#OPP-choice-text-color").val();pollData.style.pollResultLinkTextColor=$("#OPP-see-results-text-color").val();pollData.style.pollVoteButtonColor=$("#OPP-vote-button-text-color").val();pollData.style.chartBarFilledColor=$("#OPP-chart-bar-filled-color").val();pollData.style.chartBarFilledBorderColor=$("#OPP-chart-bar-filled-border-color").val();pollData.style.chartBarNotFilledColor=$("#OPP-chart-bar-not-filled-color").val();pollData.style.chartBarNotFilledBorderColor=$("#OPP-chart-bar-not-filled-border-color").val();pollData.style.chartBarHeight=$("#OPP-chart-bar-height").val();pollData.style.divAroundPollPaddingLeft=$("#OPP-padding-left-value").text();pollData.style.divAroundPollPaddingRight=$("#OPP-padding-right-value").text();pollData.style.divAroundPollPaddingTop=$("#OPP-padding-top-value").text();pollData.style.divAroundPollPaddingBottom=$("#OPP-padding-bottom-value").text();pollData.style.pollQuestionFontFamily=$("#OPP-question-text-font").val();pollData.style.pollQuestionFontSize=$("#OPP-question-text-size").val()+"pt";if($("#OPP-question-text-size").val()==""){pollData.style.pollQuestionFontSize="8pt";}if($("#OPP-question-text-bold").css("opacity")=="1"){pollData.style.pollQuestionFontWeight="bold";}else{pollData.style.pollQuestionFontWeight="normal";}if($("#OPP-question-text-italic").css("opacity")=="1"){pollData.style.pollQuestionFontStyle="italic";}else{pollData.style.pollQuestionFontStyle="normal";}pollData.style.pollChoiceTextFontFamily=$("#OPP-choice-text-font").val();pollData.style.pollChoiceTextFontSize=$("#OPP-choice-text-size").val()+"pt";if($("#OPP-choice-text-size").val()==""){pollData.style.pollChoiceTextFontSize="8pt";}if($("#OPP-choice-text-bold").css("opacity")=="1"){pollData.style.pollChoiceTextFontWeight="bold";}else{pollData.style.pollChoiceTextFontWeight="normal";}if($("#OPP-choice-text-italic").css("opacity")=="1"){pollData.style.pollChoiceTextFontStyle="italic";}else{pollData.style.pollChoiceTextFontStyle="normal";}pollData.style.pollResultLinkTextFontFamily=$("#OPP-see-results-text-font").val();pollData.style.pollResultLinkTextFontSize=$("#OPP-see-results-text-size").val()+"pt";if($("#OPP-see-results-text-size").val()==""){pollData.style.pollResultLinkTextFontSize="8pt";}if($("#OPP-see-results-text-bold").css("opacity")=="1"){pollData.style.pollResultLinkTextFontWeight="bold";}else{pollData.style.pollResultLinkTextFontWeight="normal";}if($("#OPP-see-results-text-italic").css("opacity")=="1"){pollData.style.pollResultLinkTextFontStyle="italic";}else{pollData.style.pollResultLinkTextFontStyle="normal";}pollData.style.pollVoteButtonFontFamily=$("#OPP-vote-button-text-font").val();pollData.style.pollVoteButtonFontSize=$("#OPP-vote-button-text-size").val()+"pt";if($("#OPP-vote-button-text-size").val()==""){pollData.style.pollVoteButtonFontSize="8pt";}if($("#OPP-vote-button-text-bold").css("opacity")=="1"){pollData.style.pollVoteButtonFontWeight="bold";}else{pollData.style.pollVoteButtonFontWeight="normal";}if($("#OPP-vote-button-text-italic").css("opacity")=="1"){pollData.style.pollVoteButtonFontStyle="italic";}else{pollData.style.pollVoteButtonFontStyle="normal";}$(".OPP-poll-preview").attr("id","OPP-poll-id-"+pollData.pollId);if(questionExist){zOPP(pollData,true);}else{pollData.titleText="EMPTY POLL";pollData.voteButtonText="";pollData.resultLinkText="";zOPP(pollData,true);pollData.titleText="";}}setTimeout(JOPP,75);};function bOPP(){lastEditTime=new Date().getTime();};function DOPP(millis){lastEditTime=new Date().getTime()+parseInt(millis);};function KOPP(event){$(event.target).parents("#OPP-choice-table").children().children().children().children().val('');if(3<$("#OPP-choice-tables input").size()){$(event.target).parents("#OPP-choice-table").hide("blind","normal",function(){$(this).remove();fOPP();});}};function fOPP(){$("#OPP-choice-tables img").show().unbind('click',bOPP).bind('click',bOPP);$("#OPP-choice-tables img[src*=delete]:last").hide();$("#OPP-choice-tables img[src*=down.png]:last").hide();$("#OPP-choice-tables img[src*=up.png]:first").hide();$("#OPP-choice-tables img[src*=delete]").unbind('click',KOPP).bind('click',KOPP).css("opacity","0.4").mouseenter(function(){$(this).css("opacity","1")}).mouseleave(function(){$(this).css("opacity","0.4")});$("#OPP-choice-tables img[src*=up.png]").unbind('click',BOPP).bind('click',BOPP);$("#OPP-choice-tables img[src*=down.png]").unbind('click',AOPP).bind('click',AOPP);$('.OPP-choice-separator').unbind('click',MOPP).bind('click',MOPP);$("#OPP-choice-tables input:last").bind('keyup',SOPP);$("#OPP-choice-tables input").unbind('keyup',bOPP).bind('keyup',bOPP);};function BOPP(event){var temp=$(event.target).parents("#OPP-choice-table");var OPPthisValue=$('input',temp);var OPPpreviousValue=$('input',temp.prev());temp=OPPthisValue.val();OPPthisValue.val(OPPpreviousValue.val());OPPpreviousValue.val(temp);fOPP();};function AOPP(event){var temp=$(event.target).parents("#OPP-choice-table");var OPPthisValue=$('input',temp);var OPPnextValue=$('input',temp.next());temp=OPPthisValue.val();OPPthisValue.val(OPPnextValue.val());OPPnextValue.val(temp);fOPP();};function kOPP(){pollData.pollId="";pollData.responseCount="";pollData.anchorText="";aOPP("",true,$("#OPP-design-poll-tips"));$('#OPP-question-text').val("");for(i=0;i<$("#OPP-choice-tables input").size();i++){eval('pollData.choice'+i+'= ""');}while($("#OPP-choice-tables input").size()>3){$("#OPP-choice-tables").children(":first").remove();}$("#OPP-choice-tables input").val("");$('.OPP-preview-thumb:first').click();$("#OPP-poll-public-link").html("");$("#OPP-publish-info").hide();$("#OPP-publish-not-validated").hide();fOPP();oOPP();abOPP();$('#OPP-opt-multiple-selections').attr('checked',false);$('#OPP-opt-vote-button-label').val("vote");$('#OPP-opt-see-results-label').val("See results");$('#OPP-opt-total-votes-label').val("Total votes:");bOPP();};var RESULT_CODE_OK="0";var RESULT_CODE_INVALID_INPUT="2";var RESULT_CODE_NOT_LOGGED_IN="3";var RESULT_CODE_EMAIL_EXISTS="6";var RETURN_CODE_CONNECTOR_RESPONDENTS_EXIST="-7";var OPP_ENTER_KEY=13;var pollData=new Object();var pollUserId;var OPPemail;var OPPallRegistrationFormFields;var lastEditTime=0;var OPP_PG_BASEURL=window.location.href.substring(0,window.location.href.indexOf("poll/")+5)+"poll";var OPPpollAddress="";var OPPpollPage="";var OPPpollPageJsp="";var OPPembedScript="";var OPPinviteMessage="Hi,\n\nI've discovered a great tool for creating polls.\n\nGo here to check it out:\nhttp://www.easypolls.net";var OPPaccStatus="LOGGEDOUT";var OPPlinkMessages=["online surveys","online survey","survey software","customer survey","customer surveys","feedback surveys","web survey","survey service","survey services","web surveys","survey tools","surveys & polls","polls & surveys"];$(function(){$(window).load(function(){$('#OPP-all-content').show();$("#OPP-loading-screen").hide();if($.browser.msie&&jQuery.browser.version.substr(0,1)=="6"){$("#OPP-all-content").hide();$("#OPP-incompatible-browser").show();}JOPP();DOPP(1000);});if(0<window.location.href.indexOf("easypolls.net")){OPP_PG_BASEURL=window.location.href.substring(0,window.location.href.indexOf("easypolls.net")+13)+"/poll";}$("#OPP-copyright").text("© 2009-"+(new Date()).getFullYear()+" ObjectPlanet, Inc.");OPPallRegistrationFormFields=$([]).add($("#OPP-register-email")).add($("#OPP-register-password")).add($("#OPP-register-password-2"));$("#OPP-tab-create textarea").bind('keyup',bOPP).bind('change',bOPP);$("#OPP-create-tab-look-feel input").bind('keyup',bOPP).bind('change',bOPP);$("#OPP-create-tab-options input").bind('keyup',bOPP).bind('change',bOPP);$("#OPP-create-tab-look-feel select").bind('change',bOPP);$.ajaxSetup({scriptCharset:"utf-8",cache:false});aqOPP();cOPP(".OPP-tooltip");cOPP(".OPP-tooltip-mouse",{position:{target:"mouse"}});cOPP("#OPP-no-script-code",nOPP("No-script tag",false));cOPP("#OPP-non-block-code",nOPP("Non-block code",false));cOPP("#OPP-poll-public-link",nOPP("Poll page",false));cOPP("#OPP-poll-embed-code-div",nOPP("Embed poll",false));cOPP("#OPP-opt-max-poll-width",nOPP("Maximum poll width",false));cOPP("#OPP-about",{content:{url:'about.html'},title:{text:'About',button:'Close'},hide:{when:{event:'unfocus'}},show:{when:{event:'click'},delay:0},style:{width:{min:500}}});$("#a2").one('click',function(){$("#OPP-expand-look-feel").trigger('mouseover');$("#OPP-expand-look-feel").effect("pulsate",{times:10},500);setTimeout(function(){$("#OPP-expand-look-feel").trigger('mouseout')},4000)});gOPP($("#OPP-corner-radius"),$("#OPP-corner-radius-value"),0,30);gOPP($("#OPP-padding-left"),$("#OPP-padding-left-value"),0,30);gOPP($("#OPP-padding-right"),$("#OPP-padding-right-value"),0,30);gOPP($("#OPP-padding-top"),$("#OPP-padding-top-value"),0,30);gOPP($("#OPP-padding-bottom"),$("#OPP-padding-bottom-value"),0,30);gOPP($("#OPP-opt-max-poll-width"),$("#OPP-opt-max-poll-width-value"),50,500,5,200);$('.OPP-preview-thumb:first').click();kOPP();$("#OPP-choice-tables").append($("#OPP-choice-table-hidden").clone().show().attr("id","OPP-choice-table")).append($("#OPP-choice-table-hidden").clone().show().attr("id","OPP-choice-table")).append($("#OPP-choice-table-hidden").clone().show().attr("id","OPP-choice-table"));fOPP();oOPP();abOPP();$("#OPP-poll-embed-code").bind('click',function(){$(this).select();});$("#OPP-embed-options-table input").bind('click',function(){vOPP();});var f=$.farbtastic('#OPP-color-dialog');$('.OPP-color').each(function(){}).focus(function(){$('#OPP-color-dialog').css('display','block').css('top',$(this).position().top).css('left',$(this).position().left+70);f.linkTo(this);}).blur(function(){$('#OPP-color-dialog').css('display','none');});$(".OPP-img-text-toggle").css("opacity","0.5").bind("click",function(){if($(this).css("opacity")=="0.5"){$(this).css("opacity","1");}else{$(this).css("opacity","0.5");}bOPP();});$("#OPP-save-poll-button").bind('click',rOPP).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});$("#OPP-save-as-new-poll-button").bind('click',avOPP).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});$("#OPP-delete-poll-button").bind('click',anOPP).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});azOPP();$("#OPP-new-poll-button").bind('click',ajOPP).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});$("#OPP-clear-poll-button").bind('click',kOPP).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});$("#OPP-invite-button").bind('click',function(){$("#OPP-invite-email").removeClass('ui-state-error');var OPPemails=$("#OPP-invite-email").val();OPPemails=OPPemails.replace(/ /g,"");OPPemails=OPPemails.replace(/;/g,",");var OPPemailValid=true;if(OPPemails.indexOf(",")){var singleEmail=OPPemails.split(",");for(i=0;i<singleEmail.length;i++){if(singleEmail[i].length!=0){if(!iOPP($("#OPP-invite-email").val(singleEmail[i]),true,$("#OPP-invite-tips"))){OPPemailValid=false;break;}}}$("#OPP-invite-email").val(OPPemails);}if(OPPemailValid||iOPP($("#OPP-invite-email"),true,$("#OPP-invite-tips"))){params={command:"sendEmail",email:$("#OPP-invite-email").val(),fromEmail:OPPemail,subject:"EasyPolls invitation",message:$("#OPP-invite-message").val()};$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",timeout:"10000",success:function(data){if(data.resultCode==RESULT_CODE_OK){aOPP('Your invitation was sent.',true,$("#OPP-invite-tips"),8000);$("#OPP-invite-email").val("");return;}else{aOPP('An error has occurred. Please try again later.',true,$("#OPP-invite-tips"));return;}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-invite-tips"));}});}}).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});kOPP();$("#OPP-dialog-login").dialog({bgiframe:true,autoOpen:false,height:285,modal:true,show:'fold',hide:'fold',close:function(){$("#OPP-login-password").val('');eOPP();},open:function(){if(OPPemail){$("#OPP-login-email").val(OPPemail);}setTimeout(function(){if($("#OPP-login-email").attr("readonly")){$("#OPP-login-password").focus();}else{$("#OPP-login-email").focus();}},1000);$("#OPP-login-email").focus();tOPP($('[aria-labelledby$=OPP-dialog-login]').find(":button:contains('Login')"),OPP_ENTER_KEY);}});$("#OPP-dialog-new-password").dialog({bgiframe:true,autoOpen:false,modal:true,show:'fold',hide:'fold',close:function(){$("#OPP-new-password1").val('');$("#OPP-new-password2").val('');eOPP();},open:function(){setTimeout(function(){$("#OPP-new-password1").focus();},1000);$("#OPP-new-password1").focus();tOPP($('[aria-labelledby$=OPP-dialog-login]').find(":button:contains('Set new password')"),OPP_ENTER_KEY);},buttons:{'Set new password':function(){var bValid=true;$("#OPP-new-password1").removeClass('ui-state-error');$("#OPP-new-password2").removeClass('ui-state-error');bValid=bValid&&qOPP($("#OPP-new-password1"),true,$("#OPP-new-password-tips"));bValid=bValid&&sOPP($("#OPP-new-password1"),$("#OPP-new-password2"),true,$("#OPP-new-password-tips"));if(bValid){acOPP();}}}});$('#OPP-login-request-password-field').click(function(){$('#OPP-dialog-login').dialog('option','hide',null);$('#OPP-dialog-login').dialog('option','show',null);$('#OPP-dialog-login').dialog('close');$('#OPP-dialog-login').dialog('option','hide','fold');$('#OPP-dialog-request-password').dialog('open');});$('#OPP-login-logout').click(function(){if($(this).hasClass('OPP-login')){$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true);},Cancel:function(){$(this).dialog('close');}}).dialog('open');}else{COPP();}});$('#OPP-register-login-field').click(function(){$('#OPP-dialog-account').dialog('option','hide',null).dialog('option','show',null).dialog('close').dialog('option','hide','fold').dialog('option','show','fold');$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true);},Cancel:function(){$(this).dialog('close');}}).dialog('open');});$('#OPP-contact-us').click(function(){aOPP("All feedback and bug reports are welcome.",false,$("#OPP-send-email-validate-tips"));$('#OPP-dialog-send-email').dialog('open');$("#OPP-subject").val("EasyPolls user message");$("#OPP-to-email").val("poll@easypolls.net");$("#OPP-from-email").val(OPPemail);});$('#OPP-dialog-send-email').dialog({autoOpen:false,show:'fold',hide:'fold',modal:'true',buttons:{'Send email':function(){$("#OPP-send-email").removeClass('ui-state-error');if(iOPP($("#OPP-to-email"),true,$("#OPP-send-email-validate-tips"))){params={command:"sendEmail",email:$("#OPP-to-email").val(),fromEmail:$("#OPP-from-email").val(),subject:$("#OPP-subject").val(),message:$("#OPP-send-email-message").val()};$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",timeout:"10000",success:function(data){if(data.resultCode==RESULT_CODE_OK){$('#OPP-dialog-send-email').dialog('close');pOPP('Message sent','Your message was sent.');return;}else{aOPP('An error has occurred. Please try again later.',true,$("#OPP-send-email-validate-tips"));return;}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-send-email-validate-tips"));}});}}},close:function(){$("#OPP-send-email-message").val('');}});$('#OPP-dialog-send-email').bind('keyup',function(e){if(!((e.which&&e.which==OPP_ENTER_KEY)||(e.keyCode&&e.keyCode==OPP_ENTER_KEY))){OPPallRegistrationFormFields.removeClass('ui-state-error');}});$('#OPP-login-register-field').click(function(){$('#OPP-dialog-login').dialog('option','hide',null).dialog('option','show',null).dialog('close').dialog('option','hide','fold').dialog('option','show','fold');$('#OPP-dialog-account').dialog('open');});$("#OPP-confirm-message").dialog({autoOpen:false,show:'scale',hide:'scale',modal:'true',buttons:{'Ok':function(){$(this).dialog('close');}}});$("#OPP-warning-message").dialog({autoOpen:false,show:'scale',hide:'scale',modal:'true',buttons:{'Ok':function(){$(this).dialog('close');}}});$("#OPP-dialog-account").dialog({bgiframe:true,autoOpen:false,height:370,width:325,modal:true,show:'fold',hide:'fold',buttons:{'Create an account':function(){var bValid=true;OPPallRegistrationFormFields.removeClass('ui-state-error');bValid=bValid&&iOPP($("#OPP-register-email"),true,$("#OPP-register-validate-tips"));bValid=bValid&&qOPP($("#OPP-register-password"),true,$("#OPP-register-validate-tips"));bValid=bValid&&sOPP($("#OPP-register-password"),$("#OPP-register-password-2"),true,$("#OPP-register-validate-tips"));if(bValid&&$("#OPP-register-license").is(':not(:checked)')){bValid=false;aOPP("Please accept the license agreement to create an account.",true,$("#OPP-register-validate-tips"));}if(bValid){aCOPP($("#OPP-register-email"),true);}},Cancel:function(){$(this).dialog('close');}},close:function(){OPPallRegistrationFormFields.val('').removeClass('ui-state-error');eOPP();if(!pollUserId){$("#OPP-save-poll-button").text("Save").attr('disabled',false);}},open:function(){setTimeout(function(){$("#OPP-register-email").focus()},1000);$("#OPP-register-email").focus();tOPP($('[aria-labelledby$=OPP-dialog-account]').find(":button:contains('Create')"),OPP_ENTER_KEY);}});$('#OPP-register-email').bind('keyup',function(e){if(!((e.which&&e.which==OPP_ENTER_KEY)||(e.keyCode&&e.keyCode==OPP_ENTER_KEY))){OPPallRegistrationFormFields.removeClass('ui-state-error');iOPP($("#OPP-register-email"),false,$("#OPP-register-validate-tips"));}});$('#OPP-register-password').bind('keyup',function(e){if(!((e.which&&e.which==OPP_ENTER_KEY)||(e.keyCode&&e.keyCode==OPP_ENTER_KEY))){OPPallRegistrationFormFields.removeClass('ui-state-error');qOPP($("#OPP-register-password"),false,$("#OPP-register-validate-tips"));}});$('#OPP-register-password-2').bind('keyup',function(e){if(!((e.which&&e.which==OPP_ENTER_KEY)||(e.keyCode&&e.keyCode==OPP_ENTER_KEY))){OPPallRegistrationFormFields.removeClass('ui-state-error');sOPP($("#OPP-register-password"),$("#OPP-register-password-2"),false,$("#OPP-register-validate-tips"));}});$('#OPP-create-account').click(function(){$('#OPP-dialog-account').dialog('open');});$('#OPP-expand-look-feel').click(function(){$(this).hide();$("#OPP-collapse-look-feel").show();$("#OPP-look-feel-settings-table").show("blind");});$('#OPP-collapse-look-feel').click(function(){$(this).hide();$("#OPP-expand-look-feel").show();$("#OPP-look-feel-settings-table").hide("blind");});$("#OPP-dialog-request-password").dialog({bgiframe:true,autoOpen:false,height:200,modal:true,buttons:{'Create new password':function(){atOPP(true);$('#OPP-dialog-login').dialog('option','show','fold');},Cancel:function(){$(this).dialog('close');$("#OPP-dialog-login").dialog('open');$('#OPP-dialog-login').dialog('option','show','fold');}},close:function(){eOPP();},open:function(){aOPP("Type in your e-mail address to request a new password.",false,$("#OPP-request-pw-validate-tips"));$("#OPP-request-pw-email").val($("#OPP-login-email").val()).focus();tOPP($('[aria-labelledby$=OPP-dialog-request-password]').find(":button:contains('Create')"),OPP_ENTER_KEY);}});$('#OPP-update-acc-button').click(function(){TOPP();}).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});$('#OPP-delete-acc-button').click(function(){alOPP();}).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});$('#OPP-validate-email-button').click(function(){auOPP();}).hover(function(){$(this).addClass("ui-state-hover");},function(){$(this).removeClass("ui-state-hover");}).mousedown(function(){$(this).addClass("ui-state-active");}).mouseup(function(){$(this).removeClass("ui-state-active");});});function aEOPP(text){$('#OPP-debug').append(text);};function pOPP(title,content){$("#OPP-confirm-message-value").text(content);$("#OPP-confirm-message").dialog('option','title',title).dialog('option','width','250').dialog('option','height','150').dialog('open');};function yOPP(title,content){$("#OPP-warning-message-value").text(content);$("#OPP-warning-message").dialog('option','title',title).dialog('option','width','250').dialog('option','height','170').dialog('open');};function aDOPP(title,content){$("#OPP-yes-no-message-value").text(content);$("#OPP-yes-no-message").dialog('option','title',title).dialog('option','width','250').dialog('option','height','150').dialog('option','close','destroy').dialog('open');};function mOPP(action){if(action=="login"){$("#OPP-login-email").attr("readonly","readonly");$('#OPP-login-logout').html('Log out').removeClass('OPP-login').addClass('OPP-logout');$('#OPP-create-account').hide();aAOPP();aBOPP();$("#b").unbind('click',lOPP);$("#c").unbind('click',lOPP);$("#d").unbind('click',lOPP);$("#OPP-invite-message").val(OPPinviteMessage);}else if(action=="logout"){OPPaccStatus="LOGGEDOUT";$("#OPP-login-email").attr("readonly","");$('#OPP-login-logout').addClass('OPP-login').removeClass('OPP-logout').html('Log in');$('#OPP-create-account').show();$('#OPP-welcome-msg').hide();$("#b").bind('click',lOPP);$("#c").bind('click',lOPP);$("#d").bind('click',lOPP);$("#OPP-invite-message").val("");$("#OPP-invite-email").val("");}UOPP();};$(function(){$("#tabset1").buildMbTabset({sortable:false,position:"right"});$("#tabset2").buildMbTabset({sortable:false});});function lOPP(){$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){$(this).dialog('option','close',function(){$("#OPP-login-password").val('');eOPP();});dOPP(true);},Cancel:function(){$(this).dialog('close');}}).dialog('option','close',function(){$("#OPP-login-password").val('');eOPP();$("#a").click();$(this).dialog('option','close',function(){$("#OPP-login-password").val('');eOPP();});}).dialog('open');};function aoOPP(element,cssClass){$(element).addClass(cssClass);};function ayOPP(element,cssClass){$(element).removeClass(cssClass);};function aOPP(text,highlight,OPPtips,millis){if(0<OPPtips.data("timeoutId")){clearTimeout(OPPtips.data("timeoutId"));}if(highlight){OPPtips.text(text).effect("highlight",{},1500);}else{if(text=='&nbsp;'){OPPtips.html(text);}else{OPPtips.text(text);}}if(0<millis){asOPP(OPPtips,millis);}};function asOPP(jqueryElement,millis){var timeoutId=setTimeout(function(){jqueryElement.html("&nbsp;");},millis);jqueryElement.data("timeoutId",timeoutId);};function cOPP(elementName,newAttributes){var defaultAttribues={content:{text:false,title:{text:false}},show:'mouseover',hide:'mouseout',position:{adjust:{screen:true}},style:{name:"blue",tip:true,title:{'font-size':12},'font-size':12},show:{delay:600,solo:true}};if(!newAttributes){newAttributes={};}var attributes={};$.extend(true,attributes,defaultAttribues,newAttributes);$(elementName).qtip(attributes);};function nOPP(title,content){return{content:{text:content,title:{text:title}}}};function ZOPP(){$("#OPP-warning-message-value").text('You can not send invitations before your e-mail address has been validated. If you have lost your activation code, you can generate a new from the "Account" tab.');$('#OPP-warning-message').dialog('option','title','Invitations unavailable').dialog('option','close',function(){$("#d").click();$(this).dialog('option','close',function(){});}).dialog('open');};function UOPP(){if(OPPaccStatus=="NOTCONFIRMED"){$("#d").html("<span>Account*</span>").css("color","red");$(".OPP-not-validated").show();$("#c").bind('click',ZOPP);$("OPP-publish-info").hide();}else{$("#d").html("<span>Account</span>").css("color","");$(".OPP-not-validated").hide();$("#c").unbind('click',ZOPP);}};function tOPP(OPPbutton,OPPkey){eOPP();$(document).keypress(function(e){if((e.which&&e.which==OPPkey)||(e.keyCode&&e.keyCode==OPPkey)){if($("button.ui-state-focus :visible").length==0){OPPbutton.click();return false;}else{return true;}}});};function eOPP(){$(document).unbind('keypress');};function dOPP(highlight,OPPcallbackFunction){var params={command:"login",email:$("#OPP-login-email").val(),password:$("#OPP-login-password").val()};$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",timeout:"10000",success:function(data,textStatus){if(data.resultCode==RESULT_CODE_OK){if(data.result=='true'){$('#OPP-dialog-login').dialog('close');if(pollUserId!=data.pollUserId){pollUserId=data.pollUserId;OPPpollAddress=data.serverAddress;OPPpollPage=data.connectorPollPage;OPPpollPageJsp=data.connectorPollPageJsp;OPPembedScript=data.embedScript;OPPaccStatus=data.accountStatus;mOPP("login");}if(data.changePasswordRequired=='true'){$("#OPP-dialog-new-password").dialog('open');}if(OPPcallbackFunction){OPPcallbackFunction();}return;}else{aOPP('Invalid login.',highlight,$("#OPP-login-validate-tips"));return;}}aOPP('An error has occurred. Please try again later. ErrorCode: '+data.resultCode,true,$("#OPP-login-validate-tips"));},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-login-validate-tips"));}});};function COPP(){var params={command:"logout"};$.getJSON(OPP_PG_BASEURL,params,function(data){if(data.resultCode==0){$("#a").click();pollUserId="";mOPP("logout");OPPemail="";kOPP();arOPP();QOPP()}});};function azOPP(){var params={command:"isLoggedIn"};$.getJSON(OPP_PG_BASEURL,params,function(data){if(data.resultCode==0&&data.result=='true'){pollUserId=data.pollUserId;OPPpollAddress=data.serverAddress;OPPpollPage=data.connectorPollPage;OPPpollPageJsp=data.connectorPollPageJsp;OPPembedScript=data.embedScript;OPPaccStatus=data.accountStatus;mOPP("login");}else{pollUserId="";mOPP("logout");}});};var styles={lightBlueStyle:{},lightGrayStyle:{},lightRedStyle:{},lightRedStyle:{},lightGreenStyle:{},lightPurpleStyle:{},lightPinkStyle:{},blackWhiteStyle:{},greyRedStyle:{},goldenStyle:{},greenStyle:{},blueGrayStyle:{},lightYellowStyle:{},orangeStyle:{},};var defaultStyleAttributes={image:"images/thumbMissing.png",divAroundPollBgColor:"",divAroundPollWidth:"",divAroundPollBorderLeft:"",divAroundPollBorderRight:"",divAroundPollBorderTop:"",divAroundPollBorderBottom:"",divAroundPollMarginLeft:"",divAroundPollMarginRight:"",divAroundPollMarginTop:"",divAroundPollMarginBottom:"",divAroundPollPaddingLeft:"10px",divAroundPollPaddingRight:"10px",divAroundPollPaddingTop:"10px",divAroundPollPaddingBottom:"10px",pollTableBorderSpacing:"0",pollTableBorderLeft:"",pollTableBorderRight:"",pollTableBorderTop:"",pollTableBorderBottom:"",pollTableMarginLeft:"",pollTableMarginRight:"",pollTableMarginTop:"",pollTableMarginBottom:"",pollTablePaddingLeft:"",pollTablePaddingRight:"",pollTablePaddingTop:"",pollTablePaddingBottom:"",pollTitleFontFamily:"Arial",pollTitleFontSize:"10pt",pollTitleFontStyle:"normal",pollTitleFontWeight:"bold",pollTitleColor:"",pollTitleTextAlign:"center",pollTitleBorderLeft:"",pollTitleBorderRight:"",pollTitleBorderTop:"",pollTitleBorderBottom:"",pollTitlePaddingLeft:"",pollTitlePaddingRight:"",pollTitlePaddingTop:"",pollTitlePaddingBottom:"",pollTitleBgColor:"",pollQuestionFontFamily:"Arial",pollQuestionFontSize:"10pt",pollQuestionFontStyle:"normal",pollQuestionFontWeight:"normal",pollQuestionColor:"",pollQuestionBorderLeft:"",pollQuestionBorderRight:"",pollQuestionBorderTop:"",pollQuestionBorderBottom:"",pollQuestionPaddingLeft:"",pollQuestionPaddingRight:"",pollQuestionPaddingTop:"",pollQuestionPaddingBottom:"3px",pollQuestionBgColor:"",pollChoiceButtonBorderLeft:"",pollChoiceButtonBorderRight:"",pollChoiceButtonBorderTop:"",pollChoiceButtonBorderBottom:"",pollChoiceButtonPaddingLeft:"",pollChoiceButtonPaddingRight:"",pollChoiceButtonPaddingTop:"",pollChoiceButtonPaddingBottom:"",pollChoiceButtonTextAlign:"right",pollChoiceButtonVAlign:"top",pollChoiceButtonBgColor:"",pollChoiceTextColor:"",pollChoiceTextFontFamily:"Arial",pollChoiceTextFontSize:"8pt",pollChoiceTextFontStyle:"normal",pollChoiceTextFontWeight:"normal",pollChoiceTextBorderLeft:"",pollChoiceTextBorderRight:"",pollChoiceTextBorderTop:"",pollChoiceTextBorderBottom:"",pollChoiceTextPaddingLeft:"",pollChoiceTextPaddingRight:"",pollChoiceTextPaddingTop:"2px",pollChoiceTextPaddingBottom:"",pollChoiceTextPaddingRight:"",pollChoiceTextTextAlign:"left",pollChoiceTextVAlign:"top",pollChoiceTextBgColor:"",pollVoteAlign:"center",pollVoteFontFamily:"Arial",pollVoteFontSize:"8pt",pollVoteFontStyle:"normal",pollVoteFontWeight:"normal",pollVoteColor:"",pollVoteBorderLeft:"",pollVoteBorderRight:"",pollVoteBorderTop:"",pollVoteBorderBottom:"",pollVotePaddingLeft:"",pollVotePaddingRight:"",pollVotePaddingTop:"",pollVotePaddingBottom:"",pollResultLinkTextColor:"",pollResultLinkTextFontFamily:"Arial",pollResultLinkTextFontSize:"7pt",pollResultLinkTextFontStyle:"normal",pollResultLinkTextFontWeight:"normal",pollResultLinkTextMarginRight:"",pollVoteButtonFontFamily:"Arial",pollVoteButtonFontSize:"10pt",pollVoteButtonFontStyle:"normal",pollVoteButtonFontWeight:"normal",pollVoteButtonColor:"#000",pollVoteButtonBorder:"",pollVoteButtonPadding:"",chartBarFilledColor:"#555",chartBarFilledBorderColor:"#333",chartBarNotFilledColor:"#bbb",chartBarNotFilledBorderColor:"#aaa",chartBarHeight:"5",cornersStyle:"10px",maxPollWidth:200};$.extend(true,styles.lightBlueStyle,defaultStyleAttributes,{image:"images/themes/lightBlueStyle.png",divAroundPollBgColor:"#CEE7FF",pollTitleColor:"#466D92",pollQuestionColor:"#466D92",pollChoiceTextColor:"#466D92",pollResultLinkTextColor:"#466D92",chartBarFilledColor:"#555",chartBarFilledBorderColor:"#333",chartBarNotFilledColor:"#bbb",chartBarNotFilledBorderColor:"#aaa"});$.extend(true,styles.lightGrayStyle,defaultStyleAttributes,{image:"images/themes/lightGrayStyle.png",divAroundPollBgColor:"#ccc",pollTitleColor:"#777",pollQuestionColor:"#444",pollChoiceTextColor:"#444",pollResultLinkTextColor:"#444",chartBarFilledColor:"#555",chartBarFilledBorderColor:"#333",chartBarNotFilledColor:"#bbb",chartBarNotFilledBorderColor:"#aaa"});$.extend(true,styles.lightRedStyle,defaultStyleAttributes,{image:"images/themes/lightRedStyle.png",divAroundPollBgColor:"#FFCECE",pollTitleColor:"#774A4A",pollQuestionColor:"#774A4A",pollChoiceTextColor:"#774A4A",pollResultLinkTextColor:"#774A4A",chartBarFilledColor:"#824040",chartBarFilledBorderColor:"#824040",chartBarNotFilledColor:"#d8c0c0",chartBarNotFilledBorderColor:"#cfb0b0"});$.extend(true,styles.lightGreenStyle,defaultStyleAttributes,{image:"images/themes/lightGreenStyle.png",divAroundPollBgColor:"#D3FED3",pollTitleColor:"#4D5F4D",pollQuestionColor:"#4D5F4D",pollChoiceTextColor:"#4D5F4D",pollResultLinkTextColor:"#4D5F4D",chartBarFilledColor:"#4D5F4D",chartBarFilledBorderColor:"#4D5F4D",chartBarNotFilledColor:"#d6e1d6",chartBarNotFilledBorderColor:"#c7d6c7"});$.extend(true,styles.lightPurpleStyle,defaultStyleAttributes,{image:"images/themes/lightPurpleStyle.png",divAroundPollBgColor:"#EECAFF",pollTitleColor:"#65556D",pollQuestionColor:"#65556D",pollChoiceTextColor:"#65556D",pollResultLinkTextColor:"#65556D",chartBarFilledColor:"#806a8a",chartBarFilledBorderColor:"#65556D",chartBarNotFilledColor:"#cdc0d3",chartBarNotFilledBorderColor:"#c3b4cb"});$.extend(true,styles.lightPinkStyle,defaultStyleAttributes,{image:"images/themes/lightPinkStyle.png",divAroundPollBgColor:"#FFCEF1",pollTitleColor:"#7D5472",pollQuestionColor:"#7D5472",pollChoiceTextColor:"#7D5472",pollResultLinkTextColor:"#7D5472",chartBarFilledColor:"#9c6d8f",chartBarFilledBorderColor:"#8f6182",chartBarNotFilledColor:"#ddc0d5",chartBarNotFilledBorderColor:"#d2acc8"});$.extend(true,styles.blackWhiteStyle,defaultStyleAttributes,{image:"images/themes/blackWhiteStyle.png",divAroundPollBgColor:"#000000",pollTitleColor:"#ffffff",pollQuestionColor:"#ffffff",pollChoiceTextColor:"#ffffff",pollResultLinkTextColor:"#ffffff",chartBarFilledColor:"#404040",chartBarFilledBorderColor:"#969696",chartBarNotFilledColor:"#bbbbbb",chartBarNotFilledBorderColor:"#969696",chartBarHeight:"5",pollTitleFontFamily:"Times New Roman",pollTitleFontSize:"10pt",pollTitleFontWeight:"bold",pollQuestionFontFamily:"Times New Roman",pollQuestionFontSize:"10pt",pollQuestionFontWeight:"bold",pollChoiceTextFontFamily:"Times New Roman",pollChoiceTextFontSize:"10pt"});$.extend(true,styles.greyRedStyle,defaultStyleAttributes,{image:"images/themes/greyRedStyle.png",divAroundPollBgColor:"#f5f5f5",pollTitleColor:"#9d3100",pollQuestionColor:"#9d3100",pollChoiceTextColor:"#9d3100",pollResultLinkTextColor:"#9d3100",pollResultLinkTextFontFamily:"Georgia",pollVoteButtonFontFamily:"Georgia",chartBarFilledColor:"#806666",chartBarFilledBorderColor:"#9d3100",chartBarNotFilledColor:"#f5f5f5",chartBarNotFilledBorderColor:"#9d3100",chartBarHeight:"7",pollTitleFontFamily:"Verdana",pollTitleFontSize:"9pt",pollTitleFontWeight:"bold",pollQuestionFontFamily:"Verdana",pollQuestionFontSize:"9pt",pollQuestionFontWeight:"bold",pollChoiceTextFontFamily:"Verdana",pollChoiceTextFontSize:"8pt",cornersStyle:"0px",divAroundPollPaddingTop:"7px",divAroundPollPaddingBottom:"3px"});$.extend(true,styles.goldenStyle,defaultStyleAttributes,{image:"images/themes/goldenStyle.png",divAroundPollBgColor:"#d2d57c",divAroundPollPaddingTop:"3px",divAroundPollPaddingBottom:"3px",divAroundPollPaddingLeft:"5px",divAroundPollPaddingRight:"5px",pollTitleColor:"#898501",pollTitleFontFamily:"Georgia",pollTitleFontSize:"9pt",pollQuestionColor:"#898501",pollQuestionFontFamily:"Georgia",pollQuestionFontSize:"9pt",pollQuestionFontWeight:"bold",pollChoiceTextColor:"#898501",pollChoiceTextFontFamily:"Verdana",pollResultLinkTextColor:"#9d9901",pollResultLinkTextFontFamily:"Courier New",pollResultLinkTextFontSize:"9pt",pollVoteButtonFontFamily:"Georgia",chartBarFilledColor:"#898501",chartBarFilledBorderColor:"#9d9901",chartBarNotFilledColor:"#f5f5f5",chartBarNotFilledBorderColor:"#9d9901",chartBarHeight:"7",cornersStyle:"2px"});$.extend(true,styles.greenStyle,defaultStyleAttributes,{image:"images/themes/greenStyle.png",divAroundPollBgColor:"#99db95",pollTitleColor:"#774A4A",pollQuestionColor:"#1b4918",pollChoiceTextColor:"#1b4918",pollResultLinkTextColor:"#1b4918",chartBarFilledColor:"#419c3a",chartBarFilledBorderColor:"#419c3a",chartBarNotFilledColor:"#9ab899",chartBarNotFilledBorderColor:"#9ab899"});$.extend(true,styles.blueGrayStyle,defaultStyleAttributes,{image:"images/themes/blueGrayStyle.png",divAroundPollBgColor:"#6a8daf",pollTitleColor:"#466D92",pollQuestionFontWeight:"bold",pollQuestionColor:"#f1f5f9",pollChoiceTextColor:"#f1f5f9",pollResultLinkTextColor:"#f1f5f9",chartBarFilledColor:"#d2dce4",chartBarFilledBorderColor:"#d2dce4",chartBarNotFilledColor:"#86a1bb",chartBarNotFilledBorderColor:"#86a1bb",cornersStyle:"7px"});$.extend(true,styles.lightYellowStyle,defaultStyleAttributes,{image:"images/themes/lightYellowStyle.png",divAroundPollBgColor:"#fffc8a",pollTitleColor:"#774A4A",pollChoiceTextColor:"#4d4b00",pollResultLinkTextColor:"#4d4b00",chartBarFilledColor:"#c5c011",chartBarFilledBorderColor:"#c5c011",chartBarNotFilledColor:"#f8f7af",chartBarNotFilledBorderColor:"#e3e2ab",chartBarHeight:"6",cornersStyle:"7px"});$.extend(true,styles.orangeStyle,defaultStyleAttributes,{image:"images/themes/orangeStyle.png",divAroundPollBgColor:"#ffd280",pollTitleFontWeight:"bold",pollTitleColor:"#774A4A",pollQuestionColor:"#754c00",pollChoiceTextColor:"#754c00",pollResultLinkTextColor:"#754c00",chartBarFilledColor:"#cc8300",chartBarFilledBorderColor:"#cc8300",chartBarNotFilledColor:"#ffe4b3",chartBarNotFilledBorderColor:"#ffdea3",chartBarHeight:"6",cornersStyle:"7px"});function aqOPP(){jQuery.each(styles,function(theme,themeContent){$('#OPP-look-feel-td').append('<img src="'+themeContent.image+'" border="0" style="cursor: pointer;" class="OPP-tooltip-mouse" title="Set this style"> ').children(':last').css('padding','3px').bind('click',theme,agOPP).addClass('OPP-preview-thumb');});};function agOPP(event){pollData.style=$.extend(true,{},eval('styles.'+event.data));LOPP();};function LOPP(){$("#OPP-corner-radius").slider('value',pollData.style.cornersStyle.substring(0,pollData.style.cornersStyle.length-2));$("#OPP-corner-radius-value").text(pollData.style.cornersStyle);$("#OPP-bg-color").val(pollData.style.divAroundPollBgColor);$("#OPP-question-text-color").val(pollData.style.pollQuestionColor);$("#OPP-choice-text-color").val(pollData.style.pollChoiceTextColor);$("#OPP-see-results-text-color").val(pollData.style.pollResultLinkTextColor);$("#OPP-vote-button-text-color").val(pollData.style.pollVoteButtonColor);$("#OPP-opt-max-poll-width").slider('value',pollData.style.maxPollWidth);$("#OPP-opt-max-poll-width-value").text(pollData.style.maxPollWidth+"px");$("#OPP-chart-bar-filled-color").val(pollData.style.chartBarFilledColor);$("#OPP-chart-bar-filled-border-color").val(pollData.style.chartBarFilledBorderColor);$("#OPP-chart-bar-not-filled-color").val(pollData.style.chartBarNotFilledColor);$("#OPP-chart-bar-not-filled-border-color").val(pollData.style.chartBarNotFilledBorderColor);$("#OPP-chart-bar-height").val(pollData.style.chartBarHeight);$("#OPP-padding-left").slider('value',pollData.style.divAroundPollPaddingLeft.substring(0,pollData.style.divAroundPollPaddingLeft.length-2));$("#OPP-padding-left-value").text(pollData.style.divAroundPollPaddingLeft);$("#OPP-padding-right").slider('value',pollData.style.divAroundPollPaddingRight.substring(0,pollData.style.divAroundPollPaddingRight.length-2));$("#OPP-padding-right-value").text(pollData.style.divAroundPollPaddingRight);$("#OPP-padding-top").slider('value',pollData.style.divAroundPollPaddingTop.substring(0,pollData.style.divAroundPollPaddingTop.length-2));$("#OPP-padding-top-value").text(pollData.style.divAroundPollPaddingTop);$("#OPP-padding-bottom").slider('value',pollData.style.divAroundPollPaddingBottom.substring(0,pollData.style.divAroundPollPaddingBottom.length-2));$("#OPP-padding-bottom-value").text(pollData.style.divAroundPollPaddingBottom);$("#OPP-question-text-font").val(pollData.style.pollQuestionFontFamily);$("#OPP-question-text-size").val(pollData.style.pollQuestionFontSize.substring(0,pollData.style.pollQuestionFontSize.length-2));if(pollData.style.pollQuestionFontWeight=="bold"){$("#OPP-question-text-bold").css("opacity","1");}else{$("#OPP-question-text-bold").css("opacity","0.5");}if(pollData.style.pollQuestionFontStyle=="italic"){$("#OPP-question-text-italic").css("opacity","1");}else{$("#OPP-question-text-italic").css("opacity","0.5");}$("#OPP-choice-text-font").val(pollData.style.pollChoiceTextFontFamily);$("#OPP-choice-text-size").val(pollData.style.pollChoiceTextFontSize.substring(0,pollData.style.pollChoiceTextFontSize.length-2));if(pollData.style.pollChoiceTextFontWeight=="bold"){$("#OPP-choice-text-bold").css("opacity","1");}else{$("#OPP-choice-text-bold").css("opacity","0.5");}if(pollData.style.pollChoiceTextFontStyle=="italic"){$("#OPP-choice-text-italic").css("opacity","1");}else{$("#OPP-choice-text-italic").css("opacity","0.5");}$("#OPP-see-results-text-font").val(pollData.style.pollResultLinkTextFontFamily);$("#OPP-see-results-text-size").val(pollData.style.pollResultLinkTextFontSize.substring(0,pollData.style.pollResultLinkTextFontSize.length-2));if(pollData.style.pollResultLinkTextFontWeight=="bold"){$("#OPP-see-results-text-bold").css("opacity","1");}else{$("#OPP-see-results-text-bold").css("opacity","0.5");}if(pollData.style.pollResultLinkTextFontStyle=="italic"){$("#OPP-see-results-text-italic").css("opacity","1");}else{$("#OPP-see-results-text-italic").css("opacity","0.5");}$("#OPP-vote-button-text-font").val(pollData.style.pollVoteButtonFontFamily);$("#OPP-vote-button-text-size").val(pollData.style.pollVoteButtonFontSize.substring(0,pollData.style.pollVoteButtonFontSize.length-2));if(pollData.style.pollVoteButtonFontWeight=="bold"){$("#OPP-vote-button-text-bold").css("opacity","1");}else{$("#OPP-vote-button-text-bold").css("opacity","0.5");}if(pollData.style.pollVoteButtonFontStyle=="italic"){$("#OPP-vote-button-text-italic").css("opacity","1");}else{$("#OPP-vote-button-text-italic").css("opacity","0.5");}jOPP();bOPP();};function gOPP(elem,valueElem,minValue,maxValue,step,defaultValue){elem.slider({range:"min",step:step,min:minValue,max:maxValue,value:defaultValue,orientation:"horizontal",slide:function(event,ui){valueElem.text(ui.value+'px');bOPP();jOPP();}});valueElem.text(defaultValue+'px');};function aAOPP(){QOPP();$.ajax({url:OPP_PG_BASEURL+"?command=getPolls",type:"GET",dataType:"json",timeout:"20000",success:function(obj,textStatus){if(obj.resultCode==RESULT_CODE_OK){jQuery.each(obj.polls,function(pollId,pollName){xOPP(pollId,pollName);});uOPP();}else{aOPP("Error occurred, error code: "+obj.resultCode,true,$("#OPP-my-polls-validate-tips"));}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-my-polls-validate-tips"));}});};function xOPP(pollId,pollName){var isInserted=false;$("#OPP-my-polls-table .OPP-pollName").each(function(i){if($(this).text().toUpperCase()>pollName.toUpperCase()){$(this).parent().before("<tr id='"+pollId+"'><td class='OPP-pollName' title='Click to edit this poll.'>"+pollName+"</td><td class='OPP-showPoll' title='Click to view/hide the poll, and its results.'>show</td><td class='OPP-deletePoll' title='Click to delete the poll. The poll can NOT be recovered.'>delete</td></tr>");$("#"+pollId).bind('click',pollId,EOPP);isInserted=true;VOPP($(this).parent().prev());return false;}});if(!isInserted){$("#OPP-my-polls-table").append("<tr id='"+pollId+"'><td class='OPP-pollName' title='Click to edit this poll.'>"+pollName+"</td><td class='OPP-showPoll' title='Click to view/hide the poll, and its results.'>show</td><td class='OPP-deletePoll' title='Click to delete the poll. The poll can NOT be recovered.'>delete</td></tr>").find('tr:last > td').bind('click',pollId,EOPP);VOPP($("#"+pollId));}};function VOPP(element){cOPP(element.find('.OPP-pollName'),{position:{adjust:{x: -10,y: -10}}});cOPP(element.find('.OPP-showPoll'),{position:{adjust:{x: -10,y: -10}}});cOPP(element.find('.OPP-deletePoll'),{position:{adjust:{x: -10,y: -10}}});};function HOPP(pollId){if($("#"+pollId).next().hasClass('OPP-poll-preview-result')){$("#"+pollId).next().remove();}$("#"+pollId+" td").unbind('click');$("#"+pollId).remove();uOPP();};function QOPP(){$("#OPP-my-polls-table > tbody > tr ").remove();uOPP();};function uOPP(){if(0<$("#OPP-my-polls-table td").length){$("#OPP-my-polls-table .OPP-hidePoll").click();$("#OPP-my-polls-table tr:nth-child(even)").css("background-color","#EFF8FE");$("#OPP-my-polls-table tr:nth-child(odd)").css("background-color","#F7FBFF");$("#OPP-my-polls-table tr:first").css("background-color","").css("color","#6fa7d1");$("#OPP-my-polls-table td").css("padding","3px").css("border","1px solid").css("border-color","#E4F0F8").css("cursor","pointer");$("#OPP-my-polls-table tr:first > td").css("border","0px").css("padding","4px");$("#OPP-no-polls-text").hide();$("#OPP-my-polls-table").show();}else{$("#OPP-no-polls-text").show();$("#OPP-my-polls-table").hide();}};function EOPP(event){if($(event.target).hasClass('OPP-pollName')){amOPP(event.data);}else if($(event.target).hasClass('OPP-showPoll')){aaOPP(event);}else if($(event.target).hasClass('OPP-hidePoll')){$(event.target).html("show").toggleClass('OPP-showPoll').toggleClass('OPP-hidePoll');$(event.target).parent().next().animate({height:0},function(){$(this).remove();}).html("");}else if($(event.target).hasClass('OPP-deletePoll')){POPP(event.data);}};function aaOPP(event){$(event.target).html("hide").toggleClass('OPP-showPoll').toggleClass('OPP-hidePoll');$(event.target).parent().after('<tr height="1" class="OPP-poll-preview-result"><td colspan="3" ></td></tr>');$(event.target).parent().next().animate({height:200},function(){$(this).children().html("<table style='width:100%; padding: 5px;'><tr><td valign='top' align='center'><div id='OPP-poll-id-"+event.data+"p' style='width:200px;'>Loading...</td><td valign='top' align='center' id='OPP-poll-td-id-"+event.data+"p'></td></table>").hide().fadeIn();ahOPP(event);});};function ahOPP(event){$.ajax({url:OPP_PG_BASEURL+"?command=getPoll&pollId="+event.data,type:"GET",dataType:"json",timeout:"10000",success:function(data,textStatus){if(data.resultCode==RESULT_CODE_OK){var tmpstyle;data.style={};eval("tmpstyle = "+data.styleString);$.extend(true,data.style,defaultStyleAttributes,tmpstyle);data.pollId=data.pollId+"p";zOPP(data,true);$("*",$("#OPP-poll-id-"+data.pollId)).unbind("click");$("#OPP-poll-td-id-"+data.pollId).html($("#OPP-poll-id-"+data.pollId).clone("true").attr("id","OPP-poll-id-"+data.pollId+"r"));data.pollId=data.pollId+"r";var attributes=new Object();attributes.data=data;hOPP(attributes);$("*",$("#OPP-poll-id-"+data.pollId)).unbind("click");}else if(data.resultCode==RESULT_CODE_NOT_LOGGED_IN){$(event.target).html("show").toggleClass('OPP-showPoll').toggleClass('OPP-hidePoll');$(event.target).parent().next().animate({height:0},function(){$(this).remove();}).html("");$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true);aaOPP(event);},Cancel:function(){$(this).dialog('close');}}).dialog('open');}else{aOPP("Error occurred, error code: "+data.resultCode,true,$("#OPP-my-polls-validate-tips"));}},error:function(XMLHttpRequest,textStatus){$(event.target).html("show").toggleClass('OPP-showPoll').toggleClass('OPP-hidePoll');$(event.target).parent().next().animate({height:0},function(){$(this).remove();}).html("");aOPP("Error occurred, status: "+textStatus,true,$("#OPP-my-polls-validate-tips"));}});};function POPP(pollId){$("#OPP-yes-no-message-value").text("Are you sure you want to delete the poll?");$("#OPP-yes-no-message").dialog({autoOpen:false,show:'scale',hide:'scale',modal:'true',title:'Confirm delete',close:function(){$(this).dialog('destroy');},buttons:{'Yes':function(){$(this).dialog('close');$.ajax({url:OPP_PG_BASEURL+"?command=deletePoll&pollId="+pollId,type:"GET",dataType:"json",timeout:"5000",success:function(obj,textStatus){if(obj.resultCode==RESULT_CODE_OK){HOPP(obj.pollId);if(pollData.pollId==pollId){kOPP();aOPP("Poll was deleted.",true,$("#OPP-design-poll-tips"));}aOPP("Poll was deleted.",true,$('#OPP-my-polls-validate-tips'),10000);}else if(obj.resultCode==RESULT_CODE_NOT_LOGGED_IN){$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true);},Cancel:function(){$(this).dialog('close');}}).dialog('open');}else{aOPP("Could not delete poll. Code: "+obj.resultCode,true,$("#OPP-my-polls-validate-tips"));}},error:function(data){aOPP("Could not delete poll",true,$("#OPP-my-polls-validate-tips"));}});},'No':function(){$(this).dialog('close');}}}).dialog("open");};function ajOPP(){$('#a').click();kOPP();};function amOPP(pollId){var params={command:"getPoll",pollId:pollId};$.ajax({url:OPP_PG_BASEURL,type:"GET",data:params,dataType:"json",timeout:"10000",success:function(data){if(data.resultCode==RESULT_CODE_OK){$('#a').click();var tmpstyle;pollData.style={};eval("tmpstyle = "+data.styleString);$.extend(true,pollData.style,defaultStyleAttributes,tmpstyle);LOPP();$('#OPP-question-text').val(data.question);pollData.question=data.question;for(i=0;i<$("#OPP-choice-tables input").size();i++){eval('pollData.choice'+i+'= ""');}while($("#OPP-choice-tables input").size()>3){$("OPP-choice-tables").append($("#OPP-choice-tables").children(":first").remove());}var choiceNumber=0;var choiceText=eval("data.choice"+choiceNumber);while(choiceText){eval('$("#OPP-choice-tables input:eq('+choiceNumber+')").val(choiceText)');SOPP();choiceNumber++;choiceText=eval("data.choice"+choiceNumber);}fOPP();oOPP();if(data.pollChoiceType=="checkbox"){$('#OPP-opt-multiple-selections').attr('checked',true);}else{$('#OPP-opt-multiple-selections').attr('checked',false);}$('#OPP-opt-vote-button-label').val(data.voteButtonText);$('#OPP-opt-see-results-label').val(data.resultLinkText);$('#OPP-opt-total-votes-label').val(data.totalVotesText);if(data.antiCheatLevel=="2"){$('#OPP-opt-advanced-anti-cheat').attr('checked',true);}else{$('#OPP-opt-advanced-anti-cheat').attr('checked',false);}pollData.pollId=data.pollId;pollData.reportData=data.reportData;pollData.responseCount=data.responseCount;pollData.anchorText=data.anchorText;if(!pollData.anchorText){pollData.anchorText="surveys & polls"}YOPP();vOPP();DOPP(500);}else if(data.resultCode==RESULT_CODE_NOT_LOGGED_IN){$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true);},Cancel:function(){$(this).dialog('close');}}).dialog('open');}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-my-polls-validate-tips"));}});};jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires= -1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};function akOPP(pollObj){$("#OPP-poll-id-"+pollObj.pollId).html('<div id="OPP-div-around-poll">'+'<table width="100%" cellspacing="0" cellpadding="0" border="0" id="OPP-poll-table">'+'<tr>'+'<td id="OPP-poll-question-text" colspan="2" align="left">'+'</td>'+'</tr>'+'<tr id="OPP-poll-choice-separator"><td colspan="2" style="height: 0px"></td></tr>'+'<tr>'+'<td id="OPP-poll-vote" colspan="2" style="vertical-align: middle;">'+'<table>'+'<tr>'+'<td id="OPP-poll-vote-result-td">'+'</td>'+'<td id="OPP-poll-vote-button-td">'+'</td>'+'</tr>'+'</table>'+'</td>'+'</tr>'+'</table>'+'</div>'+'<a href="http://www.objectplanet.com/opinio/" target="objp" style="text-decoration:none;"><div id="OPP-powered-by" align="center" style="font: 9px arial; color: gray;">'+pollObj.anchorText+'</div></a>');};function aeOPP(pollObj,titleText){var temp='<tr>'+'<td id="OPP-poll-title" colspan="2">'+titleText+'</td>'+'</tr>';$("#OPP-poll-table",$("#OPP-poll-id-"+pollObj.pollId)).prepend(temp);};function apOPP(pollObj,choiceText){var temp='<tr>'+'<td class="OPP-poll-choice OPP-poll-choice-button" style="width: 8%" align="right" valign="top">'+'<table cellspacing="0" cellpadding="0" border="0">'+'<tr><td><input type="'+pollObj.pollChoiceType+'" name="choice" style="vertical-align: middle;">'+'</td><td style="opacity: 0; filter: alpha(opacity=0);">|</td></tr>'+'</table>'+'</td>'+'<td class="OPP-poll-choice OPP-poll-choice-text" align="left" style="width: 92%;">'+'</td>'+'</tr>';$("#OPP-poll-choice-separator",$("#OPP-poll-id-"+pollObj.pollId)).before(temp);$(".OPP-poll-choice-text:last",$("#OPP-poll-id-"+pollObj.pollId)).text(choiceText);};function axOPP(pollObj,previewMode){if(previewMode){$(".OPP-poll-choice",$("#OPP-poll-id-"+pollObj.pollId)).css("cursor","pointer").mouseenter(function(){$(this).css("opacity","0.4")}).mouseleave(function(){$(this).css("opacity","1")}).bind("click",function(){$("input",$(this).parent()).attr('checked',true);hOPP({data:pollObj});});}else{$(".OPP-poll-choice",$("#OPP-poll-id-"+pollObj.pollId)).css("cursor","pointer").mouseenter(function(){$(this).css("opacity","0.4")}).mouseleave(function(){$(this).css("opacity","1")}).bind("click",function(){$("input",$(this).parent()).attr('checked',true);IOPP({data:pollObj});});}};function GOPP(pollObj,questionText){var qtArray=questionText.split("\n");if(qtArray.length==1){$('#OPP-poll-question-text',$("#OPP-poll-id-"+pollObj.pollId)).text(questionText);}else{for(i=0;i<qtArray.length;i++){$('#OPP-poll-question-text',$("#OPP-poll-id-"+pollObj.pollId)).append(document.createTextNode(qtArray[i])).append("<br>");}}};function adOPP(pollObj,text,previewMode){var temp='<button id="OPP-poll-vote-button" ></button>';$("#OPP-poll-vote-button-td",$("#OPP-poll-id-"+pollObj.pollId)).html(temp);$('#OPP-poll-vote',$("#OPP-poll-id-"+pollObj.pollId)).attr("align",pollObj.style.pollVoteAlign);if(previewMode){$("#OPP-poll-vote-button",$("#OPP-poll-id-"+pollObj.pollId)).text(text).unbind("click").bind("click",pollObj,hOPP);}else{$("#OPP-poll-vote-button",$("#OPP-poll-id-"+pollObj.pollId)).text(text).unbind("click").bind("click",pollObj,IOPP);}};function IOPP(attributes){$.cookie("OPPCookieTest",'true',{expires:2});if($.cookie("OPPCookieTest")=="true"){var pollObj=attributes.data;var params=new Object();if(!pollObj.reportData){pollObj.reportData=new Object();}if(pollObj.pollChoiceType=="checkbox"){$("#OPP-poll-id-"+pollObj.pollId+" input:checked").each(function(i){var selectedIndex=$(this).val();eval("params.multResp"+selectedIndex+"='"+selectedIndex+"'");eval("if (pollObj.reportData.c"+selectedIndex+"){"+"pollObj.reportData.c"+selectedIndex+"=parseInt(pollObj.reportData.c"+selectedIndex+") + parseInt(1);"+"}else{"+"pollObj.reportData.c"+selectedIndex+" = 1;"+"}");});}else{params.multResp=$("#OPP-poll-id-"+pollObj.pollId+" input[name=multResp"+pollObj.pollId+"]:checked").val();if(!params.multResp){return;}eval("if (pollObj.reportData.c"+params.multResp+"){"+"pollObj.reportData.c"+params.multResp+"=parseInt(pollObj.reportData.c"+params.multResp+") + parseInt(1);"+"}else{"+"pollObj.reportData.c"+params.multResp+" = 1;"+"}");}if(pollObj.responseCount){pollObj.responseCount=1;}else{pollObj.responseCount++;}params.pollId=pollObj.pollId;params.pollKey=pollObj.pollKey;params.command="saveResponse";var OPP_BASEURL=$("#OPP-poll-id-"+pollObj.pollId).data("OPP_BASEURL");$.getJSON(OPP_BASEURL,params,function(data){if(data.resultCode=="0"){$.cookie("OPP"+pollObj.pollId,'true',{expires:365});}});}hOPP(attributes);};function afOPP(pollObj,text){var temp='<span id="OPP-result-link-text"></span> ';$("#OPP-poll-vote-result-td",$("#OPP-poll-id-"+pollObj.pollId)).html(temp);$('#OPP-poll-vote',$("#OPP-poll-id-"+pollObj.pollId)).attr("align",pollObj.style.pollVoteAlign);$("#OPP-result-link-text",$("#OPP-poll-id-"+pollObj.pollId)).text(text).unbind("click").bind("click",pollObj,hOPP).css("cursor","pointer");};function hOPP(attributes){var pollObj=attributes.data;$("#OPP-powered-by",$("#OPP-poll-id-"+pollObj.pollId)).text("EasyPolls").parent().attr("href","http://www.easypolls.net");var temp='<tr>'+'<td id="OPP-poll-question-text" colspan="2" align="left">'+'</td>'+'</tr>';var totalVotes=0;var totalVoters=pollObj.responseCount;if(pollObj.reportData){$(".OPP-poll-choice-text",$("#OPP-poll-id-"+pollObj.pollId)).each(function(i){eval("if (!pollObj.reportData.c"+i+") pollObj.reportData.c"+i+"=0");totalVotes=totalVotes+parseInt(eval("pollObj.reportData.c"+i));});}$(".OPP-poll-choice-text",$("#OPP-poll-id-"+pollObj.pollId)).each(function(i){var count=0;if(pollObj.reportData){count=eval("pollObj.reportData.c"+i);}temp=temp+'<tr>'+'<td colspan="2" align="left" class="OPP-poll-choice OPP-poll-choice-text">'+$(this).text()+' <span style="font-size: .9em; padding-left: 5px; opacity: 0.7;">'+wOPP(count,totalVotes)+'% ('+count+')</span>'+'</td>'+'</tr>'+'<tr>'+'<td colspan="2">'+'<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr height="'+pollObj.style.chartBarHeight+'"><td style="background-color: '+pollObj.style.chartBarFilledColor+'; border-left: 1px solid '+pollObj.style.chartBarFilledBorderColor+'; border-top: 1px solid '+pollObj.style.chartBarFilledBorderColor+'; border-bottom: 1px solid '+pollObj.style.chartBarFilledBorderColor+';" width="'+wOPP(count,totalVotes)+'%"></td><td style="background-color: '+pollObj.style.chartBarNotFilledColor+'; border-right: 1px solid '+pollObj.style.chartBarNotFilledBorderColor+'; border-top: 1px solid '+pollObj.style.chartBarNotFilledBorderColor+'; border-bottom: 1px solid '+pollObj.style.chartBarNotFilledBorderColor+';" width="'+(100-wOPP(count,totalVotes))+'%"></td></tr></table>'+'</td>'+'</tr>';});temp=temp+'<tr>'+'<td id="OPP-result-link-text" colspan="2" style="padding-top: 7px;" align="left">'+pollObj.totalVotesText+' '+totalVotes+'</td>'+'</tr>';$("#OPP-poll-table",$("#OPP-poll-id-"+pollObj.pollId)).html(temp);GOPP(pollObj,pollObj.question);var origPadding=pollObj.style.pollChoiceTextPaddingBottom;var origVAlign=pollObj.style.pollChoiceTextVAlign;pollObj.style.pollChoiceTextPaddingBottom="0px";pollObj.style.pollChoiceTextVAlign="bottom";FOPP(pollObj);pollObj.style.pollChoiceTextPaddingBottom=origPadding;pollObj.style.pollChoiceTextVAlign=origVAlign;};function wOPP(value,total){if(value==0){return 0;}else{return Math.round((value/total)*100);}};function FOPP(pollObj){with(pollObj.style){$('#OPP-poll-title',$("#OPP-poll-id-"+pollObj.pollId)).css('font-family',pollTitleFontFamily).css('font-size',pollTitleFontSize).css('font-style',pollTitleFontStyle).css('font-weight',pollTitleFontWeight).css('color',pollTitleColor).css('text-align',pollTitleTextAlign).css('border-left',pollTitleBorderLeft).css('border-right',pollTitleBorderRight).css('border-top',pollTitleBorderTop).css('border-bottom',pollTitleBorderBottom).css('padding-left',pollTitlePaddingLeft).css('padding-right',pollTitlePaddingRight).css('padding-top',pollTitlePaddingTop).css('padding-bottom',pollTitlePaddingBottom).css('background-color',pollTitleBgColor);$('#OPP-poll-question-text',$("#OPP-poll-id-"+pollObj.pollId)).css('font-family',pollQuestionFontFamily).css('font-size',pollQuestionFontSize).css('font-style',pollQuestionFontStyle).css('font-weight',pollQuestionFontWeight).css('color',pollQuestionColor).css('border-left',pollQuestionBorderLeft).css('border-right',pollQuestionBorderRight).css('border-top',pollQuestionBorderTop).css('border-bottom',pollQuestionBorderBottom).css('padding-left',pollQuestionPaddingLeft).css('padding-right',pollQuestionPaddingRight).css('padding-top',pollQuestionPaddingTop).css('padding-bottom',pollQuestionPaddingBottom).css('background-color',pollQuestionBgColor);$('.OPP-poll-choice-text',$("#OPP-poll-id-"+pollObj.pollId)).css('font-family',pollChoiceTextFontFamily).css('font-size',pollChoiceTextFontSize).css('font-style',pollChoiceTextFontStyle).css('font-weight',pollChoiceTextFontWeight).css('color',pollChoiceTextColor).css('border-left',pollChoiceTextBorderLeft).css('border-right',pollChoiceTextBorderRight).css('border-top',pollChoiceTextBorderTop).css('border-bottom',pollChoiceTextBorderBottom).css('padding-left',pollChoiceTextPaddingLeft).css('padding-right',pollChoiceTextPaddingRight).css('padding-top',pollChoiceTextPaddingTop).css('padding-bottom',pollChoiceTextPaddingBottom).css('text-align',pollChoiceTextTextAlign).css('vertical-align',pollChoiceTextVAlign).css('background-color',pollChoiceTextBgColor);$('#OPP-result-link-text',$("#OPP-poll-id-"+pollObj.pollId)).css('font-family',pollResultLinkTextFontFamily).css('font-size',pollResultLinkTextFontSize).css('font-style',pollResultLinkTextFontStyle).css('font-weight',pollResultLinkTextFontWeight).css('color',pollResultLinkTextColor).css('margin-right',pollResultLinkTextMarginRight);}};function aiOPP(pollObj){with(pollObj.style){$('#OPP-div-around-poll',$("#OPP-poll-id-"+pollObj.pollId)).css('background-color',divAroundPollBgColor).css('width',divAroundPollWidth).css('border-left',divAroundPollBorderLeft).css('border-right',divAroundPollBorderRight).css('border-top',divAroundPollBorderTop).css('border-bottom',divAroundPollBorderBottom).css('margin-left',divAroundPollMarginLeft).css('margin-right',divAroundPollMarginRight).css('margin-top',divAroundPollMarginTop).css('margin-bottom',divAroundPollMarginBottom).css('padding-left',divAroundPollPaddingLeft).css('padding-right',divAroundPollPaddingRight).css('padding-top',divAroundPollPaddingTop).css('padding-bottom',divAroundPollPaddingBottom);$('#OPP-poll-table',$("#OPP-poll-id-"+pollObj.pollId)).css('border-spacing',pollTableBorderSpacing).css('border-left',pollTableBorderLeft).css('border-right',pollTableBorderRight).css('border-top',pollTableBorderTop).css('border-bottom',pollTableBorderBottom).css('margin-left',pollTableMarginLeft).css('margin-right',pollTableMarginRight).css('margin-top',pollTableMarginTop).css('margin-bottom',pollTableMarginBottom).css('padding-left',pollTablePaddingLeft).css('padding-right',pollTablePaddingRight).css('padding-top',pollTablePaddingTop).css('padding-bottom',pollTablePaddingBottom);$('.OPP-poll-choice-button',$("#OPP-poll-id-"+pollObj.pollId)).css('border-left',pollChoiceButtonBorderLeft).css('border-right',pollChoiceButtonBorderRight).css('border-top',pollChoiceButtonBorderTop).css('border-bottom',pollChoiceButtonBorderBottom).css('padding-left',pollChoiceButtonPaddingLeft).css('padding-right',pollChoiceButtonPaddingRight).css('padding-top',pollChoiceButtonPaddingTop).css('padding-bottom',pollChoiceButtonPaddingBottom).css('text-align',pollChoiceButtonTextAlign).css('vertical-align',pollChoiceButtonVAlign).css('background-color',pollChoiceButtonBgColor).css('font-family',pollChoiceTextFontFamily).css('font-size',pollChoiceTextFontSize).css('font-style',pollChoiceTextFontStyle).css('font-weight',pollChoiceTextFontWeight).css('color',divAroundPollBgColor);$('#OPP-poll-vote',$("#OPP-poll-id-"+pollObj.pollId)).css('font-family',pollVoteFontFamily).css('font-size',pollVoteFontSize).css('font-style',pollVoteFontStyle).css('font-weight',pollVoteFontWeight).css('color',pollVoteColor).css('border-left',pollVoteBorderLeft).css('border-right',pollVoteBorderRight).css('border-top',pollVoteBorderTop).css('border-bottom',pollVoteBorderBottom).css('padding-left',pollVotePaddingLeft).css('padding-right',pollVotePaddingRight).css('padding-top',pollVotePaddingTop).css('padding-bottom',pollVotePaddingBottom);$('#OPP-poll-vote-button',$("#OPP-poll-id-"+pollObj.pollId)).css('font-family',pollVoteButtonFontFamily).css('font-size',pollVoteButtonFontSize).css('font-style',pollVoteButtonFontStyle).css('font-weight',pollVoteButtonFontWeight).css('color',pollVoteButtonColor).css('padding',pollVoteButtonPadding);if(pollVoteButtonBorder!=""){$('#OPP-poll-vote-button',$("#OPP-poll-id-"+pollObj.pollId)).css('border',pollVoteButtonBorder);}FOPP(pollObj);if(0<cornersStyle.length&&cornersStyle!="0px"){if($.support.boxModel==true){$('#OPP-div-around-poll',$("#OPP-poll-id-"+pollObj.pollId)).corners(cornersStyle+" no-mozilla no-webkit");}}}};function awOPP(pollObj){if(!pollObj.totalVotesText){pollObj.totalVotesText="Total votes:";}if(!pollObj.anchorText){pollObj.anchorText="polls & surveys";}};function zOPP(pollObj,previewMode){if($(".OPP-powered-by").eq(0).attr('href')!="http://www.objectplanet.com/opinio/"&& !previewMode){$("#OPP-poll-id-"+pollObj.pollId).text("You can not remove link to EasyPolls");return;}if(!previewMode){$("#OPP-poll-id-"+pollObj.pollId).next().remove();}awOPP(pollObj);var parentWidth=$("#OPP-poll-id-"+pollObj.pollId).parent().width();pollObj.style.maxPollWidth=parseInt(pollObj.style.maxPollWidth+"");if(pollObj.style.maxPollWidth<parentWidth){$("#OPP-poll-id-"+pollObj.pollId).css("width",pollObj.style.maxPollWidth+"px");}else{$("#OPP-poll-id-"+pollObj.pollId).css("width","");}var OPPhighestChoiceIndex= -1;akOPP(pollObj);$.each(pollObj,function(attribute,val){switch(attribute){case "question":GOPP(pollObj,val);break;case "voteButtonText":if(0<val.length){adOPP(pollObj,val,previewMode);}break;case "titleText":aeOPP(pollObj,val);break;case "resultLinkText":if(0<val.length){afOPP(pollObj,val);}break;default:break;}});var OPPchoiceValue=pollObj.choice0;var i=0;while(OPPchoiceValue){apOPP(pollObj,OPPchoiceValue);i++;eval("OPPchoiceValue = pollObj.choice"+i);};$("#OPP-poll-id-"+pollObj.pollId+" input:checkbox").each(function(i){$(this).attr("name","multResp"+i).attr("value",i);});$("#OPP-poll-id-"+pollObj.pollId+" input:radio").each(function(i){$(this).attr("name","multResp"+pollObj.pollId).attr("value",i);});if(pollObj.style){aiOPP(pollObj);};if($.cookie("OPP"+pollObj.pollId)=="true"){hOPP({data:pollObj});}else{if(0==$("#OPP-poll-vote-button",$("#OPP-poll-id-"+pollObj.pollId)).size()){axOPP(pollObj,previewMode);}};$(".OPP-powered-by").show();};function ROPP(o,n,min,max,highlight,tips){if(o.val().length>max||o.val().length<min){o.addClass('ui-state-error');aOPP("Length of "+n+" must be between "+min+" and "+max+".",highlight,tips);return false;}else{aOPP('&nbsp;',false,tips);return true;}};function sOPP(p1,p2,highlight,tips){if(p1.val()!=p2.val()){p1.addClass('ui-state-error');p2.addClass('ui-state-error');aOPP("Passwords are not identical",highlight,tips);return false;}else{aOPP('&nbsp;',false,tips);return true;}};function OOPP(o,regexp,n,highlight,tips){if(!(regexp.test(o.val()))){o.addClass('ui-state-error');aOPP(n,highlight,tips);return false;}else{aOPP('&nbsp;',false,tips);return true;}};function iOPP(emailField,highlight,tips){if(ROPP(emailField,"email",6,200,highlight,tips)){return OOPP(emailField,/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,"Invalid e-mail address.",highlight,tips);}return false;};function aCOPP(emailField,highlight){aOPP('Creating account...',false,$("#OPP-register-validate-tips"),10000);var params={command:"addUser",email:emailField.val(),password:$("#OPP-register-password").val()};$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",height:"500",timeout:"10000",success:function(data){if(data.resultCode==RESULT_CODE_OK){pollUserId=data.pollUserId;$("#OPP-dialog-account").dialog('close');pOPP('Account created','Account was created successfully.');OPPpollAddress=data.serverAddress;OPPpollPage=data.connectorPollPage;OPPpollPageJsp=data.connectorPollPageJsp;OPPembedScript=data.embedScript;OPPemail=emailField.val();$("#OPP-login-email").val(OPPemail);OPPaccStatus=data.accountStatus;mOPP("login");if($("#OPP-save-poll-button").attr('disabled')==true){rOPP();}return;}else if(data.resultCode==RESULT_CODE_EMAIL_EXISTS){emailField.addClass('ui-state-error');aOPP('E-mail address already exists.',highlight,$("#OPP-register-validate-tips"));return;}else{aOPP('An error has occurred. Please try again later.',true,$("#OPP-register-validate-tips"));}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-register-validate-tips"));}});};function qOPP(passwordField,highlight,tips){if(ROPP(passwordField,"password",5,50,highlight,tips)){return OOPP(passwordField,/^([0-9a-zA-Z])+$/,"Password field only allow : a-z 0-9",highlight,tips);}return false;};function atOPP(highlight){aOPP('Sending...',false,$("#OPP-request-pw-validate-tips"));var params={command:"emailExists",email:$("#OPP-request-pw-email").val()};$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",timeout:"10000",success:function(data){if(data.resultCode==RESULT_CODE_OK){if(data.result=='true'){params={command:"requestPassword",email:$("#OPP-request-pw-email").val()};$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",timeout:"10000",success:function(data){if(data.resultCode==RESULT_CODE_OK){$('#OPP-dialog-request-password').dialog('close');pOPP('Password sent','A new password has been sent to the specified e-mail address.');return;}else{aOPP('An error has occurred. Please try again later.',highlight,$("#OPP-request-pw-validate-tips"));return;}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-request-pw-validate-tips"));}});}else{aOPP('E-mail does not exist.',true,$("#OPP-request-pw-validate-tips"));}}else{aOPP('An error has occurred. Please try again later.',highlight,$("#OPP-request-pw-validate-tips"));return;}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-request-pw-validate-tips"));}});};function acOPP(){var params={command:"updatePassword",password:$("#OPP-new-password1").val()};$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",timeout:"10000",success:function(data){if(data.resultCode==RESULT_CODE_OK){$('#OPP-dialog-new-password').dialog('close');pOPP('New password set','Your new password is now set.');return;}else{aOPP('An error has occurred. Please try again later.',highlight,$("#OPP-new-password-tips"));return;}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred, status: "+textStatus,true,$("#OPP-new-password-tips"));}});};function TOPP(){var params={command:"updateUser",pollUserId:pollUserId,email:$("#OPP-update-acc-email").val(),firstName:$("#OPP-update-acc-first-name").val(),lastName:$("#OPP-update-acc-last-name").val(),address1:$("#OPP-update-acc-address1").val(),address2:$("#OPP-update-acc-address2").val(),city:$("#OPP-update-acc-city").val(),zipCode:$("#OPP-update-acc-zip-code").val(),province:$("#OPP-update-acc-province").val(),countryCode:$("#OPP-update-acc-country-code").val(),timezone:$("#OPP-update-acc-timezone").val(),password:$("#OPP-update-acc-password-2").val(),oldPassword:$("#OPP-update-acc-password").val()};NOPP();var bValid=true;if(OPPemail!=$("#OPP-update-acc-email").val()){if($("#OPP-update-acc-password").val()==""){bValid=false;aOPP("Type in your password to change your e-mail address.",true,$("#OPP-update-acc-validate-tips"));$("#OPP-update-acc-password").addClass('ui-state-error');}}if($("#OPP-update-acc-password-2").val()!=""){if($("#OPP-update-acc-password").val()==""){bValid=false;aOPP("To change password, type in your current password.",true,$("#OPP-update-acc-validate-tips"));$("#OPP-update-acc-password").addClass('ui-state-error');}else{bValid=bValid&&qOPP($("#OPP-update-acc-password-2"),true,$("#OPP-update-acc-validate-tips"));bValid=bValid&&sOPP($("#OPP-update-acc-password-2"),$("#OPP-update-acc-password-3"),true,$("#OPP-update-acc-validate-tips"));}}bValid=bValid&&iOPP($("#OPP-update-acc-email"),true,$("#OPP-update-acc-validate-tips"));if(bValid){$.ajax({url:OPP_PG_BASEURL,type:"POST",data:params,dataType:"json",contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:"10000",success:function(data,textStatus){if(data.resultCode==RESULT_CODE_OK){if(data.result=='true'){aOPP('Account information was saved.',true,$("#OPP-update-acc-validate-tips"),10000);OPPaccStatus=data.accountStatus;UOPP();$("#OPP-validate-email-button").hide();return;}else{aOPP('Error.',true,$("#OPP-update-acc-validate-tips"));return;}}else if(data.resultCode==RESULT_CODE_NOT_LOGGED_IN){$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true,TOPP);},Cancel:function(){$(this).dialog('close');}}).dialog('open');}else if(data.resultCode==RESULT_CODE_INVALID_INPUT){aOPP('Could not save user information. Make sure that password and e-mail are correct.',true,$("#OPP-update-acc-validate-tips"));}else{aOPP('Could not save user information. Please try again later. ErrorCode: '+data.resultCode,true,$("#OPP-update-acc-validate-tips"));}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred when saving user information, status: "+textStatus,true,$("#OPP-update-acc-validate-tips"));}});}};function NOPP(){$("#OPP-update-acc-email").removeClass('ui-state-error');$("#OPP-update-acc-password").removeClass('ui-state-error');$("#OPP-update-acc-password-2").removeClass('ui-state-error');$("#OPP-update-acc-password-3").removeClass('ui-state-error');};function arOPP(){$("#OPP-update-acc-email").val("");$("#OPP-update-acc-first-name").val("");$("#OPP-update-acc-last-name").val("");$("#OPP-update-acc-address1").val("");$("#OPP-update-acc-address2").val("");$("#OPP-update-acc-city").val("");$("#OPP-update-acc-zip-code").val("");$("#OPP-update-acc-province").val("");$("#OPP-update-acc-country-code").val("");$("#OPP-update-acc-timezone").val("");$("#OPP-update-acc-password").val("");$("#OPP-update-acc-password-2").val("");$("#OPP-update-acc-password-3").val("");OPPemail="";NOPP();aOPP("",false,$("#OPP-update-acc-validate-tips"));};function aBOPP(){var params={command:"getUser"};$.ajax({url:OPP_PG_BASEURL,type:"GET",data:params,dataType:"json",timeout:"10000",success:function(data,textStatus){if(data.resultCode==RESULT_CODE_OK){$("#OPP-update-acc-email").val(data.email);$("#OPP-update-acc-first-name").val(data.firstName);$("#OPP-update-acc-last-name").val(data.lastName);$("#OPP-update-acc-address1").val(data.address1);$("#OPP-update-acc-address2").val(data.address2);$("#OPP-update-acc-city").val(data.city);$("#OPP-update-acc-zip-code").val(data.zipCode);$("#OPP-update-acc-province").val(data.province);$("#OPP-update-acc-country-code").val(data.countryCode);$("#OPP-update-acc-timezone").val(data.timezone);$("#OPP-update-acc-password").val("");$("#OPP-update-acc-password-2").val("");$("#OPP-update-acc-password-3").val("");OPPemail=data.email;if(data.firstName){$("#OPP-welcome-msg").html("Welcome, "+data.firstName);}else{$("#OPP-welcome-msg").html("Welcome, "+OPPemail);}$("#OPP-welcome-msg").show();}else{aOPP('Could not load user information. Please try again later. ErrorCode: '+data.resultCode,true,$("#OPP-update-acc-validate-tips"));}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred when loading user information, status: "+textStatus,true,$("#OPP-update-acc-validate-tips"));}});};function auOPP(){if(OPPemail==$("#OPP-update-acc-email").val()){var params={command:"requestCode"};$.ajax({url:OPP_PG_BASEURL,type:"GET",data:params,dataType:"json",timeout:"10000",success:function(data,textStatus){if(data.resultCode==RESULT_CODE_OK){aOPP('An email with a new activation code has been sent to your e-mail address.',true,$("#OPP-update-acc-validate-tips"),8000);$("#OPP-validate-email-button").hide();}else{aOPP('Could not send e-mail. Please try again later. ErrorCode: '+data.resultCode,true,$("#OPP-update-acc-validate-tips"));}},error:function(XMLHttpRequest,textStatus){aOPP("Error occurred when loading user information, status: "+textStatus,true,$("#OPP-update-acc-validate-tips"));}});}else{yOPP('Invalid choice','You have changed your e-mail address. Press update to receive the activation code to your new e-mail address.');}};function alOPP(){$("#OPP-yes-no-message-value").text("Are you sure you want to delete your account?");$("#OPP-yes-no-message").dialog({autoOpen:false,show:'scale',hide:'scale',modal:'true',title:'Confirm delete',close:function(){$(this).dialog('destroy');},buttons:{'Yes':function(){$(this).dialog('close');var params={command:"deleteUser",pollUserId:pollUserId,email:OPPemail};$.ajax({url:OPP_PG_BASEURL,type:"GET",data:params,dataType:"json",timeout:"5000",success:function(obj,textStatus){if(obj.resultCode==RESULT_CODE_OK){COPP();}else if(obj.resultCode==RESULT_CODE_NOT_LOGGED_IN){$('#OPP-dialog-login').dialog('option','buttons',{'Login':function(){dOPP(true);},Cancel:function(){$(this).dialog('close');}}).dialog('open');}else{aOPP("Could not delete account. Code: "+obj.resultCode,true,$("#OPP-update-acc-validate-tips"));}},error:function(data){aOPP("Could not delete account",true,$("#OPP-update-acc-validate-tips"));}});},'No':function(){$(this).dialog('close');}}}).dialog("open");}