$.ajaxSetup ({ cache: false }); var isIE6 = ($.browser.msie && $.browser.version=="6.0"); var ajax_load = "


"; var LOCAL_URL = window.location.host+"/httpdocs"; var RIGHT_COL_URL = "http://" + LOCAL_URL + "/_rightcol/rightcol.php"; var CATALOGUE_URL = "http://" + LOCAL_URL + "/index.php?page=catalogue"; var CAMERA_STORE_SERVICES = "www.camerastore.com.au/diamondcamera"; var CAMERA_STORE = "www.camerastore.com.au"; var url_productlist = "http://www.camerastore.com.au/diamondcamera/productlist.asp"; //Default var proxyurl = "http://"+LOCAL_URL+"/_proxyphp/proxy.php"; //Local class that relays external site (js security work around) var url_catalogue = "http://www.camerastore.com.au/diamondcamera/catalogue.asp"; //catalogue url //============================================================================ // // Gets the URL, the Parameter and the hash value // function getUrlParamHash(passedUrl) { var url = ""; var param = ""; var hash = ""; var urlSplit; var paramSplit; var fullUrl = (passedUrl == undefined) ? window.location.href : passedUrl; var openStr=""; if (fullUrl.indexOf("http://") != -1) { openStr = "http://"; fullUrl = fullUrl.replace(openStr, ""); } while (fullUrl.indexOf("//") != -1) fullUrl = fullUrl.replace("//", "/"); fullUrl = openStr + fullUrl; urlSplit = fullUrl.split("?"); url = urlSplit[0]; if (urlSplit.length > 1) paramSplit = urlSplit[1].split("#"); if (paramSplit != undefined) { if (paramSplit.length > 0) { param = "?" + paramSplit[0]; if (paramSplit.length > 1) { hash = "#" + paramSplit[1]; } } } return ({url:url, param: param, hash:hash}); } //============================================================================ // // set CameraStore Anchor Click Functions // set ajax className so correct CSS can be applied // $(document).ready( function() { var ajax_cs = $("#ajax_cs"); var urlParamHash = getUrlParamHash(); var url = urlParamHash.url; var param = urlParamHash.param; var hash = urlParamHash.hash; manipulatePageHTML(param, hash); var contenturl; if (ajax_cs.get(0) != undefined) { //if there is ajax to do $(window).bind( 'hashchange', doHashChange); if (param === "?page=catalogue" && hash !== "") { doHashChange(); } else { ajax_cs.data('ajax_url', proxyurl+"?url="+url_productlist); ajax_cs.get(0).className = url_productlist.replace("http://", "").replace("www.camerastore.com.au/", "").replaceAll("/", "-").replaceAll(".", "_"); ajax_cs.html(ajax_load); contenturl = proxyurl+"?url="+url_productlist+"&callingurl="+window.location.href; if (isIE6) { //=============================================================== //======== I E 6 =========== I E 6 ============ I E 6 =========== manualLoad(contenturl); //=============================================================== } else { $("#loading").fadeTo("slow", 1); ajax_cs.load(contenturl, null, setCameraStoreAnchorClickFunctions); } } } }); //============================================================================ // // Function exists because JQuery.load() hangs on IE6 for some reason // - probably because response text big and its handled in some fancy jquery way :S // function manualLoad(aurl) { var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } xmlhttp.open('GET', aurl, true); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200) { var buffer=''; var i_end = xmlhttp.responseText.length-1; var target =document.getElementById('ajax_cs'); target.innerHTML = xmlhttp.responseText; // !!!!!setCameraStoreAnchorClickFunctions duplication var name = setNewHtmlClassName(target); target.className = (name != undefined) ? name : target.className; } } } xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(null); } function manipulatePageHTML(param, hash) { var colLeft = $(".col_left"); var colRight = $(".col_right"); var subnav = $(".subnav"); if (colLeft.get(0) == undefined) colLeft = $(".col_left_sm"); if (colLeft.get(0) != undefined) { colLeft.get(0).className = "col_left_sm"; //...ENSURE MAKE COLLEFT IS OF CLASS COL_LEFT_SM if (colRight.get(0)==undefined) { colRightDOM = document.createElement('div'); colRightDOM.className = 'col_right'; insertAfter(colLeft.get(0).parentNode, colRightDOM.cloneNode(true), colLeft.get(0)); } colRight = $(".col_right"); //ref the object (referencing html dom colRight.html(ajax_load).load(RIGHT_COL_URL, null); //=============================================================== //======== I E 6 =========== I E 6 ============ I E 6 =========== if (!isIE6) { makeRoundedBox(colLeft.get(0).getElementsByTagName("h1")); //...MAKE SLIDING DOOR H1'S } //======== I E 6 =========== I E 6 ============ I E 6 =========== //=============================================================== } } //============================================================================ // // When URL changes // function doHashChange(e) {// Get the hash (fragment) as a string, with any leading # removed. Note that// in jQuery 1.4, you should use e.fragment instead of $.param.fragment(). var url = $.param.fragment(); var ajax_cs = $( '#ajax_cs' ); //$( 'a.bbq-current' ).removeClass( 'bbq-current' ); //If theres a marked current, remove marking //ajax_cs.children( ':visible' ).hide(); // Hide any visible ajax content. url && $( 'a[href="#' + url + '"]' ).addClass( 'bbq-current' ); // Mark s with this url if not empty. var spliturl = $.URLDecode(url).split("?"); //split the target-url from the target-url-params if (spliturl.length > 1) { ajax_cs.html(ajax_load); ajax_cs.data('ajax_url', url); var proxyurlparams = proxyurl+"?url="+spliturl[0]+"&"+spliturl[1]; //add target-url as a proxy-url-param if (isIE6) { //=============================================================== //======== I E 6 =========== I E 6 ============ I E 6 =========== manualLoad(proxyurlparams); //=============================================================== } else { $("#loading").fadeTo("slow", 1); ajax_cs.load(proxyurlparams, null, setCameraStoreAnchorClickFunctions); } } } //============================================================================ // // set CameraStore Anchor Click Functions // set ajax className so correct CSS can be applied // function setCameraStoreAnchorClickFunctions(responseText, textStatus, XMLHttpRequest) { var name = setNewHtmlClassName($(this)); this.className = (name != undefined) ? name : this.className; } //============================================================================ // // Adds Html and classnames so this element has a sliding door backround // // function makeRoundedBox(list) { var open = '
'; var close = '
'; var div =document.createElement('div'); var tmpStyle; var listItem for (i=0; i