/* -----------------------------------------------------------
	Site Name: ホームページ制作 Magnetic Labo
	Version: 0.0.5
	Last Up： 07/05/14
	Author: Akiko Tanaka
	Comment: rollover image設定
----------------------------------------------------------- */

//class rollover image
Event.observe(window, 'load', RN_setMouseOverImages, false);

RN_overImgClassName = 'roll';
RN_overImgPostfix = '_on';

function RN_setMouseOverImages() {
	var btns = $A(document.getElementsByClassName(RN_overImgClassName));
	btns.each(function (node){
		node.imgsrc_up = node.src;
		node.imgsrc_over = node.src.replace('.gif', RN_overImgPostfix+'.gif').replace('.jpg', RN_overImgPostfix+'.jpg');
		node.onmouseover = function() { this.src = this.imgsrc_over; };
		node.onmouseout = function() { this.src = this.imgsrc_up; };
	});
}

/*------------------------------------------------------------*/
//id flash replace
Event.observe(window, 'load', RN_flashReplase, false);

RN_flashAry = $A();

/* -- sample --
RN_setFlash({
	id : 'flash',
	data : 'flash.swf',
	width : '754',
	height : '356',
	param : {
		flashvars : ''
	}
});
*/

function RN_setFlash(obj) {
	RN_flashAry.push(obj);
}

function RN_flashReplase(){
	RN_flashAry.each(function(fobj){
		var a = $H(fobj);
		var e = $(a.id);
		if(e!=undefined){
			var p = $H(a.param);
			var alt = e.innerHTML;
			var html = '<object data="'+a.data+'" type="application/x-shockwave-flash" width="'+a.width+'" height="'+a.height+'">';
			html += '<param name="movie" value="'+a.data+'" />';
			p.each(function(pobj){
				html += '<param name="'+pobj.key+'" value="'+pobj.value+'" />';
			});
			html += alt;
			html += '</object>';
			Element.update(e, html);
		}
	});
}

/*------------------------------------------------------------*/
//striped table
Event.observe(window, 'load', RN_stripedTable, false);

RN_stripedTableClassName = "stripedtable";
RN_stripedTableOddlineClassName = "oddline";
RN_stripedTableEvenlineClassName = "evanline";

function RN_stripedTable(){
	var tables = $A(document.getElementsByClassName(RN_stripedTableClassName));
	tables.each(function (table){
		var lines = $A(table.getElementsByTagName("tr"));
		var row=0;
		lines.each(function (tr){
			row++;
			if(row%2==1) {
				tr.className = RN_stripedTableOddlineClassName;
			} else {
				tr.className = RN_stripedTableEvenlineClassName;
			}
		});
	});
}

/*------------------------------------------------------------*/
if(navigator.appVersion.indexOf("Win",0) != -1){
	document.write('<style type="text/css">body { letter-spacing: +1px; }</style>');
}