﻿//<![CDATA[

// Attach events on document ready
$(function() {

    $.mask.options = {
        attr: 'mask', // an attr to look for the mask name or the mask itself
        mask: null, // the mask to be used on the input
        type: 'fixed', // the mask of this mask
        defaultValue: '+0', // the default value for this input
        onInvalid: function() { }, // called when receive wrong input
        onValid: function() { }, // called when receive correct input
        onOverflow: function() { } // called when the input should receive more input
    };

    $('input:text[mask]').setMask();

    // Attach the "show/hide" function to all elements with ".hjalp" class
    $('a.lnkCalcHelp').tooltip({
        track: true,
        delay: 0,
        showURL: false,
        showBody: "- ",
        fade: 250
    });
    
    /*
    $("a.lnkCalcHelp").mouseover(function() {
        var hjalp = $("div:last-child div", $(this).parent().parent());
        hjalp.fadeIn("slow");
        var position = hjalp.position();
        hjalp.css("left", $(this).position().left + 40);
        hjalp.css("top", position.top);

    }).mouseout(function() {
        $("div:last-child div", $(this).parent().parent()).fadeOut(500);
    });
    */

    $('input:text').focus(function() { $(this).select(); });

    $('input:text').numeric({ allow: ".," });

    $("div.reiknivel select.clsTegundLans").change(function() {
        if ($(this).val() > 1) {
            $("div.reiknivel .clsVerdbolguSpa").hide();
        }
        else {
            $("div.reiknivel .clsVerdbolguSpa").show();
        }
    });
});

//]]> 
