﻿/*  
Theme Name: 北天満サイエンスカフェ
Description: 北天満サイエンスカフェ
site URL: http://kitatenma-cafe.com
js - rollover, bookmark
Version: 1.0
Date: 2010.1.17
Auther: asakaho luis ryuta
*/



/*�　　rollover　　*/

function initRollOvers() {
	if (!document.getElementById){
		return;
	}
	
	var preLoads = new Array();
	var allImages = document.getElementsByTagName('img');

	for (var i = 0; i < allImages.length; i++) {		
		if (allImages[i].className == 'rollover') {
			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'));
			}
		}
	}
}

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;
	}
}
addOnload(initRollOvers);





/* 　ブックマーク　 */

function bookmarkYahoo(){
window.open('http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t='+encodeURIComponent(document.title)+'&u='+encodeURIComponent(window.location.href)+'&opener=bm&ei=UTF-8','popup','width=550px,height=480px,status=1,location=0,resizable=1,scrollbars=0,left=100,top=50',0);
}
function bookmarkDel(){
url='http://kitatenma-cafe.com';
title='北天満サイエンスカフェ';
newWin=window.open();
newWin.location.href='http://del.icio.us/post?url='+encodeURIComponent(url)+'&title='+encodeURIComponent(title);
}
function bookmarkFC2(){
location.href='http://bookmark.fc2.com/user/post?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);
}
function bookmarkNewsing(){
window.location='http://newsing.jp/nbutton?title='+encodeURIComponent('北天満サイエンスカフェ')+'&url='+encodeURIComponent('http://kitatenma-cafe.com');
}

function bookmark(){
document.write('<ol> \n');
document.write('<!-- Yahoo --> \n');
document.write('<li><a href="javascript:bookmarkYahoo()"><img src="http://i.yimg.jp/images/sicons/ybm16.gif" width="16" height="16" alt="" /></a></li> \n');
document.write('<!-- google --> \n');
document.write('<li><a href="http://www.google.com/bookmarks/mark?op=edit&bkmk=http://kitatenma-cafe.com&title=北天満サイエンスカフェ" target="_blank"><img alt="" src="http://www.google.co.jp/favicon.ico" border="0" width="16" height="16" /></a></li> \n');
document.write('<!-- はてな --> \n');
document.write('<li><a href="http://b.hatena.ne.jp/append?http://kitatenma-cafe.com" target="_blank"><img src="http://b.hatena.ne.jp/images/append.gif" alt="" width="16" height="12" border="0" /></a></li> \n');
document.write('<!-- del.icio.us --> \n');
document.write('<li><a href="javascript:bookmarkDel()"><img src="http://del.icio.us/static/img/delicious.small.gif" width="16" height="16" alt="" /></a></li> \n');
document.write('<!-- ニフティクリップ --> \n');
document.write('<li><a href="http://clip.nifty.com/create?url=http://kitatenma-cafe.com&title=北天満サイエンスカフェ" rel="nofollow"><img src="http://clip.nifty.com/images/addclip_icn.gif" alt="" width="12" height="12" border="0" /></a></li> \n');
document.write('<!-- Livedoorクリップ --> \n');
document.write('<li><a href="http://clip.livedoor.com/clip/add?link=window.self.location.href&title=document.title&jump=myclip" target="_blank"><img src="http://parts.blog.livedoor.jp/img/cmn/clip_16_16_b.gif" width="16" height="16" alt="" /></a></li> \n');
document.write('<!-- Buzzurl --> \n');
document.write('<li><a href="http://buzzurl.jp/entry/http://kitatenma-cafe.com" target="_blank"><img src="http://buzzurl.jp/static/image/api/icon/add_icon_mini_08.gif" alt="" style="border:0"></a></li> \n');
document.write('</ol> \n');
}





/* 　画像ランダム変更　 */

wall = new Array();
wall[0] = "img/header/001.jpg";
wall[1] = "img/header/002.jpg";
wall[2] = "img/header/003.jpg";
wall[3] = "img/header/004.jpg";
wall[4] = "img/header/005.jpg";
wall[5] = "img/header/006.jpg";
wall[6] = "img/header/007.jpg";
wall[7] = "img/header/008.jpg";
rnd = Math.round(Math.random() * (wall.length - 1));
document.write('');


