﻿if (parent != self) {
    parent.location = ""
    //if (parent.name.match("GB_frame")) {

    //}
    //else {  }
}

function swapPane(btn) {
    var allBtnContainer = btn.parentNode.parentNode;
    var allBtns = allBtnContainer.getElementsByTagName("a");
    var allPanes = document.getElementsByTagName("div");
    var buttonNumber = 0;
    var paneNumber = 0;
    var i;
    for (i = 0; i < allBtns.length; i++) {
        allBtns[i].className = "off";
        if (allBtns[i] == btn) {
            allBtns[i].className = "on";
            buttonNumber = i;
        }
    }
    var k;
    for (k = 0; k < allPanes.length; k++) {
        if (allPanes[k].className.indexOf("selector_pane") !=-1 && allPanes[k].className.indexOf("_container")==-1) {
            allPanes[k].className = "selector_pane";
            if (paneNumber == buttonNumber) {
                allPanes[k].className = allPanes[k].className + " on";
            }
            paneNumber++;
        }
    }
}

var popUp = "<table id=\"popUpTable\"><tr><td><img src=\"images/layout/holderness_laser_clinic.jpg\" alt=\"Holderness Laser Clinic\" /></td></tr><tr><td>60 Hull Road, Hessle, East Yorkshire, HU13 0AN, UK<br><br></td></tr><tr><td><input type=\"text\" size=\"25\" id=\"popUpFromAddress\" value=\"Get directions from:\" defaultText=\"Get directions from:\" onKeyPress=\"return enterDirections(event, this);\" onFocus=\"javascript:clearInput(this)\" onBlur=\"javascript:clearInput(this)\" /></td></tr></table>";
var submittedFromAddress = "";
function loadMap() {
    if (GBrowserIsCompatible()) {
        var geocoder = null;
        var addressMarker;
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        //map.addControl(new GOverviewMapControl(new GSize(50,50)) );
        GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleErrors);
        map.enableDoubleClickZoom();
        map.enableScrollWheelZoom();
        map.setCenter(center, 7);
        map.setMapType(G_NORMAL_MAP);
        addOverlays();
    }
    else {
        document.getElementById("google_map_container").style.display = "none";
        document.getElementById("map_image").style.display = "block";
    }
}
var marker;
function addOverlays() {
    var locationIcon = new GIcon();
    locationIcon.iconSize = new GSize(50, 50);
    locationIcon.image = "images/layout/holderness_laser_clinic_map_logo.png";
    //locationIcon.shadowSize = new GSize(37, 34);
    locationIcon.iconAnchor = new GPoint(25, 25);
    locationIcon.infoWindowAnchor = new GPoint(25, 25);
    locationIcon.infoShadowAnchor = new GPoint(18, 25);
    markerOptions = { icon: locationIcon };
    marker = new GMarker(center, markerOptions);
    map.addOverlay(marker);
    //marker.openInfoWindowHtml(popUp);
    GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(popUp);
    }
		)
}


function resetMap() {
    map.clearOverlays();
    map.setZoom(7);
    map.panTo(center);
    addOverlays();
    //map.addOverlay(marker);
    //marker.openInfoWindowHtml(popUp);
}

function setDirections(directionsInput) {
    var fromAddress = document.getElementById(directionsInput).value;
    processing();
    //var fromAddress = document.getElementById("fromAddress").value;
    //if(fromAddress=="")
    //{alert("Please enter either a postcode, or a street and town and try again.");resetMap();return;}
    var toAddress = "Holderness Laser Clinic @ 53.72285, -0.43087";

    map.clearOverlays();
    submittedFromAddress = fromAddress;
    gdir.load("from: " + fromAddress + " to: " + toAddress);
}

function handleErrors() {
    processing();

    if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS) {
        alert("We couldn't find your exact address \"" + submittedFromAddress + "\". This may be because the address you specified is relatively new, incorrect, or you may have to be more specific.\n\nPlease try again.\n\nIf this problem persists, please contact Holderness Laser Clinic on 01482 654 863");
        resetMap();
        marker.openInfoWindowHtml(popUp);
        return;
    }
    if (gdir.getStatus().code == G_GEO_SERVER_ERROR) {
        alert("Your directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code + "\n\nPlease try again, putting either postcode or street and town in to the directions box");
        resetMap();
        marker.openInfoWindowHtml(popUp);
        return;
    }
    if (gdir.getStatus().code == G_GEO_MISSING_QUERY) {
        alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);
        resetMap();
        marker.openInfoWindowHtml(popUp);
        return;
    }
    //   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
    //     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);

    if (gdir.getStatus().code == G_GEO_BAD_KEY) {
        alert("We could not process your query at this present time.\n\n Please contact Holderness Laser Clinic on 01482 654 863 with the following error:\n\n Error code: " + gdir.getStatus().code + " - Map Key Invalid");
        resetMap();
        marker.openInfoWindowHtml(popUp);
        return;
    }
    if (gdir.getStatus().code == G_GEO_BAD_REQUEST) {
        alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
        resetMap();
        marker.openInfoWindowHtml(popUp);
        return;
    }
    else {
        alert("Please check your address and try again.");
        resetMap();
        marker.openInfoWindowHtml(popUp);
        return;
    }

}

function onGDirectionsLoad() {

}
function processing() {

}

function view(request, width, height, title, description, type) {
    width = (width == "") ? "500" : width;
    height = (height == "") ? "500" : height;
    type = (type == undefined) ? null : type;
    description = (description == "" || description == undefined) ? "" : description;
    var frameSrc = request.href;
    title = (title == "undefined" ? request.title : title)
    if (type == null) {
        frameSrc = frameSrc + "?&iframe=true&width=" + width + "&height=" + height;
    }
    jQuery.prettyPhoto.open(frameSrc, description, title);
}

function clearInput(input) {
    var defaultText = input.getAttribute("defaultText");
    var currentText = input.value;
    if (currentText == defaultText) {
        input.value = "";
        return;
    }
    else if (currentText == "") {
        input.value = defaultText;
        return;
    }
}



function enterDirections(evt, input) {
    var charCode = (evt.which) ? evt.which : event.keyCode;
   if (charCode == 13) {
       setDirections(input.id);
   }
   else{
        return true;
   }
}


function showHideNav(btnClicked) {
    var panelName = btnClicked.getElementsByTagName("span")[1].innerHTML.toLowerCase().replace(/ /g, "_") + "_nav";
    var allNavPanels = document.getElementById("nav_column").getElementsByTagName("li");
    var i;
    for (i = 0; i < allNavPanels.length; i++) {
        var panelClass = allNavPanels[i].className;
        if (panelClass.match(panelName)) {
            if (panelClass.match(" show")) {
                allNavPanels[i].className = allNavPanels[i].className.replace(" show", " hide");
                btnClicked.getElementsByTagName("img")[0].className = "plus";
            }
            else {
                allNavPanels[i].className = allNavPanels[i].className.replace(" hide", " show");
                btnClicked.getElementsByTagName("img")[0].className = "minus";
            }
        }
    }
}

function tabNav(tabBtn, type) {
    var allTabs = document.getElementById(type + "_tabs").getElementsByTagName("a");
    var allPanels = document.getElementById(type + "s").getElementsByTagName("div");
    var tabName;

    var i;
    for (i = 0; i < allTabs.length; i++) {
        allTabs[i].className = "off";
        if (allTabs[i] == tabBtn) {
            tabName = tabBtn.innerHTML.toLowerCase().replace(/ /g, "_").replace("+", "") + "_panel";
            tabBtn.className = "on";
            tabBtn.blur();
        }
    }
    var j;
    for (j = 0; j < allPanels.length; j++) {
        if (allPanels[j].className.match(type + "_panel")) {
            allPanels[j].className = allPanels[j].className.replace("show", "hide");  
            if (allPanels[j].className.match(tabName)) {
                allPanels[j].className = allPanels[j].className.replace("hide", "show");
            }
        }
    }
}


function innerTabNav(tabBtn, type) {
    var allTabs = document.getElementById(type + "_tabs").getElementsByTagName("a");
    var allPanels = document.getElementById("range_panel").getElementsByTagName("div");
    var tabName;

    var i;
    for (i = 0; i < allTabs.length; i++) {
        allTabs[i].className = "off";
        if (allTabs[i] == tabBtn) {
            tabName = tabBtn.innerHTML.toLowerCase().replace(/ /g, "_").replace("+", "").replace(/&amp;/g, "and").replace("®", "") + "_panel";
            tabBtn.className = "on";
            tabBtn.blur();
        }
    }
    var j;
    for (j = 0; j < allPanels.length; j++) {
        if (allPanels[j].className.match("range_panel")) {
            allPanels[j].className = allPanels[j].className.replace("show", "hide");
            if (allPanels[j].className.match(tabName)) {
                allPanels[j].className = allPanels[j].className.replace("hide", "show");
            }
        }
    }
}



function handleImage(image, folder) {
    if (folder !== "") {
        folder = folder + "/"
    }
    image.src = "http://shop.laser-removal-treatment.co.uk/catalogue/images/" + folder + "awaiting_image.jpg";
    //var imageLink = image.parentNode;
    //.href = "";
    //imageLink.rel = "";
    //imageLink.getElementsByTagName("span")[0].style.display = "none";
    //decoGreyboxLinks();
}

function addToBagASP(sender, args) {
    //__doPostBack('ctl00$MainContentContainer$FeaturedItem1$AddToBag_Btn', '')
    var disclaimerCheckBox = checkBox;
    var disclaimerPrompt = "You must certify that you have read and understand that precautions for using this product before you can add it to your bag.";
    var allPageListTags = document.getElementsByTagName("li")
    var disclaimerContainer;
    var k;
    for (k = 0; k < allPageListTags.length; k++) {
        if (allPageListTags[k].className.match("disclaimer")) {
            disclaimerContainer = allPageListTags[k];
            break;
        }
    }
    var allTabs = document.getElementById("info_tabs").getElementsByTagName("a");
    var precautionsBtn;
    var i;
    for (i = 0; i < allTabs.length; i++) {
        if (allTabs[i].innerHTML.toLowerCase().match("precautions")) {
            precautionsBtn = allTabs[i];
        }
    }
    if (disclaimerCheckBox !== null) {
        if (disclaimerCheckBox.checked) {
            if (navigator.userAgent.match("MSIE 6")) {
                window.location = document.getElementById("ctl00_MainContentContainer_FeaturedItem1_AddToBag_Btn").getAttribute("ie6Add2Bag");
            }
            else{
                args.IsValid = true;
            }            
        }
        else {
            disclaimerContainer.className = disclaimerContainer.className.replace("off", "alert");
            if (precautionsBtn != "undefined") {
                if (precautionsBtn.style.display !== "none") {
                    tabNav(precautionsBtn, 'info')
                }
            }
            args.IsValid = false;
            alert(disclaimerPrompt);
        }
    }
}

function showPanel() {
    if (document.URL.toLowerCase().match("range")) {
        var Range = document.URL.toLowerCase().split("range=")[1];
    }
    else {
        return;
    }
    var allTabs = document.getElementsByTagName("a");
    var i;
    for (i = 0; i < allTabs.length; i++) {
        if (allTabs[i].innerHTML.toLowerCase() == Range.replace("-", " ")) {
            innerTabNav(allTabs[i], 'range')
        }
    }
}

function Qtip() {
    jQuery('.qtip_1').qtip({
        content: "<p>Dr Malgorzata Korab-Karpinska</p><br><p>Laser Technician</p><br><p>MD - GMC Registered BTEC Laser and Assosciated aesthetic therapies.</p><br><p>Qualified Ellipse Laser Technician since 2006. Gosia specialises in treatment of pigmented lesions and thread veins in addition to skin rejuvenation, anti-aging treatment and hair removal. She also performs aesthetic treatments including skin peels and medical micro-deramabrasion, She is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: 250, y: -190 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'leftMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_2').qtip({
        content: "<p>Claire Bristow</p><br><p>Senior Beauty Therapist</p><br><p>5 Years experience in the beauty industry. Specialist nail technician. Clare performs aesthetic treatments including skin peels and medical micro-dermabrasion, She is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges. Clare is also fully trained in the application of Bare Escentuals mineral make up.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: 230, y: -155 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'leftMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_3').qtip({
        content: "<p>Sally Jenkinson</p><br><p>Laser Technician and Holistic Therapist</p><br><p>Qualified Ellipse Laser technician since 2005 at the Holderness Laser Clinic. Qualified Holistic Therapist since 2005. Sally enjoys performing all aesthetic treatments including skin peels and medical micro-dermabrasion, She is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges. Sally is also fully trained in the application of Bare Escentuals mineral make up.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: 240, y: -150 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'leftMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_4').qtip({
        content: "<p>Katie Stone</p><br><p>BTEC National Diploma in Beauty Therapy and Applied Science</p><br><p>Laser Technician</p><br><p>Senior Beauty Therapist with 7 yrs experience. Qualified Ellipse Laser Technician since 2006 at the Holderness Laser Clinic. Katie enjoys performing all aesthetic treatments including skin peels and medical micro-dermabrasion, She is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges. Katie is also fully trained in the application of Bare Escentuals mineral make up.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: 230, y: -175 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'leftMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_5').qtip({
        content: "<p>Allison Smith</p><br><p>RGN Bsc(Hons)</p><br><p>Managing Director</p><br><p>Allison has 30 yrs experience in the NHS/Private sector working in Intensive Care and Occupational Health. Allison qualified as an Ellipse Laser Technician in 2005. Allison is responsible for the day to day administration of the clinic and maintaining the Clinics Care Quality Commission registration as an Independent private health clinic and upholding the high professional standards. She is also able to provide advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges.</p>",
        position: {
            corner: { tooltip: 'center', target: 'bottomMiddle' },
            adjust: { x: 7, y: -400 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'bottomMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_6').qtip({
        content: "<p>Lesley Smith</p><br><p>RGN</p><br><p>Laser Technician</p><br><p>Lesley has more than 30 yrs experience working within the NHS. Qualified Ellipse Laser Technician since 2005 when she joined the Holderness Laser Clinic team. She thoroughly enjoys performing all aesthetic treatments including skin peels and medical micro-deramabrasion, Lesley is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: -235, y: -180 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'rightMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_7').qtip({
        content: "<p>Jo McDonnell</p><br><br><p>Laser Technician</p><br><p>Qualified Ellipse Laser technician at the Holderness Laser Clinic since 2007 Jo also performs aesthetic treatments including skin peels and medical micro-dermabrasion, She is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges. Jo is also fully trained in the application of Bare Escentuals mineral make up.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: -235, y: -165 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'rightMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_8').qtip({
        content: "<p>Elaine McDonnell</p><br><br><p>Senior Beauty Therapist</p><br><p>7 Yrs experience in the beauty industry Elaine performs aesthetic treatments including skin peels and medical micro-dermabrasion, She is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges. Elaine is also fully trained in the application of Bare Escentuals mineral make up. Elaine specialises in massage, eyebrow shaping and nail art.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: -245, y: -205 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'rightMiddle', size: { x: 30, y: 30} }
        }
    });

    jQuery('.qtip_9').qtip({
        content: "<p>Anneka Johnstone</p><br><p>NVQ Level 3</p><br><p>Senior Beauty Therapist</p><br><p>Anneka joined the Holderness Laser Clinic in June 2009 Advanced skin specialist training with Priori products specialising in Microdermabrasion, massage, facials, waxing and nail technician. Anneka performs aesthetic treatments including skin peels and medical micro-dermabrasion, She is also able to provide full skin consultations and advice on PRIORI® Advanced AHA, Idebenone Superceutical, Coffeeberry Natureceutical & Vitage ranges. Anneka is also fully trained in the application of Bare Escentuals mineral make up.</p>",
        position: {
            corner: { tooltip: 'topMiddle', target: 'center' },
            adjust: { x: -245, y: -230 }
        },
        style: {
            width: 400, padding: 20, background: '#fff', color: '#707070', fontWeight: 'bold', textAlign: 'center', border: { radius: 3, color: '#8CC658' }, filter: 'alpha(opacity=80)', opacity: 'opacity:0.7', tip: { corner: 'rightMiddle', size: { x: 30, y: 30} }
        }
    });
}
