$(function(){
PEPS.rollover.init();

//fullscreen ////////////////////////////////////////
if(jQuery.browser.msie){}
else {
window.moveTo(0,1);
window.resizeTo(screen.availWidth, screen.availHeight);
}


//supersized center ////////////////////////////////////////
$WinWid = $(window).width();
$BgWid = $('#supersize').width();
$WinHeight = $(window).height();
$BgHeight = $('#supersize').height();

$frameHeight = $WinHeight*0.65;
$('iframe').css('height',$frameHeight);
$(window).resize(function(){
$frameHeight = $WinHeight*0.65;
$('iframe').css('height',$frameHeight);
});

if($WinWid < $BgWid){
$negativeMag = -($BgWid - $WinWid)/2;
$('#supersize').css('margin-left',$negativeMag);
}

$(window).resize(function(){
$WinWid = $(window).width();
$BgWid = $('#supersize').width();
if($WinWid < $BgWid){
$negativeMag = -($BgWid - $WinWid)/2;
$('#supersize').css('margin-left',$negativeMag);
}
if($WinWid >= $BgWid){
$('#supersize').css('margin-left','0');
}
});

if($WinHeight < $BgHeight){
$negativeMagHeight = -($BgHeight - $WinHeight)/2;
$('#supersize').css('margin-top',$negativeMagHeight);
}

$(window).resize(function(){
$WinHeight = $(window).height();
$BgHeight = $('#supersize').height();
if($WinHeight < $BgHeight){
$negativeMagHeight = -($BgHeight - $WinHeight)/2;
$('#supersize').css('margin-top',$negativeMagHeight);
}
if($WinHeight >= $BgHeight){
$('#supersize').css('margin-top','0');
}
});

$boxWidth = $('.menuBox').width();
$boxHeight = $('.menuBox').height();
$boxLeft = ($WinWid - $boxWidth)/2+215;
$boxTop = ($WinHeight - $boxHeight)/2;
$('.menuBox').css({'top':$boxTop,'left':$boxLeft });
$(window).resize(function(){
$boxWidth = $('.menuBox').width();
$boxHeight = $('.menuBox').height();
$boxLeft = ($WinWid - $boxWidth)/2+215;
$boxTop = ($WinHeight - $boxHeight)/2;
$('.menuBox').css({'top':$boxTop,'left':$boxLeft });
});


//BG Fadein ////////////////////////////////////////


$('#navigation').fadeIn(3000);


//navigation ////////////////////////////////////////
$currentClass = 'top';
$('#navigation a').click(function(){	
$thisClass = $(this).attr('class');
if($currentClass != $thisClass){
	$('.menuBox').hide();
	$('#'+$thisClass).fadeIn(500);
	$currentClass = $(this).attr('class');
$('#globalNav li img').show();
}});
$('#globalNav a').click(function(){	
$('#globalNav li img').show();
$(this).children('img').hide();
});



$('#globalNav li a:even').click(function(){
$('.orangeBox').hide();
});
$('#globalNav li a:odd').click(function(){
$('.orangeBox').show();
});


$('a').click(function(){$(this).blur();});

//close BTN ////////////////////////////////////////
$('.closeBtn, #concept').click(function(){
$('#'+$currentClass).fadeOut(1000,function(){
});
});

$('.pageNavi a').click(function(){
$('.pageNavi a').removeClass('current');
$(this).addClass('current');
});

//end of document ready ////////////////////////////////////////
});


// Roll over ////////////////////////////////////////
PEPS = {};
PEPS.rollover =
{
	init: function()
	{
	this.preload();
	$(".over").hover(
	function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
	function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); });
	},
	preload: function()
	{$(window).bind('load', function() {$('.over').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });});},
	newimage: function( src )
	{return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_over' + src.match(/(\.[a-z]+)$/)[0];},
	oldimage: function( src )
	{return src.replace(/_over\./, '.');}
};
// Roll over end ////////////////////////////////////////