
var siteurl='http://www.allstarcheerleaders.co.nz/new';var secureurl='';function getElementsByClassName(classname,tag){if(!tag)tag="*";var anchs=document.getElementsByTagName(tag);var total_anchs=anchs.length;var regexp=new RegExp('\\b'+classname+'\\b');var class_items=new Array()
for(var i=0;i<total_anchs;i++){var this_item=anchs[i];if(regexp.test(this_item.className)){class_items.push(this_item);}}
return class_items;}
function confirmdelete(){if(confirm("Are you sure you want to delete this?")==true){return true;}else{return false;}}
function xyz(c,a,b,s){var s=(s==null)?true:s;var o='';var m='';var m2=':otliam';for(i=0;i<=b.length;i++){o=b.charAt(i)+o;}
b=o;for(i=0;i<=m2.length;i++){m=m2.charAt(i)+m;}
if(!s){m='';}
return m+a+unescape('%'+'4'+'0')+b+'.'+c;}
function two_dp(num){num=parseFloat(num);return(Math.round(num*100)/100);}
function formatAsMoney(mnt){mnt-=0;mnt=(Math.round(mnt*100))/100;return(mnt==Math.floor(mnt))?mnt+'.00':((mnt*10==Math.floor(mnt*10))?mnt+'0':mnt);}
function validate(val,type){if(type=='email'){return val.match(/^(?:^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|biz|info|name|aero|biz|info|jobs|museum|name)$)$/i);}else if(type=='url'){return val.match(/^(?:\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])$/i);}else if(type=='integer'){return val.match(/^-?[0-9]+$/i);}}
function validateEmail(str){var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
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}
return true}
function showhide(region){if(document.getElementById){if(document.getElementById(region).style.display=='none'){document.getElementById(region).style.display='block';}else{document.getElementById(region).style.display='none';}}else{alert('Sorry, your browser doesn\'t support this');}}
function showregion(region){if(document.getElementById){document.getElementById(region).style.display='block';}else{alert('Sorry, your browser doesn\'t support this');}}
function hideregion(region){if(document.getElementById){document.getElementById(region).style.display='none';}else{alert('Sorry, your browser doesn\'t support this');}}
function setCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");}
function getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else{begin+=2;}
var end=document.cookie.indexOf(";",begin);if(end==-1){end=dc.length;}
return unescape(dc.substring(begin+prefix.length,end));}
function deleteCookie(name,path,domain){if(getCookie(name)){document.cookie=name+"="+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}}
function isNull(a){return typeof a=='object'&&!a;}
function shownode(treename,node){var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');var i=cookiearr.length;var controllerhtml=document.getElementById('controller'+node).innerHTML;if(document.getElementById){document.getElementById('node'+node).style.display='block';controllerhtml=controllerhtml.replace("+","-");controllerhtml=controllerhtml.replace("plus.","minus.");controllerhtml=controllerhtml.replace("closed.","open.");document.getElementById('controller'+node).innerHTML=controllerhtml;for(var n=0;n<cookiearr.length;n++){if(cookiearr[n]==node){cookiearr[n]=''}}
cookiearr[i]=node;cookiecontents=cookiearr.join(".");}
setCookie(treename+'tree',cookiecontents,'','/');}
function hidenode(treename,node)
{var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');var i=cookiearr.length;var controllerhtml=document.getElementById('controller'+node).innerHTML;if(document.getElementById){document.getElementById('node'+node).style.display='none';controllerhtml=controllerhtml.replace("-","+");controllerhtml=controllerhtml.replace("minus.","plus.");controllerhtml=controllerhtml.replace("open.","closed.");document.getElementById('controller'+node).innerHTML=controllerhtml;for(var n=0;n<cookiearr.length;n++){if(cookiearr[n]==node){cookiearr[n]=''}}
cookiecontents=cookiearr.join(".");}else{alert('Sorry, your browser doesn\'t support this');}
setCookie(treename+'tree',cookiecontents,'','/');}
function showhidenode(treename,node)
{if((document.getElementById('node'+node).style.display=='none')||(document.getElementById('node'+node).style.display=='')){shownode(treename,node);}else{hidenode(treename,node);}}
function showthesenodes(treename,nodes){var showarr=nodes.split('.');var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');var shortlength=showarr.length-1;for(var n=0;n<cookiearr.length;n++){if((cookiearr[n]!='')&&(cookiearr[n]!=showarr[shortlength])){hidenode(treename,cookiearr[n]);}}
for(var n=0;n<shortlength;n++){if(showarr[n]!=''){shownode(treename,showarr[n]);}}
if(showarr[shortlength]!=''){showhidenode(treename,showarr[shortlength]);}}
function loadtree(treename){var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');for(var n=0;n<cookiearr.length;n++){if(cookiearr[n]!=''){shownode(treename,cookiearr[n]);}}}
function getCheckedValue(radioObj){if(!radioObj)
return"";var radioLength=radioObj.length;if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value;else
return"";for(var i=0;i<radioLength;i++){if(radioObj[i].checked){return radioObj[i].value;}}
return"";}
function setCheckedValue(radioObj,newValue){if(!radioObj)
return;var radioLength=radioObj.length;if(radioLength==undefined){radioObj.checked=(radioObj.value==newValue.toString());return;}
for(var i=0;i<radioLength;i++){radioObj[i].checked=false;if(radioObj[i].value==newValue.toString()){radioObj[i].checked=true;}}}
function countDown(fieldid,countid,max){field=document.getElementById(fieldid);count=document.getElementById(countid);count.value=max-field.value.length;}
function removeclass(id,c){if(document.getElementById(id)){var rep=document.getElementById(id).className.match(' '+c)?' '+c:c;document.getElementById(id).className=document.getElementById(id).className.replace(rep,'');}}
function addclass(id,c){if(document.getElementById(id)){removeclass(id,c);document.getElementById(id).className+=' '+c;}}
function removeClass(object,c){if(object){var rep=object.className.match(' '+c)?' '+c:c;object.className=object.className.replace(rep,'');}}
function addClass(object,c){if(object){removeClass(object,c);object.className+=' '+c;}}
function addEvent(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}}
function nl2br(myString){return myString.replace(/\n/g,'<br />\n');}
function frajax(action,a,b,c,d,e,f,g,h,i,j){var url=siteurl;var r=/(http|https):\/\/.*/;var m=r.exec(window.location);if(m!=null&&m.length>1){if(m[1]=='https'){url=secureurl;}}
url+='/actions/'+action+'.php?';url+='arg1='+encodeURIComponent(a);url+='&arg2='+encodeURIComponent(b);url+='&arg3='+encodeURIComponent(c);url+='&arg4='+encodeURIComponent(d);url+='&arg5='+encodeURIComponent(e);url+='&arg6='+encodeURIComponent(f);url+='&arg7='+encodeURIComponent(g);url+='&arg8='+encodeURIComponent(h);url+='&arg9='+encodeURIComponent(i);url+='&arg10='+encodeURIComponent(j);document.getElementById('frajax-iframe').src=url;return false;}
function getElementsByClassName(classname,tag){if(!tag)tag="*";var anchs=document.getElementsByTagName(tag);var total_anchs=anchs.length;var regexp=new RegExp('\\b'+classname+'\\b');var class_items=new Array()
for(var i=0;i<total_anchs;i++){var this_item=anchs[i];if(regexp.test(this_item.className)){class_items.push(this_item);}}
return class_items;}
function confirmdelete(){if(confirm("Are you sure you want to delete this?")==true){return true;}else{return false;}}
function xyz(c,a,b,s){var s=(s==null)?true:s;var o='';var m='';var m2=':otliam';for(i=0;i<=b.length;i++){o=b.charAt(i)+o;}
b=o;for(i=0;i<=m2.length;i++){m=m2.charAt(i)+m;}
if(!s){m='';}
return m+a+unescape('%'+'4'+'0')+b+'.'+c;}
function two_dp(num){num=parseFloat(num);return(Math.round(num*100)/100);}
function formatAsMoney(mnt){mnt-=0;mnt=(Math.round(mnt*100))/100;return(mnt==Math.floor(mnt))?mnt+'.00':((mnt*10==Math.floor(mnt*10))?mnt+'0':mnt);}
function validate(val,type){if(type=='email'){return val.match(/^(?:^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|biz|info|name|aero|biz|info|jobs|museum|name)$)$/i);}else if(type=='url'){return val.match(/^(?:\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])$/i);}else if(type=='integer'){return val.match(/^-?[0-9]+$/i);}}
function validateEmail(str){var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
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}
return true}
function showhide(region){if(document.getElementById){if(document.getElementById(region).style.display=='none'){document.getElementById(region).style.display='block';}else{document.getElementById(region).style.display='none';}}else{alert('Sorry, your browser doesn\'t support this');}}
function showregion(region){if(document.getElementById){document.getElementById(region).style.display='block';}else{alert('Sorry, your browser doesn\'t support this');}}
function hideregion(region){if(document.getElementById){document.getElementById(region).style.display='none';}else{alert('Sorry, your browser doesn\'t support this');}}
function setCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");}
function getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else{begin+=2;}
var end=document.cookie.indexOf(";",begin);if(end==-1){end=dc.length;}
return unescape(dc.substring(begin+prefix.length,end));}
function deleteCookie(name,path,domain){if(getCookie(name)){document.cookie=name+"="+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}}
function isNull(a){return typeof a=='object'&&!a;}
function shownode(treename,node){var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');var i=cookiearr.length;var controllerhtml=document.getElementById('controller'+node).innerHTML;if(document.getElementById){document.getElementById('node'+node).style.display='block';controllerhtml=controllerhtml.replace("+","-");controllerhtml=controllerhtml.replace("plus.","minus.");controllerhtml=controllerhtml.replace("closed.","open.");document.getElementById('controller'+node).innerHTML=controllerhtml;for(var n=0;n<cookiearr.length;n++){if(cookiearr[n]==node){cookiearr[n]=''}}
cookiearr[i]=node;cookiecontents=cookiearr.join(".");}
setCookie(treename+'tree',cookiecontents,'','/');}
function hidenode(treename,node)
{var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');var i=cookiearr.length;var controllerhtml=document.getElementById('controller'+node).innerHTML;if(document.getElementById){document.getElementById('node'+node).style.display='none';controllerhtml=controllerhtml.replace("-","+");controllerhtml=controllerhtml.replace("minus.","plus.");controllerhtml=controllerhtml.replace("open.","closed.");document.getElementById('controller'+node).innerHTML=controllerhtml;for(var n=0;n<cookiearr.length;n++){if(cookiearr[n]==node){cookiearr[n]=''}}
cookiecontents=cookiearr.join(".");}else{alert('Sorry, your browser doesn\'t support this');}
setCookie(treename+'tree',cookiecontents,'','/');}
function showhidenode(treename,node)
{if((document.getElementById('node'+node).style.display=='none')||(document.getElementById('node'+node).style.display=='')){shownode(treename,node);}else{hidenode(treename,node);}}
function showthesenodes(treename,nodes){var showarr=nodes.split('.');var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');var shortlength=showarr.length-1;for(var n=0;n<cookiearr.length;n++){if((cookiearr[n]!='')&&(cookiearr[n]!=showarr[shortlength])){hidenode(treename,cookiearr[n]);}}
for(var n=0;n<shortlength;n++){if(showarr[n]!=''){shownode(treename,showarr[n]);}}
if(showarr[shortlength]!=''){showhidenode(treename,showarr[shortlength]);}}
function loadtree(treename){var cookiecontents=getCookie(treename+'tree');if(isNull(cookiecontents)){var cookiecontents='';}
var cookiearr=cookiecontents.split('.');for(var n=0;n<cookiearr.length;n++){if(cookiearr[n]!=''){shownode(treename,cookiearr[n]);}}}
function getCheckedValue(radioObj){if(!radioObj)
return"";var radioLength=radioObj.length;if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value;else
return"";for(var i=0;i<radioLength;i++){if(radioObj[i].checked){return radioObj[i].value;}}
return"";}
function setCheckedValue(radioObj,newValue){if(!radioObj)
return;var radioLength=radioObj.length;if(radioLength==undefined){radioObj.checked=(radioObj.value==newValue.toString());return;}
for(var i=0;i<radioLength;i++){radioObj[i].checked=false;if(radioObj[i].value==newValue.toString()){radioObj[i].checked=true;}}}
function countDown(fieldid,countid,max){field=document.getElementById(fieldid);count=document.getElementById(countid);count.value=max-field.value.length;}
function removeclass(id,c){if(document.getElementById(id)){var rep=document.getElementById(id).className.match(' '+c)?' '+c:c;document.getElementById(id).className=document.getElementById(id).className.replace(rep,'');}}
function addclass(id,c){if(document.getElementById(id)){removeclass(id,c);document.getElementById(id).className+=' '+c;}}
function removeClass(object,c){if(object){var rep=object.className.match(' '+c)?' '+c:c;object.className=object.className.replace(rep,'');}}
function addClass(object,c){if(object){removeClass(object,c);object.className+=' '+c;}}
function addEvent(obj,evType,fn){if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}}
function nl2br(myString){return myString.replace(/\n/g,'<br />\n');}
function makeRequest(aFilename,source){$("#imageFilename").val(aFilename);$("#gallery3submit").val("Save");$.ajax({type:"POST",url:"/new/external/MyAJAX/getDescription.php",data:"filename="+aFilename,success:function(msg){$("#imageText").val(msg);}});}
function movePhoto(id){var aFilename=$("#imageFilename").val();var currGalleryID=id;var newGalleryID=$("#cboMove").val();$.ajax({type:"POST",url:"/new/external/MyAJAX/movePhoto.php",data:"filename="+aFilename+"&currGallery="+currGalleryID+"&newGallery="+newGalleryID,success:function(msg){document.getElementById("files").innerHTML=msg;}});}
function checkArticleComment(){var i=0;var errors=new Array();if(document.getElementById('name').value==''){errors[i++]='Name is a required field';}
if(document.getElementById('email').value==''){errors[i++]='Email is a required field';}
else if(!validateEmail(document.getElementById('email').value)){errors[i++]='Email is not a valid email format';}
if(document.getElementById('comment').value==''){errors[i++]='Please enter a comment';}
if(document.getElementById('captchacode')&&(document.getElementById('captchacode').value=='')){errors[i++]='Please enter the CAPTCHA code (required to prevent spam)';}
if(errors.length==0){return(true);}else{alert(errors.join("\n"));return(false);}}