﻿// animation
$(function () {
    ///hide elements
    $('div.dShadow, div.nn1, div.nn2, div.nn3, div.nn4, div.nn5, div.nn6, div.nn7, div.nn8, div.popupPush').hide();

    if ($.browser.msie && $.browser.version < "8.0") {
    }
    else {
        $('div.conTR').fadeTo(0, 0.0);
        $('div.conTLnoBG').fadeTo(0, 0.0);
        $('div.conTL').fadeTo(0, 0.0);
        $('div.conBBL').fadeTo(0, 0.0);
        $('div.conBM').fadeTo(0, 0.0);
    }

    $('div.conBM, div.conTLnoBGnoC').wrap('<div class="inner" data-corner="bevel br 25px"></div>');
    //with cornner 
    $(' div.conTR, div.conTLnoBG, div.conTL').wrap('<div class="inner" data-corner="bevel br 25px"></div>');

    $('div.inner').wrap('<div class="outer" data-corner="bevel br 25px" style="padding: 1px"></div>');

    ///with NO cornner 
    
    //$('div.inner').wrap('<div class="outer" style="padding: 1px" data-corner="bevel br 25px"></div>');

    // fixed/fluid tests
    $("div.box, div.conBM, div.inner, div.outer, div.conBBL, div.conTR").corner();
    $("#abs").corner("cc:#08e");

    $('.myCorner').corner(
		);

    $('div.nn1').delay(1000).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    $('div.nn2').delay(1100).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    $('div.nn3').delay(1200).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    $('div.nn4').delay(1300).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    $('div.nn5').delay(1400).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    $('div.nn6').delay(1500).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    $('div.nn7').delay(1600).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    $('div.nn8').delay(1800).fadeIn(600, function () {
        $(this).css('filter', '');
    });

    //////////detect if no flash and triggers animation
    if (!FlashDetect.installed) {

        $('div.tlCoverSubP').delay(2000).fadeOut('slow', function () {
            $(this).remove();
        });

        $('div.trCoverSubP').delay(2100).fadeOut('slow', function () {
            $(this).remove();
        });

        $('div.btCoverSubP').delay(2200).fadeOut('slow', function () {
            $(this).remove();
        }); 	///next content blocks	


        if ($.browser.msie && $.browser.version < "8.0") {

        } else {
            $('div.conTLnoBG').delay(2300).fadeTo("slow", 1.0);
            $('div.conTL').delay(2400).fadeTo("slow", 1.0);
            $('div.conTR').delay(2500).fadeTo("slow", 1.0);
            $('div.conBBL').delay(2600).fadeTo("slow", 1.0);
        }

    }
});

function animationTrigger() {

    //fad ups taht are triggered by flash
    ////first bring up background boxes

    $('div.tlCoverSubP').delay(0400).fadeOut('slow', function () {
        $(this).remove();
    });

    $('div.trCoverSubP').delay(0700).fadeOut('slow', function () {
        $(this).remove();
    });

    $('div.btCoverSubP').delay(0900).fadeOut('slow', function () {
        $(this).remove();
    }); 	///next content blocks

    $('div.conTLnoBG').delay(1000).fadeTo("slow", 1.0);
    $('div.conTL').delay(1200).fadeTo("slow", 1.0);
    $('div.conTR').delay(1400).fadeTo("slow", 1.0);
    $('div.conBBL').delay(1400).fadeTo("slow", 1.0);
    $('div.conBM').delay(1400).fadeTo("slow", 1.0);

    $('div.conTLnoBG').delay(1400, function () {
        $(this).css('filter', '');
    });
}

//////stuff fro custom styled form elemnts
$(document).ready(function () {

    $('#location').selectbox2();
    $('#communities').selectbox2();
    $('#range1').selectbox2();
    $('#range2').selectbox2();
});
function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

$(function () {
    $('.bubbleInfoHW').each(function () {
        var distance = 0;
        var time = 250;
        var hideDelay = 0;
        var hideDelayTimer = null;
        var beingShown = false;
        var shown = false;
        var trigger = $('.triggerHW', this);
        var info = $('.popupHW', this).css('opacity', 0);

        $([trigger.get(0), info.get(0)]).mouseover(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            if (beingShown || shown) {
                // don't trigger the animation again
                return;
            } else {
                // reset position of info box
                beingShown = true;

                info.css({
                    top: -6,
                    left: 0,
                    display: 'block'
                }).animate({
                    top: '-=' + distance + 'px',
                    opacity: 1
                }, time, 'swing', function () {
                    beingShown = false;
                    shown = true;
                });
            }

            return false;
        }).mouseout(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            hideDelayTimer = setTimeout(function () {
                hideDelayTimer = null;
                info.animate({
                    top: '-=' + distance + 'px',
                    opacity: 0
                }, time, 'swing', function () {
                    shown = false;
                    info.css('display', 'none');
                });

            }, hideDelay);

            return false;
        });
    });
});

$(document).ready(function () {
    $('#submit').hover(
            function () { // Change the input image's source when we "roll on"
                $(this).attr({ src: 'images/submit_btn_on.jpg' });
            },
            function () { // Change the input image's source back to the default on "roll off"
                $(this).attr({ src: 'images/submit_btn_off.jpg' });
            }
        );
});

function goPopup() {
    document.getElementById("frameID").src = "map_e.html";
    loadPopup();
    centerPopup();
}
/////makes rollovers
$(function () {
    $('img[data-hover]').hover(function () {
        $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
    }).each(function () {
        $('<img />').attr('src', $(this).attr('data-hover'));
    }); ;
});

//-->
