/*
load js files. (last updated 06/12/20)
-----------------------------------------------
Win ie6.0,7.0 ns8.XX opera9 firefox Mac Safari
1. /common/js/products/prototype.js
2. /common/js/products/effects.js
3. /common/js/products/photoframe01.js

Other browser
/common/js/products/photoframe02.js

*/
var jsfile = new Array("/common/js/products/prototype.js","/common/js/products/effects.js","/common/js/products/photoframe01.js");
var jsfiles = {
	require: function(libraryName) {
		document.write("<script type=\"text/javascript\" src=\"" + siteUrlStatic + libraryName + "\"><\/script>");
	},
	bwcheck: function(){
		var 
			ua = navigator.userAgent.toLowerCase(),
			ve = navigator.appVersion.toLowerCase(),
			is = function(t){ return ua.indexOf(t) != -1; },
			val = ((/opera/i.test(ua))&&(/^[1-8]/i.test(ve))||
				(/msie 5/i.test(ve))||(/netscape[4-7\/]/i.test(ua))||
				is("mac")&&(/msie/i.test(ve)))? false : true;
		return val;
	},
	load: function(){
		for(var i=0,f=jsfile.length ; i<f ; i++){
			if(jsfiles.bwcheck()){
				jsfiles.require(jsfile[i]);
			}else{
				jsfiles.require("/common/js/products/photoframe02.js");
				return false;
			}
		}
	}
}
jsfiles.load();


/*	color scheme function
------------------------------------------- */
function setColorScheme(){
	return this;
}
setColorScheme.prototype = {
	init: function(){
		CS.mainid = document.getElementById("maincol");if(!CS.mainid) return false;
		CS.maindivs = CS.mainid.getElementsByTagName("div");if(!CS.maindivs) return false;
		for(var i=0,f=CS.maindivs.length; i < f ; i++){
			if(CS.getClsName(CS.maindivs[i]) == "navcol"){
				CS.imgs = CS.maindivs[i].getElementsByTagName("img");if(!CS.imgs) continue;
				for(var j=0,f=CS.imgs.length-1; j < f ; j++){
					color = CS.imgs[j].className;
					CS.imgs[j].style.backgroundColor = "#" + color;
					CS.imgs[j].style.border = "1px solid #" + color;
					if(color == "ffffff"){
						CS.imgs[j].style.border = "1px solid #ccc";
					}
				}
			}
		}
	},
	getClsName : function(d){
		return new String(d.getAttribute(CS.getClsAttr())).toLowerCase();
	},
	getClsAttr : function(){
		return (ie)? "className" : "class";
	}
}

var CS = new setColorScheme();
window.addOnload(CS.init);


/*	preload Image
------------------------------------------- */
loaded = false;
function ImgPre(){
	return this;
}
ImgPre.prototype = {
	init: function(){
		getElmByClsName = function(clsName){
			var elms = new Array();
			var re = new RegExp('(^| )' + clsName + '( |$)');
			var ael = document.getElementsByTagName('*');
			var op = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
			if (document.all && !op) ael = document.all;
			for(var i=0,j=0,f=ael.length ; i<f ; i++) {
				if(re.test(ael[i].className)) {
					elms[j]=ael[i];
					j++;
				}
			}
			return elms;
		};
		keyimgcol = getElmByClsName("keyimgnav2");if(!keyimgcol) return false;
		picturecol = document.getElementById("pictcol");if(!picturecol) return false;
		img = picturecol.getElementsByTagName("img");
		path = img[0].src.substring(0,img[0].src.lastIndexOf("/"));
		var elm = keyimgcol[0].innerHTML.match(/new PF\(.+\);r/ig);
		var imgs = new Array();
		for(var i=0,f=elm.length ; i<f ; i++){
			imgs[i] = new Image();
			imgs[i].src = elm[i].substring(8,elm[i].length-4);
		}
		loaded = true;
	}
}
var loadimg = new ImgPre();
window.addOnload(loadimg.init);