$(document)
.ready(
	function() {
	    var bodyClass = '',
			body = $('body'),
			wrap = $('.wrap'),
			html = $('html');

	    if ($.browser.msie) {
	        bodyClass = 'is_ie';
	    }

	    bodyClass += parseInt($.browser.version, 10);

	    $('html').addClass(bodyClass);


	    if (body.hasClass('has_widthfix')) {
	        var bodyCol = $('#bodyCol');

	        var w = parseInt(wrap.width(), 10);
	        bodyCol.width(w - 155);

	        $(window)
			.resize(
				function() {
				    var w = parseInt(wrap.width(), 10);
				    bodyCol.width(w - 155);
				}
			);
	    }

	    if (html.hasClass('is_ie6')) {
	        var w = $(window).width(),
				h = $(window).height();

	        function ie6Resize(w, h) {
	            if (w < 991) {
	                wrap.css('width', 900);
	                body.css('width', 'auto');
	            }
	            else {
	                wrap.css('width', 'auto');
	                body.css('width', '100%');
	            }

	            if (h < 701) {
	                wrap.css('height', 700);
	                body.css('height', 'auto');
	            }
	            else {
	                wrap.css('height', '100%');
	                body.css('height', '100%');
	            }
	        }

	        ie6Resize(w, h);

	        $(window)
			.resize(
				function() {
				    w = $(window).width(), h = $(window).height();
				    ie6Resize(w, h);
				}
			);
	    }

		var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
		var ua = navigator.userAgent.toLowerCase(); 
		
		if(ua.indexOf('chrome')>-1 || ua.indexOf('safari')>-1){
			
			var h = parseInt($(window).height(), 10),
						w = parseInt($(window).width(), 10);
				    $('.wrap').height(h);

				    if (701 > h) {
				        $('.wrap').height(700);
				    }
				    else {
				        $('.wrap').height(h);
				    }
					
			setInterval(
				function() {
				    var h = parseInt($(window).height(), 10),
						w = parseInt($(window).width(), 10);
				    $('.wrap').height(h);

				    if (701 > h) {
				        $('.wrap').height(700);
				    }
				    else {
				        $('.wrap').height(h);
				    }
				},
				250
			);
		}
	    if ($('html').hasClass('is_ie8')) {
	        var siteinfo = $('#siteinfo');
	        var doauto = $('#navCol,#photos');
	        setInterval(
				function() {
				    var h = parseInt($(window).height(), 10),
						w = parseInt($(window).width(), 10);
				    $('.wrap').height(h);

				    if (701 > h) {
				        $('.wrap').height(700);
				        //doauto.css('height','auto');
				        //siteinfo.css({position:'relative',bottom:'auto'});
				    }
				    else {
				        $('.wrap').height(h);
				        //doauto.css('height','');
				        //siteinfo.css({position:'',bottom:''});
				    }
				},
				250
			);
	    }
	}
);
