$(document).ready(function () {
    switch (siteCode) {
    case "CA":
        try {
            var d = "/directdownload-fr.asp";
            try {
                if ($("#tab-container").length > 0) {
                    $(".tabs").tabs(".panes > div", {
                        initialIndex: 0,
                        effect: "fade",
                        fadeInSpeed: 800,
                        fadeOutSpeed: 800
                    })
                }
            } catch (c) {}
            try {
                if ($("#Table_DL > a").length > 0) {
                    setTimeout(function () {
                        $("#Table_DL a").tooltip({
                            tip: ".tooltip",
                            position: "bottom right"
                        })
                    }, 666)
                }
            } catch (c) {}
            try {
                flashembed("calogoflash", {
                    src: "/images/flash/ca/ca_logoflash.swf",
                    wmode: "transparent",
                    version: [9, 0]
                }, {
                    homelink: "/"
                })
            } catch (c) {}
            if ($("#free500").length > 0) {
                switch (currency) {
                case "GBP":
                    curValue = "gbp";
                    break;
                case "EURO":
                    curValue = "eur";
                    break;
                default:
                    curValue = "usd";
                    break
                }
                flashembed("free500", {
                    src: "/images/flash/ca/downloadbutton_fr.swf",
                    wmode: "transparent",
                    version: [9, 0]
                }, {
                    downlink: d,
                    siteCurr: curValue
                })
            }
            if ($("#camovie").length > 0) {
                flashembed("camovie", {
                    src: "/images/flash/ca/ca_movie_fr.swf",
                    wmode: "transparent",
                    version: [9, 0]
                }, {
                    downlink: d
                })
            }
        } catch (c) {
            alert(c.description)
        }
        try {
            if ($("#newMenu > a").length > 0) {
                setTimeout(function () {
                    $("#newMenu a[class=hasTooltipSubMenuLeft]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom left",
                        offset: [0, 204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRight]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRightLarge]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -234]
                    });
                    $("#newMenu div.menu_tooltip").hover(function () {
                        $(this).prev("a").addClass("menuItemActive")
                    }, function () {
                        $(this).prev("a").removeClass("menuItemActive")
                    })
                }, 666)
            }
        } catch (c) {}
        break;
    case "UKC":
        try {
            if ($("#Table_DL > a").length > 0) {
                setTimeout(function () {
                    $("#Table_DL a ").tooltip({
                        tip: ".tooltip",
                        position: "bottom right"
                    })
                }, 666)
            }
        } catch (c) {}
        try {
            if ($("#newMenu > a").length > 0) {
                setTimeout(function () {
                    $("#newMenu a[class=hasTooltipSubMenuLeft]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom left",
                        offset: [0, 204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRight]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRightLarge]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -254]
                    });
                    $("#newMenu div.menu_tooltip").hover(function () {
                        $(this).prev("a").addClass("menuItemActive")
                    }, function () {
                        $(this).prev("a").removeClass("menuItemActive")
                    })
                }, 666)
            }
        } catch (c) {}
        try {
            if ($("#tab-container").length > 0) {
                $(".tabs").tabs(".panes > div", {
                    initialIndex: 3,
                    effect: "fade",
                    fadeInSpeed: 800,
                    fadeOutSpeed: 800
                })
            }
        } catch (c) {}
        try {
            var d = "/directdownload-fr.asp";
            if ($("#ukcmovie").length > 0) {
                switch (currency) {
                case "GBP":
                    curValue = "gbp";
                    break;
                case "EURO":
                    curValue = "eur";
                    break;
                default:
                    curValue = "usd";
                    break
                }
                //if (flashGender == "male") {
                    swfFile = "/images/flash/ukc/ukc_flash_fr_m.swf"
                //} else {
                //    swfFile = "/images/flash/ukc/ukc_flash_fr_f.swf"
                //}
                flashembed("ukcmovie", {
                    src: swfFile,
                    wmode: "opaque",
                    version: [9, 0]
                }, {
                    downlink: d,
                    siteCurr: curValue
                    //gender: flashGender
                })
            }
        } catch (c) {}
        break;
    case "CC":
        try {
            if ($("#bottleman").length > 0) {
                $.easing.custom = function (a, b, n, i, h) {
                    var g = 1.70158;
                    if ((b /= h / 2) < 1) {
                        return i / 2 * (b * b * (((g *= (1.525)) + 1) * b - g)) + n
                    }
                    return i / 2 * ((b -= 2) * b * (((g *= (1.525)) + 1) * b + g) + 2) + n
                };
                window.api = $("#bottleman").scrollable({
                    size: 1,
                    loop: true,
                    keyboard: false,
                    clickable: true,
                    easing: "custom",
                    speed: 1000
                }).circular()
            }
        } catch (c) {
            alert(c.description)
        }
        try {
            if ($("#newMenu > a").length > 0) {
                setTimeout(function () {
                    $("#newMenu a[class=hasTooltipSubMenuLeft]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom left",
                        offset: [0, 204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRight]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRightLarge]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -254]
                    });
                    $("#newMenu div.menu_tooltip").hover(function () {
                        $(this).prev("a").addClass("menuItemActive")
                    }, function () {
                        $(this).prev("a").removeClass("menuItemActive")
                    })
                }, 666)
            }
        } catch (c) {}
        break;
    case "BJB":
    case "GT":
    case "ZC":
        try {
            if ($("#midground").length > 0) {
                $("#midground").css({
                    backgroundPosition: "0px 0px"
                });
                $("#foreground").css({
                    backgroundPosition: "0px 0px"
                });
                $("#midground").animate({
                    backgroundPosition: "(-10000px -2000px)"
                }, 240000, "linear");
                $("#foreground").animate({
                    backgroundPosition: "(-10000px -2000px)"
                }, 120000, "linear")
            }
        } catch (f) {}
        try {
            var e = "/directdownload-fr.asp";
            if ($("#zcmovieA").length > 0) {
                switch (currency) {
                case "GBP":
                    curValue = "gbp";
                    break;
                case "EURO":
                    curValue = "eur";
                    break;
                default:
                    curValue = "usd";
                    break
                }
                flashembed("zcmovieA", {
                    src: "/images/flash/zc/zc_bonus-v3c_fr.swf",
                    wmode: "opaque",
                    version: [9, 0]
                }, {
                    downlink: e,
                    siteCurr: curValue
                })
            }
            if ($("#zcmovieB").length > 0) {
                switch (currency) {
                case "GBP":
                    curValue = "gbp";
                    break;
                case "EURO":
                    curValue = "eur";
                    break;
                default:
                    curValue = "usd";
                    break
                }
                flashembed("zcmovieB", {
                    src: "/images/flash/zc/zc_bonus-v3d_fr.swf",
                    wmode: "opaque",
                    version: [9, 0]
                }, {
                    downlink: e,
                    siteCurr: curValue
                })
            }
        } catch (f) {}
        try {
            if ($("#newMenu > a").length > 0) {
                setTimeout(function () {
                    $("#newMenu a[class=hasTooltipSubMenuLeft]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom left",
                        offset: [0, 204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRight]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRightLarge]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -234]
                    });
                    $("#newMenu div.menu_tooltip").hover(function () {
                        $(this).prev("a").addClass("menuItemActive")
                    }, function () {
                        $(this).prev("a").removeClass("menuItemActive")
                    })
                }, 666)
            }
        } catch (c) {}
        break;
    case "CCC":
        try {
            if ($("#newMenu > a").length > 0) {
                setTimeout(function () {
                    $("#newMenu a[class=hasTooltipSubMenuLeft]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom left",
                        offset: [0, 204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRight]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -204]
                    });
                    $("#newMenu a[class=hasTooltipSubMenuRightLarge]").tooltip({
                        tip: ".menu_tooltip",
                        position: "bottom right",
                        offset: [0, -252]
                    });
                    $("#newMenu div.menu_tooltip").hover(function () {
                        $(this).prev("a").addClass("menuItemActive")
                    }, function () {
                        $(this).prev("a").removeClass("menuItemActive")
                    })
                }, 666)
            }
        } catch (c) {}
        break
    }
    try {
    
         if ($("#wc10dropin").length > 0)
        {
            setTimeout(function()
            {                
                $f("wc10VideoLayer", "http://cdn.casinorewards.com/webCDN/js/flowplayer-3.2.1.swf", {
                    clip: { width:410,height:231,autoPlay:true,autoBuffering:true,
                            onFinish: function(){ this.getPlugin("play").hide(); setTimeout(function(){ $("#wc10dropin").hide(); }, 6666); }
                    },    
                    playlist: [ 
                        {url:'http://s3.casinorewards.com/vids/misc/worldcup/divpop/new/worldcup_divpop_fr.flv', wmode:'opaque'} 
                    ],
                    plugins: {controls: {playlist:true,display:'none'} 
                    }
                }); 
                $("#wc10dropin").show();               
                $("#wc10dropin").animate({ top: "+=50px" }, 100).animate({ top: "-=25px" }, 80).animate({ top: "+=15px" }, 60).animate({ top: "-=10px" }, 50);               
                $("#wc10Close").click(function() {
                    $f().pause();
                    $("#wc10dropin").hide();
                });
            },
            1000);
           
        }
    
        if ($("#Table_DL > a").length > 0) {
            $("#Table_DL a").tooltip({
                tip: ".tooltip",
                position: "bottom right",
                relative: true
            })
        }
        if ($(".rssarea").length > 0) {
            setTimeout(function () {
                rssTicker(".rssarea .headline")
            }, 666)
        }
        if ($("#videoLayer").length > 0) {
            setTimeout(function () {
                createplayer()
            }, 666)
        }
        if (($("input[name=progressive55]").length > 0) || ($("input[name^=progressive]").length > 0)) {
            $.ajax({
                type: "GET",
                url: "http://www.tickerassist.co.uk/ProgressiveTickers/WebServiceProgressiveTickerScript.asmx/renderScript?form=json",
                success: function () {
                    setTimeout(function () {
                        if ($("input[name^=progressive]").length > 0) {
                            counter = $("input[name^=progressive]").length;
                            switch (counter) {
                            case 16:
                                try {
                                    ScrollTotals(currency);
                                    ShowCounters(currency)
                                } catch (a) {}
                                break;
                            default:
                                if ($("input[name=progressive55]").length > 0) {
                                    try {
                                        ScrollTotals(currency)
                                    } catch (a) {}
                                } else {
                                    try {
                                        thisCounter = $("input[name^=progressive]").attr("name").replace("progressive", "");
                                        ScrollCounters(thisCounter, currency)
                                    } catch (a) {}
                                }
                                break
                            }
                        }
                    }, 2000)
                }, dataType: "script",
                cache: false
            })
        }
        try {
            if ($("#marqueeScroller").length > 0) {
                window.api = $("#marqueeScroller").scrollable({
                    size: 1,
                    loop: true,
                    speed: 2000,
                    keyboard: false,
                    clickable: false,
                    vertical: false
                }).circular().autoscroll({
                    autoplay: true,
                    api: true,
                    autopause: false,
                    interval: 3000
                })
            }
        } catch (c) {}
        try {
            if ($("div#s2").length > 0) {
                $.easing.custom = function (a, b, n, i, h) {
                    var g = 1.70158;
                    if ((b /= h / 2) < 1) {
                        return i / 2 * (b * b * (((g *= (1.525)) + 1) * b - g)) + n
                    }
                    return i / 2 * ((b -= 2) * b * (((g *= (1.525)) + 1) * b + g) + 2) + n
                };
                window.api = $("#s2").scrollable({
                    size: 1,
                    vertical: true,
                    loop: true,
                    keyboard: false,
                    clickable: false,
                    easing: "custom",
                    speed: 1500
                }).circular().autoscroll({
                    autoplay: true,
                    api: true,
                    autopause: false
                })
            }
        } catch (c) {}
        try {
            if ($("div#s3").length > 0) {
                $.easing.custom = function (a, b, n, i, h) {
                    var g = 1.70158;
                    if ((b /= h / 2) < 1) {
                        return i / 2 * (b * b * (((g *= (1.525)) + 1) * b - g)) + n
                    }
                    return i / 2 * ((b -= 2) * b * (((g *= (1.525)) + 1) * b + g) + 2) + n
                };
                window.api = $("#s3").scrollable({
                    size: 1,
                    vertical: true,
                    loop: true,
                    keyboard: false,
                    clickable: false,
                    easing: "custom",
                    speed: 1500
                }).circular().autoscroll({
                    autoplay: true,
                    api: true,
                    autopause: false
                })
            }
        } catch (c) {}
        if ($("#rate1").length > 0) {
            setTimeout(function () {
                $("#rate1").rating("/recordvote.asp", {
                    maxvalue: 5,
                    curvalue: 4,
                    increment: 0.5
                })
            }, 666)
        }
        if ($("a.download").length > 0) {
            setTimeout(function () {
                tb_download_init("a.download")
            }, 666)
        }
        if ($("#pwcreports").length > 0) {
            setTimeout(function () {
                tb_download_init("a.pwc")
            }, 666)
        }
    } catch (c) {
        alert(c.description)
    }
});

function tb_download_init(b) {
    $(b).click(function () {
        var f = "T&#x00E9;l&#x00E9;chargez notre logiciel de casino, prot&#x00E9;g&#x00E9; contre les virus";
        var a = this.rev + "?TB_iframe=true&height=160&width=440&modal=false" || null;
        var e = this.rel || false;
        tb_show(f, a, e);
        this.blur();
        return true
    })
};

