var preloader="<img border='0' src='/images/bigrotation2.gif' />"
var active,clicked
function createStyleRule(selector,declaration){
if(!document.getElementsByTagName || !(document.createElement || document.createElementNS))return
var agt=navigator.userAgent.toLowerCase()
var is_ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1))
var is_iewin=(is_ie&&(agt.indexOf("win")!=-1))
var is_iemac=(is_ie&&(agt.indexOf("mac")!=-1))
if(is_iemac)return
var head=document.getElementsByTagName("head")[0]
var style=(typeof document.createElementNS !="undefined")? document.createElementNS("http://www.w3.org/1999/xhtml","style"): document.createElement("style")
if(!is_iewin){
var styleRule=document.createTextNode(selector+" {"+declaration+"}")
style.appendChild(styleRule)}
style.setAttribute("type","text/css")
style.setAttribute("media","screen")
head.appendChild(style)
if(is_iewin&&document.styleSheets&&document.styleSheets.length>0){
var lastStyle=document.styleSheets[document.styleSheets.length-1]
if(typeof lastStyle.addRule=="object"){
lastStyle.addRule(selector,declaration)}}}
if($.fn.flash.hasFlash(8)){
createStyleRule("#wrapper","background-image: none")
createStyleRule("#block-login","z-index: 1!important;")}
function getWindowHeight(){
var windowHeight=0
if(typeof(window.innerHeight)=='number'){
windowHeight=window.innerHeight}
else{
if(document.documentElement&&
document.documentElement.clientHeight){
windowHeight=
document.documentElement.clientHeight}
else{
if(document.body&&document.body.clientHeight){
windowHeight=document.body.clientHeight}}}
return windowHeight}
function setFooter(){
if(!document.getElementById('footer'))return
if(document.getElementById){
var windowHeight=getWindowHeight()
if(windowHeight>0){
var contentHeight=
document.getElementById('wrapper').offsetHeight
var footerElement=
document.getElementById('footer')
var footerHeight=footerElement.offsetHeight
if(windowHeight-(contentHeight+footerHeight)>=0){
footerElement.style.position='relative'
footerElement.style.top=(windowHeight-
(contentHeight+footerHeight))+'px'}
else{
footerElement.style.position='static'}}}
if(top.location==location)window.onresize=function(){setFooter();}}
var ss={
fixAllLinks: function(){
var allLinks=document.getElementsByTagName('a')
for(var i=0;i<allLinks.length;i++){
var lnk=allLinks[i]
if((lnk.href&&lnk.href.indexOf('#')!=-1)&&
((lnk.pathname==location.pathname)||
('/'+lnk.pathname==location.pathname))&&
(lnk.search==location.search)){
ss.addEvent(lnk,'click',ss.smoothScroll)}}
},
smoothScroll: function(e){
if(window.event){
target=window.event.srcElement
}else if(e){
target=e.target
}else return
if(target.nodeName.toLowerCase()!='a'){
target=target.parentNode}
if(target.nodeName.toLowerCase()!='a')return
anchor=target.hash.substr(1)
var allLinks=document.getElementsByTagName('a')
var destinationLink=null
for(var i=0;i<allLinks.length;i++){
var lnk=allLinks[i]
if(lnk.name&&(lnk.name==anchor)){
destinationLink=lnk
break}}
if(!destinationLink)return true
var destx=destinationLink.offsetLeft
var desty=destinationLink.offsetTop
var thisNode=destinationLink
while(thisNode.offsetParent&&
(thisNode.offsetParent !=document.body)){
thisNode=thisNode.offsetParent
destx+=thisNode.offsetLeft
desty+=thisNode.offsetTop}
clearInterval(ss.INTERVAL)
cypos=ss.getCurrentYPos()
ss_stepsize=parseInt((desty-cypos)/ss.STEPS)
ss.INTERVAL=setInterval('ss.scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10)
if(window.event){
window.event.cancelBubble=true
window.event.returnValue=false}
if(e&&e.preventDefault&&e.stopPropagation){
e.preventDefault()
e.stopPropagation()}
},
scrollWindow: function(scramount,dest,anchor){
wascypos=ss.getCurrentYPos()
isAbove=(wascypos<dest)
window.scrollTo(0,wascypos+scramount)
iscypos=ss.getCurrentYPos()
isAboveNow=(iscypos<dest)
if((isAbove !=isAboveNow)||(wascypos==iscypos)){
window.scrollTo(0,dest)
clearInterval(ss.INTERVAL)
location.hash=anchor}
},
getCurrentYPos: function(){
if(document.body&&document.body.scrollTop)
return document.body.scrollTop
if(document.documentElement&&document.documentElement.scrollTop)
return document.documentElement.scrollTop
if(window.pageYOffset)
return window.pageYOffset
return 0
},
addEvent: function(elm,evType,fn,useCapture){
if(elm.addEventListener){
elm.addEventListener(evType,fn,useCapture)
return true
}else if(elm.attachEvent){
var r=elm.attachEvent("on"+evType,fn)
return r
}else{
alert("Handler could not be removed")}}}
ss.STEPS=20
ss.addEvent(window,"load",ss.fixAllLinks)
function splash(root){
$('#wrapper').flash(
{ src: '/swf/mksplash01.swf', width: 800, height: 570, flashvars: {root:root}, bgcolor: '#ffffff'},
{ version: 8, expressInstall: true, update: false });
}
function header(swf,active,root){
$('#flashead').flash(
{ src: root+'swf/'+swf, width: 900, height: 240, flashvars: {root:root, active:active}, swLiveConnect: 'true', allowScriptAccess: 'always', id: 'headswf', bgcolor: '#ffffff', wmode: 'transparent'},
{ version: 8, expressInstall: true, update: false });
}
function ctabs(group,active,root){
$('#ctabs').flash(
{ src: root+'swf/tabs.swf', width: 30, height: 343, flashvars: {group:group, active:active, root:root}, bgcolor: '#ffffff', wmode: 'transparent'},
{ version: 8, update: false });
}
function map(group,root){
$('#map').flash(
{ src: root+'swf/map.swf', width: 800, height: 541, flashvars: {group:group, root:root}, bgcolor: '#ffffff', wmode: 'opaque'},
{ version: 8, update: false });
}
function init(){
campbell_init()
setFooter()
replaceFonts()}
function replaceFonts(){
if(typeof sIFR=="function"){
sIFR.replaceElement(".block-poll h3",named({sFlashSrc: "/swf/sifr.swf",sWmode: "transparent",sColor: "#888888",sSize: "22"}))
sIFR.replaceElement(".heading h3",named({sFlashSrc: "/swf/sifr.swf",sWmode: "transparent",sColor: "#ffffff",sSize: "22"}))
sIFR.replaceElement(".block-user-login h3",named({sFlashSrc: "/swf/sifr.swf",sWmode: "transparent",sColor: "#ffffff",sSize: "22"}))
sIFR.replaceElement(".block-user h3",named({sFlashSrc: "/swf/sifr.swf",sWmode: "transparent",sColor: "#ffffff",sSize: "22"}))
sIFR.replaceElement(".block-fun_links h3",named({sFlashSrc: "/swf/sifr.swf",sWmode: "transparent",sColor: "#888888",sSize: "22"}))}}
function campbell_blocks(){
var urls=Array()
$('#block-event a.updateblock').unclick().click(function(){
uri=eregReplace('month','block',this.href)
$.ajax({type: "GET",url:uri,success:updateevents})
return false
})
$('#poll_view_voting').unsubmit().submit(function(){
var nid=this.elements['edit[nid]'].value
for(var i=0;i<this.elements.length;i++){
if(this.elements[i].checked){
var choice=this.elements[i].value}}
if(typeof(choice)=="undefined"){
alert('You must choose an answer..')
return false}
$.ajax({type:'post',url:'/poll/vote',data:'nid='+nid+'&choice='+choice,success:updatepoll})
return false
})}
function updateevents(res){
$('#block-event').html(res)
setTimeout(replaceFonts,100)
campbell_blocks()
campbell_tooltips()}
function updatepoll(res){
$('#poll_view_voting').html(res)}
function init_messages(){
$('#login-messagez,.messages').hide()}
function campbell_messages(){
txt=$('#login-messagez').html()
msgtxt=$('.messages.error').html()
if(msgtxt !=null)
error=true
else{
msgtxt=$('.messages').html()
error=false}
$('.messages').remove()
if(txt !=null){
$('#login-messagez').addClass('msg-content').center().css('opacity',0).css('filter','alpha(opacity=0)').show().fadeTo("slow",0.7).left((parseInt($('#login-messagez').left())-10)+"px")
$('#login-messagez').html(txt+'<br /><br /><a href="#" title="close">close</a>')
$('.block-user-login div,.block-user-login h3').not('#login-messagez').fadeTo(300,0.2)
$('#login-messagez a[@title*=close]')
.click(function(){
$('.block-user-login div,.block-user-login h3').not('#login-messagez').fadeTo(200,1)
$('#login-messagez').remove()
})
$('.block-user-login a[@href*=password]').click(function(){
$('#login-messagez').remove()
$.ajax({type: 'POST',data: 'ajax=true',url:this.href,success: campbell_update_login})
return false
})}
if(msgtxt !=null){
if(navigator.platform.toLowerCase().indexOf("mac")!=-1)$('embed,object').css('visibility','hidden')
if($('#TB_HideSelect').length==0)$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>")
$("#TB_window").html("<div class='messages"+(error?" error":"")+"'>"+msgtxt+"<br /><br /><a href='#'>close</a></div>")
$('.messages').css('display', 'block')
$('#TB_window').css('opacity',0).css('filter','alpha(opacity=0)').fadeTo(300,0.8)
ajaxContentW=TB_WIDTH=440
ajaxContentH=TB_HEIGHT=parseInt($('#TB_window').height())
TB_position()
$("#TB_overlay,#TB_window a").click(TB_remove)
$("#TB_window").css({display:"block"})}}
function campbell_update_login(res){
$('.block-user-login').height($('.block-user-login').height())
$('.block-user-login').html(res)
campbell_pass()}
function form_ajax_submit(form,block,progress,action){
var options=new Object()
options.target=block
if(progress !=false)options.after=function(){$(block).removeClass('preloader')}
if(typeof action !='undefined')options.url=action
$(form).ajaxForm(options)
if(progress !=false)$(form).submit(function(){campbell_progress(block)})}
function campbell_init(){
if(typeof $=='function'){
TB_init()
gal=$('div.gallery:last')
gallast=$('div.gallery-last')
if(gal.length&&!gallast.length)gal[0].className='gallery-last'
campbell_menu()
campbell_login_links()
campbell_blocks()
setTimeout(campbell_messages,100)
campbell_login()
campbell_delete()
campbell_forum()
if ($.browser.msie) campbell_png('#leptir','leptir2.png');
$(window).bind('load',campbell_tooltips)
if(typeof uploadAutoAttach=="function")uploadAutoAttach()}
}
function campbell_tooltips(){
$('a,img,div').not('[@href*=ditdot]').mytips()}
function campbell_delete(){
$("input[@value*=Delete]:not(:radio),input[@value*=delete]:not(:radio),.links a[@href*=delete],a[@title*=delete]").click(function(){
return confirm("are you sure?")
})}
function campbell_progress(div,bool){
$(div).html(preloader)
if(bool !=false)$(div).find("img").center()}
function campbell_login(){
form_ajax_submit("#user_register","#TB_ajaxContent",true)}
function campbell_login_links(){
$(".block-user-login a[@title*=Register]").click(function(){
TB_show('Campbell Park youth | Registration',this.href+'?height=525&width=500',false)
return false
})}
function campbell_register(){
campbell_register_tips();
form_ajax_submit("#user_register","#TB_ajaxContent",true)}
function redir(url){
top.location.href=url}
function obfuscate(_pt1,_pt2,_pt3){
document.write("<a "+"href='"+"mail"+"to:"+_pt1+"@"+_pt2+"'>"+_pt3+"</a>")}
function campbell_pass(){
init_messages()
form_ajax_submit("#user_pass",".block-user-login",false,'/user/password?ajax=true&redirect='+window.location.href)
setTimeout(campbell_messages,100)
setTimeout(replaceFonts,100)}
function campbell_menu(){
active=clicked=-1
$('.sidebar ul.menu li.expanded').each(function(i){
this.num=i
if($(this).find('a.active').length>0)active=i
if(i!=active)$(this).find('> ul.menu').hide()
$(this).find('> a').click(function(){
if(this.parentNode.num !=active){
clicked=this.parentNode.num
$(this).find('> ul.menu').show()
$('.sidebar ul.menu > li.expanded > ul.menu').each(function(){
if(this.parentNode.num==active)$(this).hide()
if(this.parentNode.num==clicked)$(this).show()
})
active=clicked}
return false
})
})}
function campbell_forum(){
$('span.forumlink,span.topictitle').ancestors('tr').hover(function(){$(this).addClass('forum-hover')},function(){$(this).removeClass('forum-hover')})
}
function campbell_png(id,img){
$(id).css({filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/"+img+"', sizingMethod='scale')", backgroundImage: 'none'});
}
function campbell_register_tips(){
$('body').unbind('mousemove',update)
$("div.form-item .description").hide();
$('#user_register input[@type=text],#user_register input[@type=password]').focus(function(){
$('#tooltip').css({top: getAbsoluteTop(this)+"px", left: getAbsoluteLeft(this)+parseInt($(this).width())+20+"px"}).html('<p>'+$(this).parents('div.form-item').find('.description').html()+'</p>').show();
}).blur(function(){
$('#tooltip').hide();
});
}
function getAbsoluteLeft(obj) {
oLeft = obj.offsetLeft
while(obj.offsetParent!=null) {
oParent = obj.offsetParent
oLeft += oParent.offsetLeft
obj = oParent}
return oLeft}
function getAbsoluteTop(obj) {
oTop = obj.offsetTop
while(obj.offsetParent!=null) {
oParent = obj.offsetParent
oTop += oParent.offsetTop
obj = oParent}
return oTop}