$(document).ready(function(){
	//Examples of how to assign the ColorBox event to elements
	$("a[rel=photo]").colorbox({maxWidth:'98%', maxHeight:'98%', transition:'elastic', title:false});
	$(".photos#content a:has(img)").colorbox({maxWidth:'98%', maxHeight:'98%', transition:'elastic', rel:'group1', title:false});
	$("a.reservation").colorbox({width:'450px', transition:'elastic'});
	$('.price .photo').colorbox({maxWidth:'98%', maxHeight:'98%', transition:'elastic', title:false, current: 'Фото {current} из {total}'});
	setTimeout("$('#top-banners>div').css('display', 'inline-block');", 100);
//    console.log($.browser);
	if ($.browser.safari) {
        console.log('is webkit!');
        $('#content').css('margin', '0 10px 0 0');
        $('.cars#content .model').css('height', '147px');
    }

    $('#support-close').click(function(){
    	$('#support').hide();
    	$.cookie('support-hide', 'true')
    	return false;
    });
    $('#support-open').click(function(){
    	window.open('support.html','support','toolbar=no,resizable=yes,status=no,menubar=no,location=no,width=600,height=500');
    	return false;
    });
    if ($.cookie('support-hide') != 'true')
	    $('#support').show();

//	$(".images-box a").attr('rel', 'photo').colorbox({maxWidth:'98%', maxHeight:'98%', transition:'elastic'});
//	$("a[target=_blank]").colorbox({width:'400px', transition:'elastic'});
//	if (window.location.href.substr(window.location.href.length-11, window.location.href.length) == '/color.html') {
//		jQuery('.text-block').append('<div id="colorPreviewBox"></div>');
//		var hide = '';
//		window.colorSelectImages = new Array;
//		jQuery('.text-block img').each(function(){
//			window.colorSelectImages.push(this.src);
//		});
//		jQuery('.text-block p').remove();
//		if (window.colorSelectImages.length) {
//			var previewName = window.colorSelectImages[0].replace(/(.*)_.*/, '$1')+'_colors.png';
//			jQuery('#colorPreviewBox')
//				.css('background-image', 'url('+window.colorSelectImages[0]+')')
//				.append('<div id="colorPreviewSelectBox" style="background: url('+previewName+') left top no-repeat"></div>');
//			var colorPreviewSelectBox = jQuery('#colorPreviewSelectBox').css('width', window.colorSelectImages.length*79);
//			for (i=0; i<window.colorSelectImages.length; i++) {
//				colorPreviewSelectBox.append('<a href="#img-'+i+'" style="background-image: url('+previewName+');">&nbsp;</a>');
//			}
//			colorPreviewSelectBox.find('a').bind('click  mouseenter', function() {
//				var index = parseInt(this.href.substring(this.href.length-1, this.href.length));
//				jQuery('#colorPreviewBox')
//					.css('background-image', 'url('+window.colorSelectImages[index]+')')
//				jQuery('#colorPreviewSelectBox a').css('background-position', '79px -66px')
//				jQuery(this).css('background-position', '-'+(index*79)+'px -66px')
//				return false;
//			});
//		}
//	}
});
