function setVisibility(id, visibility) {
  document.getElementById(id).style.display = visibility;
}

var main = {
	flag_login: 0,
	init: function(){
		$(".user-login-button").click(function(){
			if ( main.flag_login == 0 ) {
				$(".user-login").fadeIn(700);
				main.flag_login = 1;
			} else {
				$(".user-login").fadeOut(700);
				main.flag_login = 0;
			}
		});
		main.home_news_slider();
	},
	stick_tab: function(){
		window_width = $(window).width();
		window_height = $(window).height();
		content_height = $(".wrapper").height();
                if(window_width>960){
                    calculate = (window_width-960) / 2;
                } else {
                    calculate = 0; 
                }
		
	if (window.navigator.userAgent.indexOf('MSIE 7') != -1) {
		/*$("#bg_index").css({'margin-top':-content_height-116});
		$("#bg_searchpractices").css({'margin-top':-content_height-116});
		$("#bg_approach").css({'margin-top':-content_height-116});
		$("#bg_team").css({'margin-top':-content_height-116});
		$("#bg_clients").css({'margin-top':-content_height-116});
		$("#bg_contactus").css({'margin-top':-content_height-116});
		$("#bg_aboutus").css({'margin-top':-content_height-116});
		$("#bg_news").css({'margin-top':-content_height-116});
		$("#bg_library").css({'margin-top':-content_height-116});
		$("#bg_search").css({'margin-top':-content_height-116});
		$("#bg_").css({'margin-top':-content_height-116});*/
		$("#navigation").css({'margin-left':calculate});
		$(".tab-line-repeat").css({'width':calculate+10});
		$(".tab-line-repeat-main").css({'width':calculate+10});
	} else {
		$(".tab-line-repeat").css({'width':calculate});
		$(".tab-line-repeat-main").css({'width':calculate});
	}
	if (window.navigator.userAgent.indexOf('MSIE 8') != -1) {/*
		$("#bg_index").css({'margin-top':-content_height-116});
		$("#bg_searchpractices").css({'margin-top':-content_height-116});
		$("#bg_approach").css({'margin-top':-content_height-116});
		$("#bg_team").css({'margin-top':-content_height-116});
		$("#bg_clients").css({'margin-top':-content_height-116});
		$("#bg_contactus").css({'margin-top':-content_height-116});
		$("#bg_aboutus").css({'margin-top':-content_height-116});
		$("#bg_news").css({'margin-top':-content_height-116});
		$("#bg_library").css({'margin-top':-content_height-116});
		$("#bg_search").css({'margin-top':-content_height-116});
		$("#bg_").css({'margin-top':-content_height-116});*/
		$("#navigation").css({'margin-left':calculate});
		$(".tab-line-repeat").css({'width':calculate+10});
		$(".tab-line-repeat-main").css({'width':calculate+10});         
                //$("#bg_index, #bg_searchpractices, #bg_searchpractices, #bg_approach, #bg_team, #bg_clients, #bg_contactus, #bg_aboutus, #bg_news, #bg_library, #bg_search, #bg_").css({'background-position-y':'0px'});
	}	
	},

	home_news_slider: function(){
		var itemsCount = $(".news-container> div").size();
		
		$(".news-container").width(itemsCount * 233);
		
		var count = 1;
		$(".forward").click(function(event) {
			if(count < itemsCount) {
				$(".news-container").animate({
					left:"-="+233+"px"},
					600);
				count++;
			}
		});
		$(".back").click(function(event) {
			if(count > 1) {
				$(".news-container").animate({
					left:"+="+233+"px"},
					600);
				count--;
			}
		});	
	}
}


function closeContactWindow() {
	$('.nyroModalBg, .nyroModalCont, .nyroModalClose').hide();location.href = 'http://dev.lancor.com/download.php?file=/whitepapers/Lancor_WP_PortOps_2011.pdf';
}


$(document).ready(function(){



	main.init();

	var lines = function(){
		main.stick_tab();

	}
	setTimeout(lines, 200);
	
});

$(window).bind("resize", resizeWindow);
function resizeWindow( e ) {
	main.stick_tab();

}
