function rand(min, max){
    if (max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
    else {
        return Math.floor(Math.random() * (min + 1));
    }
}

function getWindowHeight() {
    var windowHeight = 0;
    if (typeof(window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
};

function getWindowWidth() {
    var windowWidth = 0;
    if (typeof(window.innerWidth) == 'number') {
        windowWidth = window.innerWidth;
    }
    else {
        if (document.documentElement && document.documentElement.clientWidth) {
            windowWidth = document.documentElement.clientWidth;
        }
        else {
            if (document.body && document.body.clientWidth) {
                windowWidth = document.body.clientWidth;
            }
        }
    }
    return windowWidth;
};

function setSizes() {
	heightWin = getWindowHeight();
	widthWin = getWindowWidth();
	$('.b_content').css({'height': heightWin+'px'});
	$('.b_content_img').css({'height': (heightWin-50)+'px'});
	$('.b_content_img img').css({'height': heightWin+'px'});
	if (widthWin<1100) {
		$('.b_topmenu').css({'width':'1100px'});
		$('.b_copyright').css({'width':'1100px'});
	} else {
		$('.b_topmenu').css({'width':'100%'});
		$('.b_copyright').css({'width':'100%'});
	}
}

$(function(){
	setSizes();
    $(window).bind("resize",function() {
    	setSizes();
    });
});

lft=1;

$(window).load(function(){

	$('.b_started_link').bind('mouseover', function() {
		$('.b_started_link').everyTime(150, function() {
			lftp = lft-1;
			if (lftp<1) lftp=28;
			$('.b_started_photos'+lftp).css({'marginLeft':'700px'});
			$('.b_started_photos'+lft).css({'marginLeft':'0'});
			lft++;
			if (lft>28) lft=1;
		});
	});
	$('.b_started_link').bind('mouseout', function() {
		$('.b_started_link').stopTime();
		lftp = lft-1;
		if (lftp<1) lftp=28;
		$('.b_started_photos'+lftp).css({'marginLeft':'700px'});
	});

});

