//$(document).ready(function(){
//$(window).bind("load",function(){
$(function(){
	

$(window).resize(function(){
bodyWidthIE();
});
bodyWidthIE();
	
$('#menu li').each(function(){
	var tgturi = $('a', this).attr("href").split('/');
	if(tgturi[tgturi.length-1] == $('body').attr('id')){
		$(this).addClass('current_page_item');
	}
});

$("#btn_pagetop").click(function(){
	pageScroll();
	return false;
});

if($("#concept").size()){
	$(".largebtn_list a").lightBox({
		  overlayBgColor:'#808080',
		  imageLoading: 'img/lightbox_loader.gif',
		  imageBtnPrev: 'img/lightbox_prev.png',
		  imageBtnNext: 'img/lightbox_next.png',
		  imageBtnClose: 'img/lightbox_close.png',
		  overlayOpacity: 0.5,
		  containerResizeSpeed: 200
	});
}


//////////////////////

if($("body#top").size()) {
	slideViewer();
	setInterval( "slideViewer()", 7500 );
}

//////////////////////

});

function pageScroll(o){
	if(!o) o=0;
	$.scrollTo(o,250);
}

function bodyWidthIE() {
	var ww = $('html').attr('clientWidth');
	//var ww = $(window).width();
	if ($.browser.msie){
		if($.browser.version < 7){
			$("#header").width(ww);
			$("#footer").width(ww);
		}
		if($.browser.version < 8){
			if(ww < 640+256+256){
				$("#container").css("padding-right",ww-640-256-16 + "px");
			}else{
				$("#container").css("padding-right", "256px");
			}
		}
	}
}

function slideViewer(n) {
	var $active = $('#slideshow IMG.active');
	if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
	
	var $next =  $active.next().length ? $active.next()
	: $('#slideshow IMG:first');
	
	$active.addClass('last-active');
	
	$next.css({opacity: 0.0})
	.addClass('active')
	.animate({opacity: 1.0}, 2500, function() {
	$active.removeClass('active last-active');
	});
}

