﻿// JScript File

$(document).ready(function() {
    $(document).pngFix();

    $(".contactItem .txtBox").focus(function() {
        $(this).removeClass("txtBox");
        $(this).addClass("txtBoxOn");
    });

    $(".contactItem .txtBox").blur(function() {
        $(this).removeClass("txtBoxOn");
        $(this).addClass("txtBox");
    });

    $(".FAQ a").click(function() {
        var xState = $(this).parent().parent().children(".answer").css("display");
        if (xState != "none") {
            $(this).removeClass("on");
            $(this).parent().parent().children(".answer").hide();
        } else {
            $(".FAQ .answer").hide();
            $(".FAQ a").removeClass("on");
            $(this).parent().parent().children(".answer").show();
            $(this).addClass("on");
        };
    });

    $(".cboxes input").click(function() {
        $(".cboxes input").removeAttr("checked");
        $(this).attr("checked", "true");
        $("#ctl00_ContentPlaceHolder1_txtPrimary").val($(this).val());
    });

    $("a.costLink").click(function() {
        var id = $(this).attr("id").replace("cost", "");
        openCost(id);
    });

    $("#goLinks a.open").click(function() {
        var str = $(this).attr("id");
        str = Right(str, str.length - (str.lastIndexOf("_lnkGo") + 6))
        openWin(str);
    });
});

openWin = function(oStr, noPos){
    var radWindow = GetRadWindowManager().GetWindowByName("gtWindowDef");
    radWindow.setUrl("bp.aspx?id=" + oStr)
    radWindow.Show();
};

openCost = function(oStr){
    var radWindow = GetRadWindowManager().GetWindowByName("gtWindowDef");
    radWindow.setUrl("cost.aspx?id=" + oStr)
    radWindow.Show();
};

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
