﻿$(document).ready(function() {
    $("#password-clear").show();
    $("#password-field").hide();
    $("#username-clear").show();
    $("#username-field").hide();
    $("#username-clear").focus(function() {
        $("#username-clear").hide();
        $("#username-field").show();
        $("#username-field").focus()
    });
    $("#username-field").blur(function() {
        if ($("#username-field").val() == "") {
            $("#username-clear").show();
            $("#username-field").hide()
        }
    });
    $("#password-clear").focus(function() {
        $("#password-clear").hide();
        $("#password-field").show();
        $("#password-field").focus()
    });
    $("#password-field").blur(function() {
        if ($("#password-field").val() == "") {
            $("#password-clear").show();
            $("#password-field").hide()
        }
    });

    $(".modalTB").click(function(event) {
        var b = $(this).attr("href");
        var c = $(this).attr("title");
        tb_show(c, b + "?TB_iframe=true&height=450&width=690&modal=false", true);
        event.preventDefault();
    });

    $(".colorBox").click(function(event) {
        alert("!!");
        var b = $(this).attr("href");
        var c = $(this).attr("title");
        $.colorbox({href:'"+b+"', transition:'none', iframe:true, innerWidth:'690px', innerHeight:'440px' });
        event.preventDefault();
    });
    
    

    if ($("#bankingSelect").length > 0) {
        $(".BankItem").hide();
        $("." + $("#bankingSelect").val()).show();
        $("#bankingSelect").change(function() {
            var b = $("#bankingSelect").val();
            if (b == "all") {
                $(".BankItem").show()
            } else {
                $(".BankItem").hide();
                setTimeout(function() {
                    $("." + b).show()
                }, 250)
            }
        });
        $(".bankIcon").click(function() {
            var b = "." + $(this).attr("name");
            $(b).toggle("slow")
        })
    }
    if ($("#newsSelect").length > 0) {
        $(".NewsItem").hide();
        $("." + $("#newsSelect").val()).show();
        $("#newsSelect").change(function() {
            var b = $("#newsSelect").val();
            if (b == "all") {
                $(".NewsItem").show()
            } else {
                $(".NewsItem").hide();
                setTimeout(function() {
                    $("." + b).show()
                }, 250)
            }
        })
    }
    if (($("input[name=progressive55]").length > 0) || ($("input[name^=progressive]").length > 0)) {
        var a = "USD";
        $.ajax({
            type: "GET",
            url: "http://www.tickerassist.co.uk/ProgressiveTickers/WebServiceProgressiveTickerScript.asmx/renderScript?form=json",
            success: function() {
                setTimeout(function() {
                    if ($("input[name=progressive55]").length > 0) {
                        try {
                            ScrollTicker(55, a)
                        } catch (c) { }
                    }
                    for (var b = 1; b < 18; b++) {
                        if ($("input[name=progressive" + b + "]").length > 0) {
                            try {
                                ScrollTicker(b, a)
                            } catch (c) { }
                        }
                    }
                }, 600)
            },
            dataType: "script",
            cache: true
        })
    }
    if ($(".rssarea").length > 0) {
        setTimeout(function() {
            rssTicker(".rssarea .headline")
        }, 666)
    }
});
