﻿function setmenu() {
    if (document.URL.indexOf('home.php') > 0) {
        document.getElementById('mindex1').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex1').removeAttribute('href');
    }
    if (document.URL.indexOf('appointment.php') > 0) {
        document.getElementById('mindex2').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex2').removeAttribute('href');
    }
    if (document.URL.indexOf('insurance.php') > 0) {
        document.getElementById('mindex3').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex3').removeAttribute('href');
    }
    if (document.URL.indexOf('rootcanal') > 0) {
        document.getElementById('mindex4').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex4').removeAttribute('href');
        document.getElementById('sindex4').style.display = 'none';
    }
    if (document.URL.indexOf('meetendodontist.php') > 0) {
        document.getElementById('mindex5').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex5').removeAttribute('href');
    }
    if (document.URL.indexOf('oneteam.php') > 0 |
                document.URL.indexOf('behindscenes.php') > 0) {
        document.getElementById('mindex6').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex6').removeAttribute('href');
        document.getElementById('sindex6').style.display = 'none';
    }
    if (document.URL.indexOf('peoplesay.php') > 0) {

        document.getElementById('mindex7').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex7').removeAttribute('href');
    }
    if (document.URL.indexOf('locations.php') > 0 |
                document.URL.indexOf('craycroft_road.php') > 0 |
                document.URL.indexOf('oracle_road.php') > 0 |
                document.URL.indexOf('contact_us.php') > 0) {
        document.getElementById('mindex8').setAttribute('style', 'textDecoration:underline');
        document.getElementById('mindex8').removeAttribute('href');
        document.getElementById('sindex8').style.display = 'none';
    }
}

function scrollIt() {
    if (screen.width < 1000) {
        window.scrollTo(300, 0);
    }
    else if (screen.width < 1623) {
        var x = (1623 - screen.width) / 2;
        window.scrollBy(x, 0);
    }
}

function parseQueryString() {
    var args = new Object;
    var query = location.search.substring(1);
    var pairs = query.split("&");
    for (var i = 0; i < pairs.length; i++) {
        var pos = pairs[i].indexOf('=');
        if (pos == -1) continue;
        var argname = pairs[i].substring(0, pos);
        var value = pairs[i].substring(pos + 1);
        args[argname] = unescape(value);
    }
    return args;
}

function getPage() {
    var apages = "ans1tot ans2tot ans3tot ans4tot ans5tot ans6tot ans7tot";
    var ipages = "ans1tot ans2tot ans3tot ans4tot ans5tot ans6tot ans7tot ans8tot ans9tot";
    var rspages = "ans1tot ans2tot ans3tot ans4tot ans5tot ans7tot ans8tot ans9tot ans10tot ans11tot ans12tot ans13tot ans14tot";
    var rbpages = "ans1tot ans2tot ans3tot ans4tot ans5tot ans6tot";
    var rapages = "ans1tot ans2tot ans3tot ans4tot ans5tot ans6tot ans7tot";
    var rwpages = "ans1tot ans2tot";
    var stringargs = parseQueryString();
    if (document.URL.indexOf('appointment.php') > 0) {
        if (stringargs.page && apages.indexOf(stringargs.page) != -1) {
            document.getElementById(stringargs.page).style.display = 'block';
        }
        else {
            document.getElementById('ans2tot').style.display = 'block';
        }
    }
    if (document.URL.indexOf('insurance') > 0) {
        if (stringargs.page && ipages.indexOf(stringargs.page) != -1) {
            document.getElementById('answer').innerHTML = document.getElementById(stringargs.page).innerHTML;
        }
        else {
            document.getElementById('answer').innerHTML = document.getElementById('ans1tot').innerHTML;
        }
    }
    if (document.URL.indexOf('rootcanalscience.php') > 0) {
        if (stringargs.page && rspages.indexOf(stringargs.page) != -1) {
            document.getElementById('answer').innerHTML = document.getElementById(stringargs.page).innerHTML;
        }
        else {
            document.getElementById('answer').innerHTML = document.getElementById('ans1tot').innerHTML;
        }
    }
    if (document.URL.indexOf('rootcanalbefore.php') > 0) {
        if (stringargs.page && rbpages.indexOf(stringargs.page) != -1) {
            document.getElementById('answer').innerHTML = document.getElementById(stringargs.page).innerHTML;
        }
        else {
            document.getElementById('answer').innerHTML = document.getElementById('ans1tot').innerHTML;
        }
    }
    if (document.URL.indexOf('rootcanalafter.php') > 0) {
        if (stringargs.page && rapages.indexOf(stringargs.page) != -1) {
            document.getElementById('answer').innerHTML = document.getElementById(stringargs.page).innerHTML;
        }
        else {
            document.getElementById('answer').innerHTML = document.getElementById('ans1tot').innerHTML;
        }
    }
    if (document.URL.indexOf('rootcanalwhat.php') > 0) {
        if (stringargs.page && rwpages.indexOf(stringargs.page) != -1) {
            document.getElementById('answer').innerHTML = document.getElementById(stringargs.page).innerHTML;
        }
        else {
            document.getElementById('answer').innerHTML = document.getElementById('ans1tot').innerHTML;
        }
    }
}


function getDrPage() {
    var pages2 = "rightcol1 rightcol3";
    var pages3 = "rightcol1 rightcol2 rightcol3";
    var stringargs = parseQueryString();
    if (document.URL.indexOf('funk.php') > 0 || document.URL.indexOf('bui.php') > 0 || document.URL.indexOf('douville.php') > 0) {
        if (stringargs.page && pages2.indexOf(stringargs.page) != -1) document.getElementById('rightcol').innerHTML = document.getElementById(stringargs.page).innerHTML;
    }
    else {
        if (stringargs.page && pages3.indexOf(stringargs.page) != -1) document.getElementById('rightcol').innerHTML = document.getElementById(stringargs.page).innerHTML;
    }
}    



function displaydiv(mydiv) {
    hidePara1("ans1tot", "ans2tot", "ans3tot", "ans4tot", "ans5tot", "ans6tot", "ans7tot", "ans8tot", "ans9tot");
    document.getElementById('laurenstory').innerHTML = ""
    document.getElementById('libbystory').innerHTML = ""
    document.getElementById(mydiv).style.display = 'block';

}
function displaydiv1(mydiv) {
    document.getElementById("answer").innerHTML = document.getElementById(mydiv).innerHTML;
}
function displaydiv2(mydiv, indiv) {
    document.getElementById(indiv).innerHTML = document.getElementById(mydiv).innerHTML;
}

function displayslide(totdiv, div) {
    hidePara1("ans1tot", "ans2tot", "ans3tot", "ans4tot", "ans5tot", "ans6tot", "ans7tot", "ans8tot", "ans9tot");
    document.getElementById(totdiv).style.display = 'block';
    if (div = "laurenstory") document.getElementById(div).innerHTML = laurenstory;
    if (div = "libbystory") document.getElementById(div).innerHTML = libbystory;
}
function displayslide1(totdiv, div) {
    hidePara1("rightcol");
    document.getElementById(totdiv).style.display = 'block';
    document.getElementById(div).innerHTML = lemstory;
}
function displayslide2(totdiv, div) {
    displaydiv1(totdiv);
    document.getElementById(div).innerHTML = lemstory;
}

function hidePara1() {
    for (var i = 0; i < arguments.length; i++)
        document.getElementById(arguments[i]).style.display = 'none';
}
function hideDisplay() {
    for (var i = 1; i < arguments.length; i++) {
        document.getElementById(arguments[i]).style.display = 'none';
    }
    document.getElementById(arguments[0]).style.display = 'block';
}
function displayhomevid() {
    if (document.getElementById('video').innerHTML == "") {
        document.getElementById('video').innerHTML = homevid;
        document.getElementById('startstop').innerHTML = '&nbsp;stop';
    }
    else {
        if (document.getElementById('video').innerHTML.indexOf('images/homepic.jpg') != -1) {
            document.getElementById('video').innerHTML = homevid;
            document.getElementById('startstop').innerHTML = '&nbsp;stop';
        }
        else {
            document.getElementById('video').innerHTML = homepic;
            document.getElementById('startstop').innerHTML = '&nbsp;start';
        }
    }
}

// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() {
    return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}
function pageHeight() {
    return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;
}
function posLeft() {
    return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}
function posTop() {
    return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}
function posRight() {
    return posLeft() + pageWidth();
}
function posBottom() {
    return posTop() + pageHeight(); 
}
                    