﻿function initialLoad() {
    $(".point10").fadeIn(function() {
        $(".point9").fadeIn(function() {
            $(".point8").fadeIn(function() {
                $(".point7").fadeIn(function() {
                    $(".point6").fadeIn(function() {
                        $(".point5").fadeIn(function() {
                            $(".point4").fadeIn(function() {
                                $(".point3").fadeIn(function() {
                                    $(".point2").fadeIn(function() {
                                        $(".point1").fadeIn(function() {
                                            $(this).parent().find('.city-not-found').each(function() {
                                                $(this).hide()
                                            })
                                            $("#map div[title=overlap]").fadeOut();
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });
        });
    });
    $("#news").fadeIn();
}

function jqueryLoad() {
    $('#why').innerfade({
        animationtype: 'slide',
        speed: 1000,
        timeout: 5000,
        type: 'random'
    });
}

function entercheck() {
    getEvent = event.keyCode;
    var str = $('.txtSearch').val();
    if (getEvent == "13") {
        window.location = 'Search.aspx?SearchText=' + escape(str);
    }
}

$(document).ready(function() {
    initialLoad();
    initMap();
    $('a.fancybox').fancybox({
        'zoomSpeedIn': 300,
        'zoomSpeedOut': 300,
        'overlayShow': true,
        'width': 400,
        'height': 335,
        'hideOnContentClick': false
    });
    $('div.report-features a.fancybox').fancybox({
        'zoomSpeedIn': 300,
        'zoomSpeedOut': 300,
        'overlayShow': true,
        'width': 400,
        'height': 510,
        'hideOnContentClick': false
    });

    $('div.sector').each(function() {
        var sectorName = $(this).attr('class').substr($(this).attr('class').indexOf('sector') + 7)
        $(this).css({ 'background-image': 'url(images/backgrounds/' + sectorName + '.png)' })
    });

    $('#news').innerfade({
        animationtype: 'fade',
        speed: 1000,
        timeout: 8000,
        type: 'random'
    });
    $('#why').innerfade({
        animationtype: 'slide',
        speed: 1000,
        timeout: 5000,
        type: 'random'
    });
});

function initMap() {
    $("body.home div#points a").fancybox({
        'width': 200,
        'height': 212,
        'speedIn': 600,
        'speedOut': 500,
        'padding': 3,
        'overlayShow': false,
        'hideOnContentClick': true,
        'scrolling': 'auto',
        'autoDimensions': false,
        'showCloseButton': true,
        'offsetX': -150,
        'offsetY': 89
        }).hover(function() {
        $(this).trigger('click');
    });
    $("body.analysis div#points a").fancybox({
        'width': 200,
        'height': 212,
        'speedIn': 600,
        'speedOut': 500,
        'padding': 3,
        'overlayShow': false,
        'hideOnContentClick': true,
        'scrolling': 'auto',
        'autoDimensions': false,
        'showCloseButton': true,
        'offsetX': 150,
        'offsetY': 89
        }).hover(function() {
        $(this).trigger('click');
    });
}