/* **********************************************
   for onload
********************************************** */

function addOnload(func){
if ( typeof window.addEventListener != "undefined" ){
window.addEventListener( "load", func, false );
}else if ( typeof window.attachEvent != "undefined" ) {
window.attachEvent( "onload", func );
}else{
if ( window.onload != null ){
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
window[func]();
};
}else
window.onload = func;
}
}



/* **********************************************
   open window
********************************************** */

function openPopup(theURL,winName,features) {
  window.open(theURL,winName,features);
}



/* **********************************************
   close window
********************************************** */

function closeWin(){
    window.close();
}



/* **********************************************
   copyright year
********************************************** */

function copyrightYear() {
var copy_data = new Date();  
var copy_year = copy_data.getFullYear();  
document.write(copy_year);  
}



/* **********************************************
   target="_blank"
********************************************** */

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") && anchor.getAttribute("class") == "blank") anchor.target = "_blank";
if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "blank") anchor.target = "_blank";
}
}
addOnload(externalLinks);



/* **********************************************
   page scroll up
********************************************** */

var speed = 10;
var delayspeed  = 5;
var timerID;
var scry;

function scrollup(ysize)
{
 timerID = setInterval('scrolls()', speed);
 scry = ysize;
}

function scrolls()
{
 if(scry > 0)
 {
   scry = scry - Math.floor(scry / delayspeed ) -1;
   parent.scroll(1,scry);
 } else
 {
   clearInterval(timerID)
   parent.scroll(0,0);
 }
}



/* **********************************************
   roll over
********************************************** */

function initRollOvers() {
if (!document.getElementById){
return;
}
if (navigator.userAgent.indexOf("MSIE 6") != -1){
return;
}
var preLoads = new Array();
var allImages = document.getElementsByTagName('img');
for (var i = 0; i < allImages.length; i++) {
if (allImages[i].className == 'ro') {
var src = allImages[i].getAttribute('src');
var ftype = src.substring(src.lastIndexOf('.'), src.length);
var oSrc = src.replace(ftype, '_on'+ftype);
//-- スワップ元、スワップ先画像の登録
allImages[i].setAttribute('pSrc', src);
allImages[i].setAttribute('oSrc', oSrc);
//-- イメージのプリロード
preLoads[i] = new Image();
preLoads[i].src = oSrc;
//-- イベントの設定
allImages[i].onmouseover = function() {
this.setAttribute('src', this.getAttribute('oSrc'));
}
allImages[i].onmouseout = function() {
this.setAttribute('src', this.getAttribute('pSrc'));
}
}
}
}
addOnload(initRollOvers);





