$().ready(function(){
PEPS.rollover.init();
$('a').click(function(){ $(this).blur();});

//supersized random loading///////////////////////
/*
var rand = Math.floor( Math.random() * 3);
$('#main'+rand).addClass('activeslide').show();
*/


//中身のないタグの場合非表示 ////////////////////////////////////////
$('.read1, .read2, .read3, .read4, .pic1, .pic2').each(function(){
$nullcheck = $(this).html();
if( $nullcheck == ''){
$(this).hide();
}
});

//supersized center ////////////////////////////////////////
$WinWid = $(window).width();
$WinHigh = $(window).height();
$BgWid = $('#supersize img:first').width();
if($WinWid < $BgWid){
$negativeMag = -($BgWid - $WinWid)/2;
$('#supersize img').css('margin-left',$negativeMag)
}
$(window).resize(function(){
$WinWid = $(window).width();
$BgWid = $('#supersize img:first').width();
if($WinWid < $BgWid){
$negativeMag = -($BgWid - $WinWid)/2;
$('#supersize img').css('margin-left',$negativeMag)
}
if($WinWid >= $BgWid){
$('#supersize img').css('margin-left','0')
}
});


$('.dtlFunk').toggle(
function () {
$(this).prev().slideDown(function(){
	if(jQuery.browser.msie){
	fuckIeH = $('#contentWrap').height();
	fuckIeW = $('#contentWrap').width();
	$('#scrollFix').height(fuckIeH).width(fuckIeW);
	}
	if(jQuery.browser.msie && jQuery.browser.version==6){$('.dtlFunk').hide().show();}
	});
$(this).children('a').text('[-] 詳細を隠す');
},
function () {
$(this).prev().slideUp(function(){
	if(jQuery.browser.msie){
	fuckIeH = $('#contentWrap').height();
	fuckIeW = $('#contentWrap').width(); 
	$('#scrollFix').height(fuckIeH).width(fuckIeW);
	}
	if(jQuery.browser.msie && jQuery.browser.version==6){$('.dtlFunk').hide().show();}
	});
$(this).children('a').text('[+] 詳細を表示');
});




//IE scrollfix/////////////////////////
fuckIeH = $('#contentWrap').height();
fuckIeW = $('#contentWrap').width(); 
$('#scrollFix').height(fuckIeH).width(fuckIeW);
$(window).resize(function(){
fuckIeH = $('#contentWrap').height();
fuckIeW = $('#contentWrap').width(); 
$('#scrollFix').height(fuckIeH).width(fuckIeW);
});
//

if($WinHigh < fuckIeH ){
$('.pWrap').css('display','block');
}


$('#onAir a').click(function(){
$(this).attr('href','javascript:void(0);');
window.open('/takemeout/', 'mywindow6', 'width=640, height=600, menubar=no, toolbar=no, scrollbars=yes'); return false;
});


$('#license a').click(function(){
$(this).attr('href','javascript:void(0);');
window.open('/license/', 'mywindow6', 'width=640, height=600, menubar=no, toolbar=no, scrollbars=yes'); return false;
});


//End of doccument 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 ////////////////////////////////////////


$(window).load(function(){
setTimeout(function(){
$('#onAir').animate({ right: "10px" }, 500 );
},2000);
});

