﻿$(document).ready(function () {
    if ($('.slides').length) {
        $('.slides').before('<div class="pager-container"><div class="pager">').cycle({
            fx: 'fade',
            timeout: 8000,
            pager: '.pager',
            pagerAnchorBuilder: function (idx, slide) {
                return '<a href="#">'+(idx+1)+'</a>';
            }
        });
    }
});

$.fn.clearDefault = function () {
    return this.each(function () {
        var default_value = $(this).val();
        $(this).focus(function () {
            if ($(this).val() == default_value) $(this).val("");
        });
        $(this).blur(function () {
            if ($(this).val() == "") $(this).val(default_value);
        });
    });
};

$.fn.outerHTML = function (s) {
    return (s)
			? this.before(s).remove()
			: $('<p>').append(this.eq(0).clone()).html();
};
