$(function () {
    $("a[rel='_blank']").attr("target", "_blank");
});

$(function () {
    $("a.current").each(function () {
        $(this).attr("title", "");
    });
});

$(function () {
    $("input, select, textarea").each(function () {
        if(!$(this).attr('name'))
            $(this).attr("name", $(this).attr("id"));
    });
});

$('a.scrollTop').click(function () {
    $('html, body').animate({
        scrollTop: 0
    }, 'slow');
    return false
});

function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).outerHeight();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

jQuery.fn.urlParam = function (name) {
    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
    if (results) {
        return results[1] || 0;
    }
};

jQuery.fn.delay = function (time, func) {
    this.each(function () {
        setTimeout(func, time);
    });
    return this;
};

jQuery.fn.fadeToggle = function (speed, easing, callback) {
    return this.animate({
        opacity: 'toggle'
    }, speed, easing, callback);
};

(function ($) {
    $.fn.fadeInPlus = function (speed, callback) {
        $(this).fadeIn(speed, function () {
            if (jQuery.browser.msie) $(this).get(0).style.removeAttribute('filter');
            if (callback != undefined) callback();
        });
    };
    $.fn.fadeOutPlus = function (speed, callback) {
        $(this).fadeOut(speed, function () {
            if (jQuery.browser.msie) $(this).get(0).style.removeAttribute('filter');
            if (callback != undefined) callback();
        });
    };
})(jQuery);

function in_array(thaArray, element) {
    var res = false;
    for (var e = 0; e < thaArray.length; e++) {
        if (thaArray[e] == element) {
            res = true;
            break;
        }
    }
    return res;
}
