/*
	Panasonic Global
	JS FILE [setKeyimg.js]
	This file contains the definition of "image rotation".
 */

function setImg(){
	this.w3c = document.getElementById; if (!this.w3c) return false;
	return this;
}


setImg.prototype = {
	
	init : function(){
		SI.gndiv = document.getElementById("chimg"); if(!SI.gndiv) return false;
		SI.setChImg();
	},

	setChImg : function(){
		nd = document.createElement('img');
		rnum = SI.getRandomNum(SI.img.length);
		SI.setAttr(nd, "src" , SI.img[rnum]);
		SI.setAttr(nd, "width" , SI.w);
		SI.setAttr(nd, "height" , SI.h);
		SI.gndiv.replaceChild(nd,SI.gndiv.firstChild);
	},
	
	getRandomNum : function(num){
			return Math.floor((num) * Math.random());
	},
	
	setAttr : function (node, attr, value){
		node.setAttribute(attr, value);
	}

}



var SI = new setImg();//SI : Set Image Function.
window.addOnload(SI.init);




