Popup = new Object();

Popup.init = function() {
    $('a.popup').each(function() {
       if (!$(this).hasClass('iframe')) {
           $(this).addClass('iframe');
           $(this).fancybox({
            transitionIn: 'none',
            transitionOut: 'none',
           	width: 800, height: 480, speedIn: 100, speedOut: 0,
           	overlayOpacity: 0.3, overlayColor: '#031c4d'});
       }
    });
}

Popup.close = function() {
    parent.$.fancybox.close();
}

Loading = new Object();

Loading.start = function() {
	$('body').append('<div id="loading"></div>');
}

$(document).ready(function(){
    $('a.imgbox, a.image-box').fancybox();
    
    $.datepicker.setDefaults($.datepicker.regional["ru"]);
    $("input.date-input").datepicker({
			dateFormat: "dd.mm.yy",
            changeMonth: true,
			changeYear: true
	}); 
	
    $('a.tip').each(function() {
        var a = $(this);
        var params = {
			position: {corner: {target: 'topRight',	tooltip: 'leftMiddle'}},
			style: {name: 'cream', color: '#333', width: {min: 0, max: 350}},
			show: {effect: {length: 0}},
			hide: {effect: { length: 0 }}
        }
        
        if (a.attr('rev'))
        	params['content'] = {
                text: '...',
                url: a.attr('rev'),
                type: "GET"
            };
        else
	        params['content'] = {text: a.children('span')};
        
        a.qtip(params);
    });

});

