/**
 * @author denspbru
 */
$(function() {

    $.fn.booking_wizard = function(options) {
        var defaults = {
            url: '',
            showHeader: true,
            width: '',
            height: '',
            style: '',
            skin: ''
        };
        var opts = $.extend({}, defaults, options);

        function drawFrame(oThis) {
            var frame = document.createElement("iframe");
            $(frame).attr("frameborder","0").attr("scrolling","no");
            
            // Собираем Url
            var strUrl = opts.url

            if (jQuery.trim(opts.skin) != "")
                strUrl += "&skin=" + opts.skin;
            
            if (!opts.showHeader)
                strUrl += "&showHead=0";

            if (opts.style != "")
                strUrl += "&style=" + opts.style;
            
            frame.src = strUrl;

            if (jQuery.trim(opts.width) != "")
                $(frame).width(opts.width);

            if (jQuery.trim(opts.height) != "")
                $(frame).height(opts.height);

            $(frame).css("overflow-y", "auto");

            $(oThis).append(frame);
        }

        return this.each(function() {
            var oThis = this;

            drawFrame(oThis);


        });
    };
});

