﻿// JScript File
/* EF Object */
var EF = {
    /* Short hand to return object in global */
    $_script: function () {
        return this.Global.ScriptHandler
    },
    $_util: function () {
        return this.Global.Utilities
    },

    /* -- Global */
    Global: {
        _jqueryRequired: true,
        ScriptHandler: {
            Load: function (scriptObj) {
                var s = scriptObj.length;
                for (var i = 0, s = scriptObj.length; i < s; i++) {
                    if (typeof scriptObj[i] == "string") {
                        this[scriptObj[i]].Load()
                    } else {
                        this[scriptObj[i][0]].Load(scriptObj[i][1])
                    }
                }
            },
            Colorbox: {
                Load: function () {
                    EF.Global.utilities.Write("js", "/includes/scripts/jquery.colorbox-min.js");
                }
            },
            Coremetrics: {
                Load: function (obj) {
                    if (obj['cmdata'] && obj['cmdata'] == true) EF.Global.Utilities.Write("js", "/includes/scripts/Coremetrics/cmdatatagutils.js");
                    if (obj['eluminate'] && obj['eluminate'] == true) EF.Global.Utilities.Write("js", "/includes/scripts/Coremetrics/V40/eluminate.js");
                    if (obj['techprops'] && obj['techprops'] == true) EF.Global.Utilities.Write("js", "/includes/scripts/Coremetrics/V40/techprops.js");
                }
            },
            jQueryCycle: {
                Load: function () {
                    EF.Global.Utilities.Write("js", "/includes/scripts/jquery.cycle.all.min.js");
                }
            },
            nyroModal: {
                Load: function () {
                    /* nyroModal loaded */
                    EF.Global.Utilities.Write("js", "/includes/scripts/jquery.nyroModal-1.2.8.min.js");
                }
            },
            ThickBox: {
                Load: function () {
                    EF.Global.Utilities.Write("css", "/includes/css/thickbox.css");
                    EF.Global.Utilities.Write("js", "/includes/scripts/thickbox.js");
                    EF.Global.Utilities.Write("js", "/includes/scripts/Glossary.js");
                }
            },
            sIFR: {
                Load: function () {
                    EF.Global.Utilities.Write("js", "/includes/scripts/sifr.js");
                }
            }
        },
        Utilities: {
            CookieManager: {
                /* Create cookie */
                Bake: function (name, value, days) {
                    var date = new Date();
                    days = days || 1
                    document.cookie = name + "=" + value + "; Max-Age=" + (60 * 60 * 24 * days) + "; path=/";
                },
                /* Create session cookie */
                Session: function (name, value) {
                    document.cookie = name + "=" + value + "; path=/";
                },
                Consume: function (name, key) {
                    var arr = this._Check(name);
                    var condition = undefined;
                    if (arr) {
                        arr = unescape(arr).split("&");
                        for (var i = 0; i < arr.length; i++) {
                            var t = arr[i].split("|");
                            for (var g = 0; g < t.length; g++) {
                                t[g] = t[g].split("=");
                            }
                            for (var counter = 0; counter < t.length; counter++) {
                                if (unescape(t[counter][0]) == key) {
                                    condition = t[counter][1];
                                    break;
                                }
                            }
                        }
                        return condition;
                    } else {
                        return condition;
                    }
                },
                /* Checks for key or key/value pair in cookie - hacked together for leadform*/
                Check: function (name, key, value) {
                    var arr = this._Check(name);
                    var condition = false;
                    if (arr) {
                        arr = unescape(arr).split("&");
                        for (var i = 0; i < arr.length; i++) {
                            var t = arr[i].split("|");
                            for (var g = 0; g < t.length; g++) {
                                t[g] = t[g].split("=");
                            }
                            for (var counter = 0; counter < t.length; counter++) {
                                if (arguments.length == 2) {
                                    if (unescape(t[counter][0]) == key) {
                                        condition = true;
                                        break;
                                    }
                                } else {
                                    if (unescape(t[counter][0]) == key & unescape(t[counter][1]) == value) {
                                        condition = true;
                                        break;
                                    }
                                }
                            }
                        }
                        return condition;
                    } else {
                        return condition;
                    }
                },
                /* Helper - returns value of specified cookie */
                _Check: function (name) {
                    var s = document.cookie.split(';');
                    for (var i = 0, l = s.length; i < l; i++) {
                        var c = s[i].toString(), f, r;
                        f = c.substring(0, c.indexOf("="))
                        r = c.substring(c.indexOf("=") + 1, c.length)
                        while (f.charAt(0) == " ") f = f.substring(1, f.length)
                        if (f == name) return r;
                    }
                }
            },
            EqualHeights: function (el1, el2) {
                if ($(el1).outerHeight() > $(el2).outerHeight()) {
                    $(el2).height(($(el1).outerHeight() - $(el2).outerHeight()) + $(el2).height());
                } else {
                    $(el1).height(($(el2).outerHeight() - $(el1).outerHeight()) + $(el1).height());
                }
            },
            GetDimensions: function (Width_Height_or_Both) {
                Width_Height_or_Both = Width_Height_or_Both.toLowerCase()

                switch (Width_Height_or_Both) {
                    case "width":
                        return { "width": width() }
                        break;
                    case "height":
                        return { "height": height() }
                        break;
                    case "both":
                        return { "width": width(), "height": height() }
                        break;
                    default:
                        return { "width": width(), "height": height() }
                        break;
                }
                function height() {
                    return Math.max(
              Math.max(document.body.scrollHeight, document.documentElement.scrollHeight),
              Math.max(document.body.offsetHeight, document.documentElement.offsetHeight),
              Math.max(document.body.clientHeight, document.documentElement.clientHeight)
          );
                }
                function width() {
                    return Math.max(
            Math.max(document.body.scrollWidth, document.documentElement.scrollWidth),
            Math.max(document.body.offsetWidth, document.documentElement.offsetWidth),
            Math.max(document.body.clientWidth, document.documentElement.clientWidth)
          );
                }
            },
            Glossary: {
                Tooltip: function (divID, spanID, vis, shortDesc) {
                    var docElement = document.getElementById(divID);
                    if (docElement) {
                        docElement.style.display = vis ? "inline" : "none";
                        docElement.style.visibility = vis ? "visible" : "hidden";
                    }
                    if (shortDesc != 'Nothing') {
                        document.getElementById(spanID).innerHTML = shortDesc;
                    }
                    return false;
                },
                showDefn: function (spanID, defnTxt) {
                    var glossaryDesc;
                    var temp = new Array();

                    temp = defnTxt.split('%20');
                    temp = temp.join(' ');
                    defnTxt = temp;
                    temp = defnTxt.split('%#');
                    temp = temp.join('\'');
                    defnTxt = temp;
                    temp = defnTxt.split('%^');
                    temp = temp.join('"');
                    defnTxt = temp;
                    temp = defnTxt.split('%(');
                    temp = temp.join('<');
                    defnTxt = temp;
                    temp = defnTxt.split('%)');
                    glossaryDesc = temp.join('>');
                    document.getElementById(spanID).innerHTML = glossaryDesc;
                }
            },
            PrintPage: function (ctl) {
                $("#" + ctl).bind("click", function (e) {
                    var address = location.protocol + "//" + location.hostname + $(this).attr('href');
                    EF.$_util().OpenWindow({
                        url: address,
                        name: "PrinterFriendly",
                        toolbar: "no",
                        location: "no",
                        height: "600",
                        width: "650"
                    })
                    return false;
                })
            },
            OpenWindow: function (param) {
                var url = param.url
                var name = param.name || "newWindow";
                var status = param.status || 'yes';
                var toolbar = param.toolbar || 'yes';
                var location = param.location || 'yes';
                var menubar = param.menubar || 'yes';
                var resizable = param.resizable || 'yes';
                var scrollbars = param.scrollbars || 'yes';
                var height = param.height || 500;
                var width = param.width || 700;
                var features = 'status=' + status + ',toolbar=' + toolbar + ',location=' + location + ',menubar=' + menubar + ',resizable=' + resizable + ',scrollbars=' + scrollbars + ',width=' + width + ',height=' + height;
                eval("window.open('" + url + "','" + name + "','" + features + "')")
            },
            PrintWindow: function () {
                window.print()
            },
            sIFR: {
                Settings: {
                    Variables: {
                        Helvetica: {
                            src: "/includes/flash/HelveticaNeueH2Std.swf"
                        },
                        ToReplace: {
                            // Replaces h2 with class of tagline
                            Tagline: {
                                selector: "h1.tagline",
                                Css: "padding:0px; margin:0px; font-size:22px; color:#FFAE00;"
                            },
                            // Replaces Side nav bar header
                            SideNavHeader: {
                                selector: ".sideNavHeader",
                                Css: "color:#FFFFFF; font-size:11px; text-transform:uppercase; margin-bottom: 3px;"
                            }
                        }
                    },
                    StyleCheck: true
                },
                Activate: function (obj, swf) {
                    sIFR.useStyleCheck = this.Settings.StyleCheck;
                    sIFR.activate({ src: this.Settings.Variables[swf].src });
                    this.sIFRize(obj, swf);
                },
                sIFRize: function (obj, swf) {
                    sIFR.replace({ src: this.Settings.Variables[swf].src }, {
                        selector: this.Settings.Variables.ToReplace[obj].selector,
                        css: ['.sIFR-root {' + this.Settings.Variables.ToReplace[obj].Css + '}'],
                        wmode: 'transparent',
                        forceSingleLine: 'true',
                        fixFocus: 'true'
                    })
                }
            },
            SwapImage: function (ctl, url) {
                $("#" + ctl).attr('src', url);
            },
            Write: function (type, src) {
                switch (type) {
                    case "js":
                        var script = document.createElement("script");
                        script.setAttribute("type", "text/javascript");
                        script.setAttribute("src", src);
                        document.getElementsByTagName("head")[0].appendChild(script);
                        break;
                    case "css":
                        var link = document.createElement("link");
                        link.setAttribute("rel", "stylesheet");
                        link.setAttribute("type", "text/css");
                        link.setAttribute("href", src);
                        link.setAttribute("media", "screen");
                        document.getElementsByTagName("head")[0].appendChild(link);
                    default:
                        /* did you pass in the proper type? */
                        break;
                }
            }
        }
    },

    /* -- Teachers */
    Teachers: {
        /* -- Browse our tours for Non-Flash users */
        BrowseOurTours: {
            BindFlash: function () {
                $("#BrowseOurToursMap").css({ "display": "none", "visibility": "hidden" });
                swfobject.embedSWF('/includes/flash/worldMap.swf', 'flash-map', '566', '283', '9.0.0', '', flashvars, params)
            },
            Settings: {
                Variables: {
                    //Hover image variables
                    BrowseMapOrig: new String(),
                    BrowseMapImage: new Array(),
                    CurrentRegion: new String()
                },
                Link: $("#CountryList").find('a'),
                RegionCode: {
                    G1: ["EuropeAfricaImg", "map_uk.gif"],
                    G2: ["EuropeAfricaImg", "map_france.gif"],
                    G3: ["EuropeAfricaImg", "map_italy.gif"],
                    G4: ["EuropeAfricaImg", "map_spain.gif"],
                    G5: ["EuropeAfricaImg", "map_greece.gif"],
                    G6: ["EuropeAfricaImg", "map_germany.gif"],
                    G7: ["EuropeAfricaImg", "map_scandinavia.gif"],
                    G8: ["EuropeAfricaImg", "map_eastern_europe.gif"],
                    C3: ["AmericasImg", "map_americas.gif"],
                    C5: ["EuropeAfricaImg", "map_africa.gif"],
                    C4: ["AsiaPacImg", "map_asia.gif"]
                },
                Bindings: {
                    mouseOver: function () {
                        $("a").mouseenter(function (e) {
                            var $_var = EF.Teachers.BrowseOurTours.Settings.Variables;
                            var url = $(this).attr('href');
                            var regionregex = /[GC]\d/;
                            $_var.CurrentRegion = regionregex.exec(url);
                            try {
                                var ImageSrc = $('img[id$=' + EF['Teachers']['BrowseOurTours']['Settings']['RegionCode'][$_var.CurrentRegion][0] + ']').attr('src')
                                $_var.BrowseMapOrig = ImageSrc;
                                $_var.BrowseMapImage[0] = ImageSrc.substring(0, ImageSrc.lastIndexOf("/") + 1);
                                $_var.BrowseMapImage[1] = ImageSrc.substring(ImageSrc.lastIndexOf("/") + 1);
                                $('img[id$=' + EF['Teachers']['BrowseOurTours']['Settings']['RegionCode'][$_var.CurrentRegion][0] + ']').attr('src', $_var.BrowseMapImage[0] + EF['Teachers']['BrowseOurTours']['Settings']['RegionCode'][$_var.CurrentRegion][1])
                            } catch (err) { }
                        })
                    },
                    mouseOut: function () {
                        $("#CountryList").find("a").mouseleave(function () {
                            var $_var = EF.Teachers.BrowseOurTours.Settings.Variables;
                            try {
                                $('img[id$=' + EF['Teachers']['BrowseOurTours']['Settings']['RegionCode'][$_var.CurrentRegion][0] + ']').attr('src', $_var.BrowseMapOrig)
                            } catch (err) { }
                        })
                    }
                }
            }, /* End Settings */
            Init: function () {
                this.BindFlash();
                this.Settings.Bindings.mouseOver();
                this.Settings.Bindings.mouseOut();
            }
        },
        /* Start - Liveball Marketing */
        LiveBall: {
            Private: function () {
                var playing = new Boolean();
                return function setter(condition) {
                    if (arguments.length == 0) return playing;
                    playing = condition;
                    if (playing == "true") {
                        EF.Teachers.LiveBall.killTimer(EF.Teachers.LiveBall.Private._timer);
                        return playing;
                    } else if (playing == "false") {
                        EF.Teachers.LiveBall.setTimer();
                        return playing;
                    }
                }
            },
            showModal: function () {
                /* Load ColorBox for pop-in -- Will eventually replace nryo and ThickBox */
                $.fn.colorbox({
                    href: EF.Teachers.LiveBall.Private._liveball,
                    iframe: true,
                    overlayClose: false,
                    innerWidth: EF.Teachers.LiveBall.Private._width,
                    innerHeight: EF.Teachers.LiveBall.Private._height,
                    opacity: 0.3,
                    onLoad: function () {
                        $("select").css("display", "none");
                        $("html").css("overflow-x", "hidden");
                        var dimensions = EF.$_util().GetDimensions('both');
                        $("#cboxOverlay").css({
                            "height": dimensions['height'],
                            "width": dimensions['width']
                        })
                    },
                    onCleanup: function () {
                        $("#cboxClose").css("display", "none")
                        $("select").css("display", "inline");
                        $("html").css("overflow-x", "auto");
                    },
                    onClosed: function () {
                        /* Create EFLD cookie */
                        EF.Global.Utilities.CookieManager.Session("EFLD", escape("Viewed=True"));

                        /* Increment counter */
                        var _count = parseInt(EF.Global.Utilities.CookieManager.Consume("EFFEDCK", "Count")) + 1;
                        EF.Global.Utilities.CookieManager.Bake("EFFEDCK", "Count=" + _count, "180");
                    }
                })
            },
            setTimer: function () {
                EF.Teachers.LiveBall.Private._timer = setTimeout('EF.Teachers.LiveBall.showModal()', EF.Teachers.LiveBall.Private._timeout);
            },
            killTimer: function (timer) {
                try {
                    clearTimeout(timer)
                } catch (err) { }
            },
            Init: function (url, timeout, width, height, iframe) {

                /* Create counter cookie, if nec. */
                if (!EF.Global.Utilities.CookieManager.Check("EFFEDCK", "Count")) {
                    EF.Global.Utilities.CookieManager.Bake("EFFEDCK", "Count=0", "180");
                }

                if (EF.Global.Utilities.CookieManager.Check("EFLD", "Viewed", "True") || EF.Global.Utilities.CookieManager.Check("EFFEDCK", "Count", "3")) return /*silently*/;

                /* Call and set CSS */
                var lnk = document.createElement("link");
                lnk.rel = "stylesheet";
                lnk.type = "text/css";
                lnk.href = "includes/css/colorbox.css";
                document.getElementsByTagName("head")[0].appendChild(lnk);

                EF.Teachers.LiveBall.Private._liveball = url;
                EF.Teachers.LiveBall.Private._timeout = timeout || 15000;
                EF.Teachers.LiveBall.Private._width = width || 400;
                EF.Teachers.LiveBall.Private._height = height || 660;
                this.setTimer()
            },
            FlashInit: function () {
                return EF.Teachers.LiveBall.Private._temp = new this.Private()
            }
        }
    },
    /* -- Students */
    Students: {
        TeachersTour: {
            SetLeftPhotoLinks: function () {
                var country = $.ResolveID("CountryNamePhoto")[0].value;
                var photo = $.ResolveID("hlSideNavItem").filter(":contains('Photo')")[0];
                photo.href = photo.href.substring(0, photo.href.lastIndexOf("/") + 1);
                photo.href = photo.href + country + ".aspx";
                return;
            },
            SetLeftVideoLinks: function () {
                var country = $.ResolveID("CountryNameVideo")[0].value;
                var video = $.ResolveID("hlSideNavItem").filter(":contains('Video')")[0];
                video.href = video.href.substring(0, video.href.lastIndexOf("/") + 1);
                video.href = video.href + country + ".aspx";
                return;
            },
            SetLeftGuidesLinks: function () {
                var country = $.ResolveID("CountryNameGuides")[0].value;
                var countryGuide = $.ResolveID("hlSideNavItem").filter(":contains('Country')")[0];
                countryGuide.href = countryGuide.href.substring(0, countryGuide.href.lastIndexOf("/") + 1);
                countryGuide.href = countryGuide.href + country + "/printerfriendlyversion.aspx?p=y&h=y";
                return;
            }
        }
    },
    /* -- Parents */
    Parents: {

},
/* -- About Us */
AboutUs: {

},
/* -- Contact Us */
ContactUs: {

}
}

/* GLOBAL . JS*/
function openwindow() {
    /* PARIS ORIENTATION */
    window.open('http://eftours.com/forteachers/leadinganeftour/parisorientation/VideoPopup.aspx', 'Something', 'height=300,width=340,left=420,top=340,modal=1,dialog=1,menubar=0,location=0,resizable=0,status=0,scrollbars=0,toolbar=0,directories=0');
}
//for login page to show and hide the div.

//for Left Navigations
function SetSearchKey(ctlid, key) {
    document.getElementById(ctlid).value = key;
}
function OpenPopup(url, width, height, left, top, resizeable, scrollbar, status) {
    var mywindow = window.open(url, "FAQ", "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ",resizable=" + resizeable + ",scrollbars=" + scrollbar + ",status=" + status + "");
    mywindow.focus();
}
//for getstarted control in parents page
function EmptyText(id) {
    document.getElementById(id).value = "";
}
//To change the src of a control
function SwapImage(Ctrl, Url) {
    document.getElementById(Ctrl).src = Url;
}
//To show and hide the Flag Holder
function onFlag() {
    document.getElementById('divFlags').style.visibility = 'visible';
    document.getElementById('divFlags').style.display = 'inline';
}
function offFlag() {
    document.getElementById('divFlags').style.visibility = 'hidden';
    document.getElementById('divFlags').style.display = 'none';
}
//To Download Adobe Reader
function RedirectUrl() {
    var url = "http://www.adobe.com/products/reader/"
    window.open(url);
}
function Validchk(username, password, unamediv, passdiv, message) {
    var un = username;
    var uname;
    uname = document.getElementById(username).value;
    pass = document.getElementById(password).value;
    if (uname == '' && pass == '') {
        document.getElementById(unamediv).style.visibility = 'visible';
        document.getElementById(unamediv).style.display = 'block';
        document.getElementById(passdiv).style.visibility = 'visible';
        document.getElementById(passdiv).style.display = 'block';
        document.getElementById(message).style.visibility = 'visible';
        document.getElementById(message).style.display = 'block';
        return false;
    } else if (uname == '') {
        document.getElementById(unamediv).style.visibility = 'visible';
        document.getElementById(unamediv).style.display = 'block';
        document.getElementById(passdiv).style.visibility = 'hidden';
        document.getElementById(passdiv).style.display = 'none';
        document.getElementById(message).style.visibility = 'visible';
        document.getElementById(message).style.display = 'block';
        return false;
    } else if (pass == '') {
        document.getElementById(passdiv).style.visibility = 'visible';
        document.getElementById(passdiv).style.display = 'block';
        document.getElementById(unamediv).style.visibility = 'hidden';
        document.getElementById(unamediv).style.display = 'none';
        document.getElementById(message).style.visibility = 'visible';
        document.getElementById(message).style.display = 'block';
        return false;
    } else {
        document.getElementById(unamediv).style.visibility = 'hidden';
        document.getElementById(unamediv).style.display = 'none';
        document.getElementById(passdiv).style.visibility = 'hidden';
        document.getElementById(passdiv).style.display = 'none';
        document.getElementById(message).style.visibility = 'hidden';
        document.getElementById(message).style.display = 'none';
        return true;
    }
}
// Links in countDownTravelpage 
function NewWindow(url) {
    var myHeight = document.documentElement.clientHeight; //window.outerHeight();
    var myWidth = screen.availWidth - 10;
    window.open(url, "Something", "width=" + myWidth + ",height=" + myHeight + '",left=0,top=0,modal=1,dialog=1,menubar=0,location=0,resizable=0,status=0,scrollbars=1,toolbar=0,directories=0');
}
// Script for StudentGetStarted user control
function hideErrorMessage(objCtrl) {
    document.getElementById(objCtrl).style.display = "none";
    document.getElementById(objCtrl).style.visibility = "hidden";
}
//Script to validate weblogin password
function ValidatePwd(source, args) {
    var regExp, result;
    var usrname = document.getElementById("ctl00_ContentPlaceHolder1_RegUserName").value;
    var pwdCtrl = document.getElementById("ctl00_ContentPlaceHolder1_RegPassword");
    var pwdval = pwdCtrl.value;
    regExp = new RegExp("^\\w*(?=\\w*\\d)(?=\\w*[a-zA-Z])\\w*$", "i");
    result = pwdval.match(regExp)
    if (result == null || result == ",\*" || pwdval.length < 6 || pwdval.length > 16 || usrname.toLowerCase() == pwdval.toLowerCase()) {
        pwdCtrl.focus();
        args.IsValid = false;
    }
}
function ValidatePassword(source, args) {
    var regExp, result;
    var pwdCtrl = document.getElementById("ctl00_ctl00_ContentPlaceHolder1_CenterContent_NewPassword");
    var pwdval = pwdCtrl.value;
    regExp = new RegExp("^\\w*(?=\\w*\\d)(?=\\w*[a-zA-Z])\\w*$", "i");
    result = pwdval.match(regExp)
    if (result == null || result == ",\*" || pwdval.length < 6 || pwdval.length > 16) {
        pwdCtrl.focus();
        args.IsValid = false;
    }
}
function setHeightForDivs() {
    var browser = navigator.appName;
    var val;
    if (browser == "Microsoft Internet Explorer") {
        val = 0
    } else {
        val = 75
    }
    setheight(val);
}
function setheight(setvalue) {
    if ((document.getElementById('CDiv1').clientHeight > document.getElementById('CDiv3').clientHeight) && (document.getElementById('CDiv1').clientHeight > document.getElementById('CDiv2').clientHeight)) {
        document.getElementById('CDiv2').style.height = setvalue + document.getElementById('CDiv1').clientHeight + "px";
        document.getElementById('CDiv3').style.height = setvalue + document.getElementById('CDiv1').clientHeight + "px";
        document.getElementById('CDiv1').style.height = setvalue + document.getElementById('CDiv1').clientHeight + "px";
    } else if ((document.getElementById('CDiv2').clientHeight > document.getElementById('CDiv1').clientHeight) && (document.getElementById('CDiv2').clientHeight > document.getElementById('CDiv3').clientHeight)) {
        document.getElementById('CDiv1').style.height = setvalue + document.getElementById('CDiv2').clientHeight + "px";
        document.getElementById('CDiv3').style.height = setvalue + document.getElementById('CDiv2').clientHeight + "px";
        document.getElementById('CDiv2').style.height = setvalue + document.getElementById('CDiv2').clientHeight + "px";
    } else if ((document.getElementById('CDiv3').clientHeight > document.getElementById('CDiv1').clientHeight) && (document.getElementById('CDiv3').clientHeight > document.getElementById('CDiv1').clientHeight)) {
        document.getElementById('CDiv1').style.height = setvalue + document.getElementById('CDiv3').clientHeight + "px";
        document.getElementById('CDiv2').style.height = setvalue + document.getElementById('CDiv3').clientHeight + "px";
        document.getElementById('CDiv3').style.height = setvalue + document.getElementById('CDiv3').clientHeight + "px";
    } else {
    }
}
/*Importing functions.js to Global*/
function OpenWindow(url, wname, params) {
    /* FAQ LIST - Leading an EF Tour */
    var oWin = window.open(url, wname, params);
    return false;
}
function SwapImg(ctrl, img) {
    document.getElementById(ctrl).src = img;
}
function showlargemap(pageURL, title, w, h) {
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}
function closeWin() {
    window.close();
}
function printdiv() {
    window.print();
}

/***********************
Resolve Client ID plugin

@usage Context provided:
$("#Navigation").ResolveID('ClientID');

@usage No Context:
$.ResolveID('ClientID');
or
$().ResolveID('ClientID');

************************/
(function($, window){
    plugin = $.fn.ResolveID = $["ResolveID"] = function(args){
        /* check for client id argument */
        if(arguments.length){
            /* check for context */
            if(this.selector){
                return $(this.selector).find("[id$='"+args+"']");
            } else {
                return $("[id$='"+args+"']");
            }
        }
    };
})(jQuery, this);