function commentColours() { $(".comment").each(function(i) { var commentEl = $(this); i%2 ? commentEl.addClass("alt") : commentEl.addClass("norm"); }); } function copyUrl() { var urlToCopy = $("#short-url").val(); ZeroClipboard.setMoviePath( '/themes/site_themes/default/lib/scripts/ZeroClipboard.swf' ); var clip = new ZeroClipboard.Client(); clip.setText(urlToCopy); clip.glue( "copy-text" ); clip.addEventListener( 'complete', function(client, text) { targetEl = $("#copy-result"); if( targetEl.text() !== "Copied") { $(".social-links input").before(' Copied'); alert("The short URL was copied to the clipboard"); } }); return false; } function setFacebookPlugin(isHomePage) { var htmlToAdd = ""; if(isHomePage) { htmlToAdd = ''; if(!$(this).hasClass(".mapAdded")) { $(this).parent().next().prepend (iframeHTML); $(this).addClass(".mapAdded"); } if($(this).parent().next().css("display")=="block") { $(this).parent().next().hide("fast"); $(this).removeClass("clicked"); } else { $(this).parent().next().show("fast"); $(this).addClass("clicked"); } return false; }); } function MM_jumpMenu(targ,selObj,restore){ var currentState = $("#select-state :selected").val(); var currentRegion = $("#select-region :selected").val(); var currentRegionArray = currentRegion.split("/"); //.alert(currentRegionArray.length); var pathname = window.location.pathname; var pathNameArray = pathname.split("/"); var urlSegments = "/find_a_bag/category/"; var addSlug = ""; if(currentRegionArray.length == 5) { addSlug = "/type" } if(pathNameArray.length == 6 && pathNameArray[4] !== "type") { finalURL = urlSegments + pathNameArray[3] + "/" + currentState; } else { finalURL = urlSegments + currentState + addSlug; } //return false; if(selObj.id == "select-type") { // type drop down if ($(selObj.options[selObj.selectedIndex]).text() == "All") { var uri = selObj.options[selObj.selectedIndex].value; eval(targ+".location='"+ urlSegments + uri + "/" + "'"); if (restore) selObj.selectedIndex=0; } else { var uri = selObj.options[selObj.selectedIndex].value; var encodedURL = encodeURI(uri) + ""; eval(targ+".location='"+ finalURL + "/" + encodedURL + "'"); if (restore) selObj.selectedIndex=0; } } else if (selObj.id == "select-state") { // state drop down segment_prefix = "/find_a_bag/category/"; eval(targ+".location='"+ segment_prefix + selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } else { eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } } function checkLocation() { stateDisplaying = "NSW"; regionDisplaying = "All"; stateDisplaying = $("#select-state :selected").val(); regionDisplaying = $("#select-region :selected").text(); $("#d-state").html(stateDisplaying); $("#d-region").html(regionDisplaying); } function selectType() { var testState = $("#select-state :selected").val(); var testType = $("#select-type :selected").val(); $(".loc").each(function(i) { rawClass = $(this).attr("class"); splitRawClass = rawClass.split(" "); splitFinalClass = splitRawClass[0].split("-"); getClassRight = splitFinalClass[1]; if(getClassRight.charAt(testType) == "1") { $(this).show(); } else { $(this).hide(); } }); } function selectType2() { var testState = $("#select-state :selected").val(); var testType = $("#select-type :selected").text(); var noResultsEl = $("#no-results"); if(testType !== "All") { counter = 0; shownCounter = 0; $("p.loc-type").each(function(i) { counter++; if(testType == $(this).text() && $(this).parent().parent().hasClass(testState)) { $(this).parent().parent().show("fast"); shownCounter++; } else { $(this).parent().parent().hide("fast"); } }); if(shownCounter == 0) { noResultsHTML = "No results on this page with this filter."; noResultsEl.text(noResultsHTML); } else { noResultsHTML = ""; noResultsEl.text(noResultsHTML); } shownCounter = 0; } // show if is == to All else { $("p.loc-type").each(function() { $(this).parent().parent().show("fast"); }); noResultsHTML = ""; noResultsEl.text(noResultsHTML); } } var winid = null; function puViewer(url, width, height) { if (winid != null) { winid.close(); winid = null; } if (width === undefined) { width = 720; } if (height === undefined) { height = 580; } winid = window.open(url, 'puViewer', 'resizable=1,scrollbars=1,status=1,toolbar=0,menubar=0,width='+width+',height='+height) winid.focus(); } // Copied from the script found on Particle Tree http://www.particletree.com function getBrowserWidth() { if (window.innerWidth) { return window.innerWidth; } else if (document.documentElement && document.documentElement.clientWidth != 0) { return document.documentElement.clientWidth; } else if (document.body) { return document.body.clientWidth; } return 0; } //addEvent() by John Resig function addEvent( obj, type, fn ) { if (obj.addEventListener){ obj.addEventListener( type, fn, false ); } else if (obj.attachEvent) { obj["e"+type+fn] = fn; obj[type+fn] = function(){obj["e"+type+fn](window.event);} obj.attachEvent("on"+type, obj[type+fn]); } } // Modified from the script found on A List Apart @ http://www.alistapart.com function determineLayout() { var obj, title, i; var browserWidth = getBrowserWidth(); if (browserWidth > 1020) { title = "wide"; } else { title = "normal"; } for (i=0; (obj = document.getElementsByTagName("link")[i]); i++) { if (obj.getAttribute("rel").indexOf("style") != -1 && obj.getAttribute("title")) { obj.disabled = true; if (obj.getAttribute("title") == title) obj.disabled = false; } } } function externalLinks() { if (!document.getElementsByTagName) { return false; } var anchors = document.getElementsByTagName("a"); for (var i=0; i