﻿function FP_changeProp() {//v1.0
    var args = arguments, d = document, i, j, id = args[0], o = FP_getObjectByID(id), s, ao, v, x;
    d.$cpe = new Array(); if (o) for (i = 2; i < args.length; i += 2) {
        v = args[i + 1]; s = "o";
        ao = args[i].split("."); for (j = 0; j < ao.length; j++) {
            s += "." + ao[j]; if (null == eval(s)) {
                s = null; break;
            }
        } x = new Object; x.o = o; x.n = new Array(); x.v = new Array();
        x.n[x.n.length] = s; eval("x.v[x.v.length]=" + s); d.$cpe[d.$cpe.length] = x;
        if (s) eval(s + "=v");
    }
}

function FP_getObjectByID(id, o) {//v1.0
    var c, el, els, f, m, n; if (!o) o = document; if (o.getElementById) el = o.getElementById(id);
    else if (o.layers) c = o.layers; else if (o.all) el = o.all[id]; if (el) return el;
    if (o.id == id || o.name == id) return o; if (o.childNodes) c = o.childNodes; if (c)
        for (n = 0; n < c.length; n++) { el = FP_getObjectByID(id, c[n]); if (el) return el; }
    f = o.forms; if (f) for (n = 0; n < f.length; n++) {
        els = f[n].elements;
        for (m = 0; m < els.length; m++) { el = FP_getObjectByID(id, els[n]); if (el) return el; }
    }
    return null;
}


function FP_preloadImgs() {//v1.0
    var d = document, a = arguments; if (!d.FP_imgs) d.FP_imgs = new Array();
    for (var i = 0; i < a.length; i++) { d.FP_imgs[i] = new Image; d.FP_imgs[i].src = a[i]; }
}



function SetHomeTabs() {
    SelectPage("home");
}
function SetCeremoniesTabs() {
    SelectPage("ceremonies");
    document.getElementById("garden").className = "selected";
}

function SetPhotoAndVideoTabs() {
    SelectPage("photoAndVideo");
}

function SetMakeUpTabs() {
    SelectPage("makeup");
}

function SetBridalTabs() {
    SelectPage("bridal");
}
function SelectPage(pageName) {
    document.getElementById("home").className = "normal";
    document.getElementById("ceremonies").className = "normal";
    document.getElementById("photoAndVideo").className = "normal";
    document.getElementById("makeup").className = "normal";
    document.getElementById("bridal").className = "normal";

    var element = document.getElementById(pageName);
    if (element != null) {
        element.className = "selected";
    }
}


function SetTabs() {
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    switch (sPage.toLowerCase()) {
        case 'default.aspx':
        case '':
            SetHomeTabs();
            break;
        case 'garden.aspx':
        case 'ceremonies.aspx':
            SetCeremoniesTabs();
            break;
        case 'photoandvideo.aspx':
            SetPhotoAndVideoTabs();
            break;
        case 'makeup.aspx':
            SetMakeUpTabs();
            break;
        case 'bridal.aspx':
            SetBridalTabs()
            break;
        case 'contactus.aspx':
            SelectPage("contactus");
        case 'foodmenu.aspx':
        case 'decoration.aspx':
        case 'marriagecontracttable.aspx':
        case 'traditionalcoffeeshop.aspx':
        case 'coffeeshop.aspx':
        case 'photographyandvideoshooting.aspx':
        case 'catering.aspx':
        case 'bride.aspx':
        case 'artistic.aspx':
            SetHomeTabs()
            break;
    }
}
