var tplRoot = 'http://www.lastditchpitch.com/webapp/templates/default'; var srcRoot = 'http://www.lastditchpitch.com/webapp'; var basRoot = 'http://www.lastditchpitch.com'; //-------------------------DREAMWEAVER FUNCTIONS---------------------------// /** * Rollover functions * Preload/Swap Images */ function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&iClick HERE */ function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i cur_index) { min_index = cur_index; } } if (min_index > parseInt(obj.style.zIndex)) { return; } obj.style.zIndex = 1; if (min_index > 1) return; var add = min_index == 0 ? 2 : 1; for (i = 0; i < divs.length; i++) { var item = divs[i]; if (item == obj) continue; item.style.zIndex += add; } obj.style.display = "none"; } //-------------------------EXPANDER FUNCTIONS---------------------------// /** * initExpander * Initialise the expander */ function initExpander(obj) { addEvent(obj,'click',switchStatus); obj.parentNode.className = "expander"; var rel = obj.getAttribute('rel'); $(rel).hide(); } /** * switchStatus * Smooth transitional hiding/revealing */ function switchStatus() { var rel = this.getAttribute('rel'); if (this.parentNode.className.indexOf('expanded') != -1) { this.parentNode.className = "expander"; } else { this.parentNode.className = "expander expanded"; } $(rel).toggle(); } //-------------------------DISPLAY DETAILS FUNCTIONS---------------------------// var lastClickedDet = null; var lastClickedPro = null; var allowDetChange = true; var allowProChange = true; /** * Display Detail() * Hide/Unhide a div with smooth or instant effect */ function displayDetails(aid, id, smoothing) { //If there's already an animation running if (!allowDetChange) return; //Set the last clicked detail anchor lastClickedDet = $(aid); if (smoothing) { allowDetChange = false; Effect.toggle(id, 'Blind', {afterFinish:switchText}); } else { $(id).toggle(); switchText(); } } /** * switchText * Switch - / + */ function switchText() { if (!lastClickedDet) return; lastClickedDet.innerHTML = lastClickedDet.innerHTML == '+' ? '--' : '+'; allowDetChange = true; } /** * showProfile * Smooth transitional hiding/revealing */ function showProfile(aid, id, smoothing) { //If there's already an animation running if (!allowProChange) return; //Block mouse clicks if (smoothing) { allowProChange = false; } //Loop over main table nodes, hiding all visible for (var x=0; x<$('profileDetails').childNodes.length; x++) { if ($('profileDetails').childNodes[x].tagName == 'DIV' && $($('profileDetails').childNodes[x]).visible()) { if (smoothing) { Effect.BlindUp($('profileDetails').childNodes[x],{queue:'end'}); } else { $('profileDetails').childNodes[x].hide(); } } } //Loop over navigation elements, setting class names for (var x=0; x<$('tabs').childNodes.length; x++) { $('tabs').childNodes[x].className = '' } //Set the class name on our selected list $(aid).className = 'selectedTab'; if (smoothing) { Effect.BlindDown($(id),{queue:'end',afterFinish:clearProfile}); } else { $(id).show(); } visibleProfile = $('id'); } /** * clearProfile * */ function clearProfile() { allowProChange = true; } //-------------------------THUMBNAIL HOVER FUNCTIONS---------------------------// /** * thumbnailHover * Enable hovering effects over thumbnails */ function thumbnailHover() { var imPreview = document.getElementById('zoomExpandPreview'); if (!imPreview) { var img = document.createElement('img'); img.id = 'zoomExpandPreview'; document.getElementsByTagName('body')[0].appendChild(img); } var thumbList = getElementsByClass("thumbnail",document,"IMG"); for (var i=0; i Graphics --> Lineage var regions = [$('topAdvertBanner'),$('AdvertBanners'),$('advertsTextLinksPod')]; for (var i=0; i 6) { var aFoot = document.createElement('p'); var aLink = document.createElement('a'); aLink.href = "full_service_list.php"; aLink.className = "darkgrey"; aLink.appendChild(document.createTextNode('More Links')); aFoot.appendChild(aLink); regions[i].appendChild(aLink); }*/ } } //-------------------------POPUP RELATED FUNCTIONS---------------------------// var popup; function initialiseGallery() { //Set the first pane to be defaulted visible var visisbleProfile = $('prDetails1'); //Make the thumbnail image a popup popup = new Popup($('galleryPopup')); popup.attatchCloseHandle($('galClose')); popup.attatchDragHandle($('galleryTab')); } function popupLogin() { //Make the thumbnail image a popup popup = new Popup($('galleryPopup'),{width:'400px'}); popup.attatchCloseHandle($('galClose')); popup.attatchDragHandle($('galleryTab')); popup.setScreenerColour('#fff'); popup.setScreenerOpacity(6); popup.show(); } function openGalleryPreview(src) { if (popup) { popup.show(); setTimeout(function(){$('galleryImg').src = src},100); } } var inTrans = false; var transSt = false; function showSwoosh() { if (!inTrans) { if (!transSt) { $('advancedSearch').src = tplRoot + '/images/button_basic_search.gif'; new Effect.Morph('searchContainer',{ style:{width:'396px'}, afterFinish: function(){ setSwooshState(true); setAdvancedSelects($('aSearchBox'),true); } }); } else { $('advancedSearch').src = tplRoot + '/images/button_advanced_search.gif'; new Effect.Morph('searchContainer',{ style:{width:'196px'}, beforeStart: function(){setAdvancedSelects($('aSearchBox'),false)}, afterFinish: function(){setSwooshState(false)} }); } } inTrans = true; } function setSwooshState(state) { transSt = state; inTrans = false; } function initSelects() { if (!(BrowserDetect.browser == "Explorer" && BrowserDetect.version < 7)) { setAdvancedSelects($('aSearchBox'),true,true); } } function setAdvancedSelects(element,state,ignore) { //If early IE, fix the advanced selects if ((BrowserDetect.browser == "Explorer" && BrowserDetect.version < 7) || ignore) { for (var i=0; ipark information on the results below.",2); } function loadLoginMesages() { var toolTip = new ToolTip(); toolTip.initialize({attatch:'myDet',id:'mydetailspop'}); toolTip.show("You are now logged on, click
here to edit your customer profile",2); var pinOn = new PinOn(); var toolTip = new ToolTip(); toolTip.initialize({attatch:'logSpan',id:'logoutpop',pin:pinOn.BottomRight()}); toolTip.show("Click here to log out",2); } //----------------------FAVOURITE LISTING FUNCTIONS-----------------------// //Configuration var favCount = 0; function getFavList() { //It would be too complex to create the favourites //table from JS, so we clone an invisible table var favList = document.getElementById('favList'); favList.style.display = getTableDisplay(); return favList.cloneNode(true); } function insertFavData() { var dataHold = document.getElementById('favContent'); //Did we even retreive the container? if (!dataHold) return; //Make sure it's a table... it should be if (dataHold.tagName.toLowerCase() != "tbody") return; //Ok, checks passed, build our list! var favParks = new Favourites("park"); var favArray = favParks.getFavouriteList(); for (var i=0; i= 0; i = i - 1){ item = listEvents[i]; if(item[0].removeEventListener){ item[0].removeEventListener(item[1], item[2], item[3]); }; if(item[1].substring(0, 2) != "on"){ item[1] = "on" + item[1]; }; if(item[0].detachEvent){ item[0].detachEvent(item[1], item[2]); }; item[0][item[1]] = null; }; } }; }(); addEvent(window,'unload',EventCache.flush); /** * removeChildNodes() * Recursive removal of child nodes */ function removeChildNodes(parent) { while ( parent.hasChildNodes() ) { parent.removeChild(parent.firstChild); } } /** * createInput() * Cross browser compatible input creator */ function createInput(name, type, value) { var ele; if (BrowserDetect.browser == "Explorer"){ ele = document.createElement(""); } else { ele = document.createElement('input'); ele.name = name; } if (type) ele.type = type; if (value) ele.value = value; ele.id = name; return ele; } /** * getElementsByClassName() * Get a set of elements that match a supplied class name */ function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)'); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j++; } } return classElements; } //-------------------------BROWSER DETECTION---------------------------// /** * Browser Detect * Get Browser Information */ var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i numAppearences) return; } this.container.style.display = 'block'; this.setText(text); this.container.style.visibility = 'visible'; } /** * hide * * Set the containing div to be invisible */ ToolTip.prototype.hide = function() { this.container.style.display = 'none'; this.container.style.visibility = 'hidden'; } /** * setText * * Set the innerHTML of the inner containing * div of this tooltip object */ ToolTip.prototype.setText = function(text) { this.clearText(); if (typeof(text) == 'string') { this.inContain.innerHTML = text; } if (text.tagName) { this.inContain.appendChild(text); } this.reposition(); } /** * clearText * * Clear the inner containing div of all content */ ToolTip.prototype.clearText = function() { while (this.inContain.hasChildNodes()) { this.inContain.removeChild(this.inContain.firstChild); } } /** * setStyle * * Set a style for the containing div of this * tooltip item * * @param: item * The CSS style class to change * @param: value * The value to set the class to */ ToolTip.prototype.setStyle = function(item,value) { //NOT IE SAFE this.inContain.style.setProperty(item,value,""); } /** * getContainer * * Return the current containing div of this * tooltip */ ToolTip.prototype.getContainer = function() { return this.inContain; } /** * setOpacity * * Set the opacity of the containing div of this * tooltip item * * @param: level * An integer from 0 to 10, where 0 is * transparent and 10 is totally opaque */ ToolTip.prototype.setOpacity = function(level) { this.container.style.opacity = level/10; this.container.style.filter = 'alpha(opacity='+(level*10)+')'; } /** * findPos * * Find the position on the page of an object * * @param: object * The object to find */ ToolTip.prototype.findPos = function(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft,curtop]; } /** * CookieHandler * * Thanks goes to quirksmode for this code * http://www.quirksmode.org/js/cookies.html * * A simple object to manage cookies */ function CookieHandler(name) { this.name = name } CookieHandler.prototype.createCookie = function(value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = this.name+"="+value+expires+"; path=/"; } CookieHandler.prototype.readCookie = function() { var nameEQ = this.name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } CookieHandler.prototype.eraseCookie = function() { this.createCookie("",-1); } /** * PinOn * * A simple object setup to indicate * the layout of a tooltip pointer graphic */ function PinOn() { this.values = [0,0,1,1]; } PinOn.prototype.TopLeft = function() { this.values = [1,0,0,1]; return this.clone(); } PinOn.prototype.TopRight = function() { this.values = [1,1,0,0]; return this.clone(); } PinOn.prototype.BottomLeft = function() { this.values = [0,0,1,1]; return this.clone(); } PinOn.prototype.BottomRight = function() { this.values = [0,1,1,0]; return this.clone(); } PinOn.prototype.leftEquiv = function() { var thisCopy = this.clone(); thisCopy.values[1] = 0; thisCopy.values[3] = 1; return thisCopy; } PinOn.prototype.rightEquiv = function() { var thisCopy = this.clone(); thisCopy.values[1] = 1; thisCopy.values[3] = 0; return thisCopy; } PinOn.prototype.flipVertical = function() { this.values[2] = !(this.values[2]); this.values[0] = !(this.values[0]); return this; } PinOn.prototype.flipHorizontal = function() { this.values[1] = !(this.values[1]); this.values[3] = !(this.values[3]); return this; } /** * toPadding * * Set the padding on the supplied element * given this current layout * * @param: element * A HTML node to apply styling to * @param: amount * The amount, in pixels, to pad the noted * corners of the tooltip display */ PinOn.prototype.toPadding = function(element, amountTB, amountLR) { if (!this.values) return; var padReturn = ""; for (var i=0; i