﻿var ddsmoothmenu={arrowimages:{down:['downarrowclass','http://www.hopecic.org.uk/skins/asbuilts/images/down.gif',23],right:['rightarrowclass','http://www.hopecic.org.uk/skins/asbuilts/images/right.gif']},transition:{overtime:10,outtime:10},shadow:{enabled:false,offsetx:2,offsety:2},detectwebkit:navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1,getajaxmenu:function($,setting){var $menucontainer=$('#'+setting.contentsource[0]);$menucontainer.html("Loading Menu...");$.ajax({url:setting.contentsource[1],async:true,error:function(ajaxrequest){$menucontainer.html('Error fetching content. Server Response: '+ajaxrequest.responseText)},success:function(content){$menucontainer.html(content);ddsmoothmenu.buildmenu($,setting)}})},buildshadow:function($,$subul){},buildmenu:function($,setting){var smoothmenu=ddsmoothmenu ;var $mainmenu=$("#"+setting.mainmenuid+">ul");var $headers=$mainmenu.find("ul").parent();$headers.hover(function(e){$(this).children('a:eq(0)').addClass('selected')},function(e){$(this).children('a:eq(0)').removeClass('selected')});$headers.each(function(i){var $curobj=$(this).css({zIndex:100-i});var $subul=$(this).find('ul:eq(0)').css({display:'block'});this._dimensions={w:this.offsetWidth,h:this.offsetHeight,subulw:$subul.outerWidth(),subulh:$subul.outerHeight()};this.istopheader=$curobj.parents("ul").length==1?true:false ;$subul.css({top:this.istopheader?this._dimensions.h+"px":0});$curobj.children("a:eq(0)").css(this.istopheader?{paddingRight:smoothmenu.arrowimages.down[2]}:{}).append('<img src="'+(this.istopheader?smoothmenu.arrowimages.down[1]:smoothmenu.arrowimages.right[1])+'" class="'+(this.istopheader?smoothmenu.arrowimages.down[0]:smoothmenu.arrowimages.right[0])+'" style="border:0;" />');if(smoothmenu.shadow.enabled){this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx:this._dimensions.w),y:(this.istopheader?$subul.offset().top+smoothmenu.shadow.offsety:$curobj.position().top)};if(this.istopheader)$parentshadow=$(document.body);else{var $parentLi=$curobj.parents("li:eq(0)");$parentshadow=$parentLi.get(0).$shadow}this.$shadow=$('<div class="ddshadow'+(this.istopheader?' toplevelshadow':'')+'"></div>').prependTo($parentshadow).css({left:this._shadowoffset.x+'px',top:this._shadowoffset.y+'px'})}$curobj.hover(function(e){var $targetul=$(this).children("ul:eq(0)");this._offsets={left:$(this).offset().left,top:$(this).offset().top};var menuleft=this.istopheader?0:this._dimensions.w ;menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())?(this.istopheader?-this._dimensions.subulw+this._dimensions.w:-this._dimensions.w):menuleft ;if($targetul.queue().length<=1){$targetul.css({left:menuleft+"px",width:this._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'},ddsmoothmenu.transition.overtime);if(smoothmenu.shadow.enabled){var shadowleft=this.istopheader?$targetul.offset().left+ddsmoothmenu.shadow.offsetx:menuleft ;var shadowtop=this.istopheader?$targetul.offset().top+smoothmenu.shadow.offsety:this._shadowoffset.y ;if(!this.istopheader&&ddsmoothmenu.detectwebkit){this.$shadow.css({opacity:1})}this.$shadow.css({overflow:'',width:this._dimensions.subulw+'px',left:shadowleft+'px',top:shadowtop+'px'}).animate({height:this._dimensions.subulh+'px'},ddsmoothmenu.transition.overtime)}}},function(e){var $targetul=$(this).children("ul:eq(0)");$targetul.animate({height:'hide',opacity:'hide'},ddsmoothmenu.transition.outtime);if(smoothmenu.shadow.enabled){if(ddsmoothmenu.detectwebkit){this.$shadow.children('div:eq(0)').css({opacity:0})}this.$shadow.css({overflow:'hidden'}).animate({height:0},ddsmoothmenu.transition.outtime)}})});$mainmenu.find("ul").css({display:'none',visibility:'visible'})},init:function(setting){if(typeof setting.customtheme=="object"&&setting.customtheme.length==2){var mainmenuid='#'+setting.mainmenuid ;document.write('<style type="text/css">\n'+mainmenuid+', '+mainmenuid+' ul li a {background:'+setting.customtheme[0]+';}\n'+mainmenuid+' ul li a:hover {background:'+setting.customtheme[1]+';}\n'+'</style>')}jQuery(document).ready(function($){if(typeof setting.contentsource=="object"){ddsmoothmenu.getajaxmenu($,setting)}else{ddsmoothmenu.buildmenu($,setting)}})}};ddsmoothmenu.init({mainmenuid:"smoothmenu1",contentsource:"markup"});function at_show_aux(parent,child){var p=document.getElementById(parent);var c=document.getElementById(child);var top=(c["at_position"]=="y")?p.offsetHeight+2:0;var left=(c["at_position"]=="x")?p.offsetWidth+2:0;for(;p;p=p.offsetParent){top+=p.offsetTop;left+=p.offsetLeft}c.style.position="absolute";c.style.top=top+'px';c.style.left=left+'px';c.style.visibility="visible"}function at_show(){var p=document.getElementById(this["at_parent"]);var c=document.getElementById(this["at_child"]);at_show_aux(p.id,c.id);clearTimeout(c["at_timeout"])}function at_hide(){var p=document.getElementById(this["at_parent"]);var c=document.getElementById(this["at_child"]);c["at_timeout"]=setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'",333)}function at_click(){var p=document.getElementById(this["at_parent"]);var c=document.getElementById(this["at_child"]);if(c.style.visibility!="visible")at_show_aux(p.id,c.id);else c.style.visibility="hidden";return false}function at_attach(parent,child,showtype,position,cursor){var p=document.getElementById(parent);var c=document.getElementById(child);p["at_parent"]=p.id;c["at_parent"]=p.id;p["at_child"]=c.id;c["at_child"]=c.id;p["at_position"]=position;c["at_position"]=position;c.style.position="absolute";c.style.visibility="hidden";if(cursor!=undefined)p.style.cursor=cursor;switch(showtype){case"click":p.onclick=at_click;p.onmouseout=at_hide;c.onmouseover=at_show;c.onmouseout=at_hide;break;case"hover":p.onmouseover=at_show;p.onmouseout=at_hide;c.onmouseover=at_show;c.onmouseout=at_hide;break}}var thumbnailviewer = { enableTitle: true, enableAnimation: true, definefooter: '<div class="footerbar">CLOSE X</div>', defineLoading: '<img src="inc/thumbnailviewer/loading.gif" /> Loading Image...', scrollbarwidth: 16, opacitystring: 'filter:progid:DXImageTransform.Microsoft.alpha(opacity=10); -moz-opacity: 0.1; opacity: 0.1', targetlinks: [], createthumbBox: function () { document.write('<div id="thumbBox" onClick="thumbnailviewer.closeit()"><div id="thumbImage"></div>' + this.definefooter + '</div>'); document.write('<div id="thumbLoading">' + this.defineLoading + '</div>'); this.thumbBox = document.getElementById("thumbBox"); this.thumbImage = document.getElementById("thumbImage"); this.thumbLoading = document.getElementById("thumbLoading"); this.standardbody = (document.compatMode == "CSS1Compat") ? document.documentElement : document.body }, centerDiv: function (divobj) { var ie = document.all && !window.opera; var dom = document.getElementById; var scroll_top = (ie) ? this.standardbody.scrollTop : window.pageYOffset; var scroll_left = (ie) ? this.standardbody.scrollLeft : window.pageXOffset; var docwidth = (ie) ? this.standardbody.clientWidth : window.innerWidth - this.scrollbarwidth; var docheight = (ie) ? this.standardbody.clientHeight : window.innerHeight; var docheightcomplete = (this.standardbody.offsetHeight > this.standardbody.scrollHeight) ? this.standardbody.offsetHeight : this.standardbody.scrollHeight; var objwidth = divobj.offsetWidth; var objheight = divobj.offsetHeight; var topposition = (docheight > objheight) ? scroll_top + docheight / 2 - objheight / 2 + "px" : scroll_top + 10 + "px"; divobj.style.left = docwidth / 2 - objwidth / 2 + "px"; divobj.style.top = Math.floor(parseInt(topposition)) + "px"; divobj.style.visibility = "visible" }, showthumbBox: function () { thumbnailviewer.thumbLoading.style.visibility = "hidden"; ; this.centerDiv(this.thumbBox); if (this.enableAnimation) { this.currentopacity = 0.1; this.opacitytimer = setInterval("thumbnailviewer.opacityanimation()", 20) } }, loadimage: function (link) { if (this.thumbBox.style.visibility == "visible") this.closeit(); var imageHTML = '<img src="' + link.getAttribute("href") + '" style="' + this.opacitystring + '" />'; if (this.enableTitle && link.getAttribute("title")) imageHTML += '<br />' + link.getAttribute("title"); this.centerDiv(this.thumbLoading); this.thumbImage.innerHTML = imageHTML; this.featureImage = this.thumbImage.getElementsByTagName("img")[0]; if (this.featureImage.complete) thumbnailviewer.showthumbBox(); else { this.featureImage.onload = function () { thumbnailviewer.showthumbBox() } } if (document.all && !window.createPopup) this.featureImage.src = link.getAttribute("href"); this.featureImage.onerror = function () { thumbnailviewer.thumbLoading.style.visibility = "hidden" } }, setimgopacity: function (value) { var targetobject = this.featureImage; if (targetobject.filters && targetobject.filters[0]) { if (typeof targetobject.filters[0].opacity == "number") targetobject.filters[0].opacity = value * 100; else targetobject.style.filter = "alpha(opacity=" + value * 100 + ")" } else if (typeof targetobject.style.MozOpacity != "undefined") targetobject.style.MozOpacity = value; else if (typeof targetobject.style.opacity != "undefined") targetobject.style.opacity = value; else this.stopanimation() }, opacityanimation: function () { this.setimgopacity(this.currentopacity); this.currentopacity += 0.1; if (this.currentopacity > 1) this.stopanimation() }, stopanimation: function () { if (typeof this.opacitytimer != "undefined") clearInterval(this.opacitytimer) }, closeit: function () { this.stopanimation(); this.thumbBox.style.visibility = "hidden"; this.thumbImage.innerHTML = ""; this.thumbBox.style.left = "-2000px"; this.thumbBox.style.top = "-2000px" }, cleanup: function () { this.thumbLoading = null; if (this.featureImage) this.featureImage.onload = null; this.featureImage = null; this.thumbImage = null; for (var i = 0; i < this.targetlinks.length; i++) this.targetlinks[i].onclick = null; this.thumbBox = null }, dotask: function (target, functionref, tasktype) { tasktype = (window.addEventListener) ? tasktype : "on" + tasktype; if (target.addEventListener) target.addEventListener(tasktype, functionref, false); else if (target.attachEvent) target.attachEvent(tasktype, functionref) }, init: function () { if (!this.enableAnimation) this.opacitystring = ""; var pagelinks = document.getElementsByTagName("a"); for (var i = 0; i < pagelinks.length; i++) { if (pagelinks[i].getAttribute("rel") && pagelinks[i].getAttribute("rel") == "thumbnail") { pagelinks[i].onclick = function () { thumbnailviewer.stopanimation(); thumbnailviewer.loadimage(this); return false }; this.targetlinks[this.targetlinks.length] = pagelinks[i] } } this.dotask(window, function () { if (thumbnailviewer.thumbBox.style.visibility == "visible") thumbnailviewer.centerDiv(thumbnailviewer.thumbBox) }, "resize") } }; thumbnailviewer.createthumbBox();thumbnailviewer.dotask(window,function(){thumbnailviewer.init()},"load");thumbnailviewer.dotask(window,function(){thumbnailviewer.cleanup()},"unload")
