function isEmpty(inputStr){if(inputStr==null||inputStr==""){return true;}
return false;}
function isEmptyMessage(fieldName){alert(fieldName+" is a Required Field")}
function echeck(str){var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if(lstr<6){return false}
if(str.indexOf(at)==-1){return false}
if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr){return false}
if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){return false}
if(str.indexOf(at,(lat+1))!=-1){return false}
if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){return false}
if(str.indexOf(dot,(lat+2))==-1){return false}
if(str.indexOf(" ")!=-1){return false}
if(str.substring(ldot,lstr-1).length<2){return false}
return true}
function errorMsgDisplay(field,msg,lastField){alert('in errorMsgDisplay...');var fld=document.getElementById(field);if(fld!=null){addClassName(fld,'errorfield');}
}
function toggleEmailRadios(){if(($('receiveEmail')!=null)&&($('receivePollEmail')!=null)){var chkd=$('receiveEmail').checked;$('receivePollEmail').disabled=!(chkd);switch(chkd){case true:break;case false:$('receivePollEmail').checked=chkd;break;}}}
function previewPush(){urchinTracker("/createAPoll/buzzPollsPreview?category="+document.createPollForm.category.value);var updateValues="";var validEntries=true;var question=document.createPollForm.bpquestion.value;var answer1=document.createPollForm.bpans1.value;var answer2=document.createPollForm.bpans2.value;var answer3=document.createPollForm.bpans3.value;if(isEmpty(question)||isEmpty(answer1)||isEmpty(answer2)){alert("Please enter all required fields.\n(You must have at least one question and two answers)");return false;}
question=escapeChars(question);answer1=escapeChars(answer1);answer2=escapeChars(answer2);answer3=escapeChars(answer3);updateValues=question+","+answer1+","+answer2+","+answer3;var el=getMovieName("previewpollflash");el.updatePollPreview(updateValues);}
function createPreviewPoll(){if($('previewpolldiv')!=null){var previewSo=new SWFObject("/pca/flash/createPollLoader.swf","previewpollflash","250","395","#523863");previewSo.addParam("allowScriptAccess","always");previewSo.addParam("wmode","transparent");previewSo.write("previewpolldiv");}}
function escapeChars(str){var str=str;str=str.replace(/\'/g,"&#39;");str=str.replace(/\,/g,"&#44;");str=str.replace(/\"/g,'&#34;');str=str.replace(/<a[^>]+>/g,"");str=str.replace(/<\/a>/g,"");return str;}
function getElementsByClassName(oElm,strTagName,strClassName){var arrElements=(strTagName=="*"&&oElm.all)?oElm.all:document.getElementsByTagName(strTagName);var arrReturnElements=new Array();strClassName=strClassName.replace(/-/g,"\-");var oRegExp=new RegExp("(^|\s)"+strClassName+"(\s|$)");var oElement;for(var i=0;i<arrElements.length;i++){oElement=arrElements[i];if(oRegExp.test(oElement.className)){arrReturnElements.push(oElement);}}
return(arrReturnElements)}
function addClassName(elem,className){if(elem!=null)
{if($(elem)!=null)
{removeClassName(elem,className);elem.className=(elem.className+" "+className).trim();}}}
function removeClassName(elem,className){if(elem!=null)
{if($(elem)!=null)
{elem.className=elem.className.replace(className,"").trim();}}}
function openPopup(url,title,features){var newWin=window.open(url,title,features);newWin.focus();}
function getMovieName(movieName){if(navigator.appName.indexOf("Microsoft")!=-1){return window[movieName];}else{return document[movieName];}}
function dropdown()
{var startWeek,startMonth
endWeek=this.document.PCAForm.mySel.value
startMonth=this.document.PCAForm.mySel1.value
window.location='/pca/pollarchive.jsp?endWeek='+endWeek+'&startMonth='+startMonth;}
function dropdownweek()
{var startWeek
endWeek=this.document.PCAForm.mySel.value
window.location='/pca/buzzpollarchive.jsp?endWeek='+endWeek;}
function dropdownmonth()
{var startMonth
startMonth=this.document.PCAForm.mySel1.value
window.location='/pca/monthlypollarchive.jsp?startMonth='+startMonth;}
function showHistory()
{var year;year=this.document.PCAForm.mySel.value
window.location='/pca/history.jsp?year='+year;}
function ismaxlength(obj){var mlength=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):""
if(obj.getAttribute&&obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)}
function outboundLink(url){urchinTracker('/outgoing/'+url);window.open(url);}
window.addEvent('domready',function()
{if($('headerAct')!=null){var fadeIn=new Fx.Style($('headerLogin'),'opacity',{duration:1500,transition:Fx.Transitions.Quart.easeInOut});$('headerAct').addEvent('click',function(){fadeIn.start(0,0.9999);$('headerAct').style.display="none";});}
$$('#register #submit','#registerUpdate #submit').addEvent('click',function(){var option=$('receiveEmail').getProperty('checked');urchinTracker("/registerform/optIn="+option);});$$('#topnav img','#subnav img').addClass('imglink');if($('logoutbutton')!=null){$('logoutbutton').addClass("imglink");}
$$('.imglink').addEvents({'mouseover':function(){if(!this.getAttribute('src').match(/_on\.[a-zA-Z]+$/))this.setAttribute('src',this.getAttribute('src').replace(/_[^\._]+\.([a-zA-Z]+)$/,'_over.$1'));},'mouseout':function(){if(!this.getAttribute('src').match(/_on\.[a-zA-Z]+$/))this.setAttribute('src',this.getAttribute('src').replace(/_[^\._]+\.([a-zA-Z]+)$/,'_off.$1'));}});});