﻿// <reference path="JQuery.js" />

function AppDevMouseOver(PanelId) {

    var ctrlID = $("[id$='tcApplicationDevTabs']").attr("id");
    var ctrl = $get(ctrlID).control;

    if (PanelId.indexOf("tpStrategy") > -1) {
        var TabNumber = 0;
    }
    if (PanelId.indexOf("tpTechnology") > -1) {
        var TabNumber = 1;
    }
    if (PanelId.indexOf("tpIntegration") > -1) {
        var TabNumber = 2;
    }
    ctrl.set_activeTabIndex(TabNumber);
}

function ValidateUsZip(source, args) {
    var regex = /^\d{5}((\-)?\d{4})?$/;
    var selection = $("[id$='ddlStates']").val();
    //Do not validate if the user chooses Outside the US
    if (selection == "OU" || selection == "0") {
        args.IsValid = true;
        return;
    }

    if (args.Value.match(regex)) {
        args.IsValid = true;
    }
    else {
        args.IsValid = false;
    }
}

function ValidateUsPhone(source, args) {
    var regex = /^(((\(\d{3}\))|(\d{3}))(\-| )?)?\d{3}(\-)\d{4}$/;
    var selection = $("[id$='ddlStates']").val();

    //Do not validate if the user chooses Outside the US
    if (selection == "OU" || selection == "0") {
        args.IsValid = true;
        return;
    }

    if (args.Value.match(regex)) {
        args.IsValid = true;
    }
    else {
        args.IsValid = false;
    }
}
