$(document).ready(function(){
var str = $("body").attr("id");

if (str == 'home'){
$('.top_img p.catch').css('display','block').css('opacity',0).animate({opacity:1},1000).delay(1000).animate({opacity:0},1000)
$('.top_img p.img').css('display','block').css('opacity',0).delay(1500).animate({opacity:1},1500);
$('.top_img p.img2').css('display','block').css('opacity',0).delay(3000).animate({opacity:1},1000);
setTimeout( "$('.top_img p.link').css('display','block').css('opacity',0).animate({opacity:1},1000);",2000);
$('.top_img p.link')
	.mouseover(function(){
	var onSrc = $('.top_img p.img2 img').attr('src').replace('.jpg', '_o.jpg');
    $('.top_img p.img2 img').attr('src', onSrc);
	}).mouseout(function(){
    var offSrc = $('.top_img p.img2 img').attr('src').replace('_o.jpg', '.jpg');
    $('.top_img p.img2 img').attr('src', offSrc);
	});
$('a.popup').openwin({option:{width:768,height:620,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
$('a img.campain').mouseover(function(){$(this).animate({opacity:0.8}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
};

if (str == 'news'){
$('.news .left .backNo h3').click(function(){
$(".news .left .backNo dl").toggle("slow");
});
//$(".news .main .pickupList li:nth-child(6n)").css("clear","both");
$('.news .left .backNo h3').mouseover(function(){$(this).css('color','#CC0004');}).mouseout(function(){$(this).css('color','#333');});

};

if (str == 'technology'){
$('.detail .item a img').mouseover(function(){$(this).animate({opacity: 0.7},'fast');}).mouseout(function(){$(this).animate({opacity: 1.0},'fast');});
};

if (str == 'athletes'){
$('.detail .image a img').mouseover(function(){$(this).animate({opacity: 0.6},'fast');}).mouseout(function(){$(this).animate({opacity: 1.0},'fast');});
};

if (str !== 'video'){
$('.left .leftMenu a,p.pageTop a').click(function(){$(this).scrollTo(1000);return false;});
};

/* 全体 */

$('a.catlogPopup').openwin({option:{width	:1024,height:650,scrollbars:"yes"},target:"catalog",focus:true});
$('.blank').click(function(){window.open(this.href, '_blank');return false;});
$('a.pdfPopup').openwin({option:{width	:1024,height:650,scrollbars:"yes"},target:"pdf",focus:true});

/*  ================================================================================
Include
================================================================================  */
$("#header_inc").load("/common/inc/header.html");
$("#footer_inc").load("/common/inc/footer.html");

});

/* rollover */

$(document).ready(function(){
$('a img.rollover').mouseover(function(){$(this).animate({opacity: 0.7}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
});

var preLoadImg = new Object();
function initRollOvers(){
$("a img.imgover").each(function(){
var imgSrc = this.src;
var sep = imgSrc.lastIndexOf('.');
var onSrc = imgSrc.substr(0, sep) + '_o' + imgSrc.substr(sep, 4);
preLoadImg[imgSrc] = new Image();
preLoadImg[imgSrc].src = onSrc;
$(this).hover(
function() { this.src = onSrc; },
function() { this.src = imgSrc; }
);
});
}
$(function(){
initRollOvers();
});


jQuery.fn.extend({
  scrollTo : function(speed, easing) {
    if(!$(this)[0].hash || $(this)[0].hash == "#") {
      return false;
    }
    return this.each(function() {
      var targetOffset = $($(this)[0].hash).offset().top;
      $('html,body').animate({scrollTop: targetOffset}, speed, easing);
    });
  }
});

/*  ================================================================================
ポップアップ
================================================================================  */
(function($) {
$.fn.openwin = function(settings) {
settings = jQuery.extend({
option		: {
width		: false,
height		: false,
top			: false,
left		: false,
menubar		: "no",
toolbar		: "no",
location	: "no",
status		: "no",
resizable	: "no",
scrollbars	: "no",
directories	: "no",
titlebar	: "yes",
fullscreen	: "no"
},
target		: "_blank",
blur		: false,
focus		: false
}, settings);

this.click(function() {
var options = [];
if($(this).attr("rel")) {
var rel = $(this).attr("rel").split(",");
var reloption = {};
for(var i in rel) {
var a = rel[i].split("=");
reloption[a[0]] = a[1];
}
}
for(var k in settings.option) {
var v = settings.option[k];
if(reloption) {
if(reloption[k]) {
v = reloption[k];
}
}
if(v != false) {
options.push(k + "=" + v);
}
}
var target = settings.target;
if(reloption) {
if(reloption["target"]) {
target = reloption["target"];
}
}
var win = window.open($(this).attr("href"), target, options.join(","));
if(settings.blur == true) {
win.blur();
}
if(settings.focus == true) {
win.focus();
}
return false;
});
}
})(jQuery);





