function init(){
	if(window.addEventListener) {
		window.addEventListener("load", setting, false);
	}else if(window.attachEvent) {
		window.attachEvent("onload", setting);
	}
	//
}
function setting(){
	var doc = document
	var body =  doc.getElementsByTagName("body")[0];
	var imger = doc.createElement('img');
	var boxer = doc.createElement('div');
	var boxh3 = doc.createElement('h3');
	var boxp = doc.createElement('p');
	var boxb = doc.createElement('p');
	boxer.appendChild(imger);
	boxer.appendChild(boxh3);
	boxer.appendChild(boxp);
	boxer.appendChild(boxb);
	imger.setAttribute('src','img/bg_arrow.gif');
	imger.setAttribute('height','10');
	imger.setAttribute('width','9');
	imger.setAttribute('class','arrow');
	imger.setAttribute('className','arrow');
	boxb.setAttribute('class','bottom');
	boxb.setAttribute('className','bottom');
	boxer.setAttribute('class','boxer');
	boxer.setAttribute('className','boxer');
	body.appendChild(boxer);
	//
	boxer.style.position = "absolute";
	//imger.style.position = "relative";
	boxer.style.top = "-1000px";
	boxer.style.display = "block";
	//
	if(document.getElementsByTagName) {
		var a_array = document.getElementsByTagName("a");
	}
	//
	for(var i=0; i < a_array.length; i++) {
		if(a_array[i].getAttribute("href").match('".jpg" || ".gif"')){
			var tr = a_array[i];
			if(tr.getElementsByTagName("img")){
				var sm = tr.getElementsByTagName("img")[0];
			}
			if(tr.getElementsByTagName("em")){
				var lc = tr.getElementsByTagName("em")[0];
			}
			if(!sm || !lc){
				continue;
			}
			//
			tr.linker = a_array[i].href;
			tr.alt = lc.firstChild.nodeValue || sm.alt || null;
			tr.height = sm.clientHeight;
			tr.width = sm.clientWidth;
			tr.onmouseover = function(){
				//alert(this.ot);
				if(!this.alt) return false;
				this.ot = this.offsetTop;
				this.ol = this.offsetLeft;
				var pa = this
				while(pa = pa.offsetParent){
					this.ot += pa.offsetTop;
					this.ol += pa.offsetLeft;
				}
				boxp.innerHTML = this.alt;
				boxer.style.display = "block";
				boxer.style.top = (this.ot+this.height-20)+"px";

				var left = this.ol - (boxer.clientWidth/2) + (this.width/2);
				if(left + 200 > body.clientWidth){
					boxer.style.left = (left - ((left + 200) - body.clientWidth))+"px";
					imger.style.left =  (((left + 200) - body.clientWidth))+"px"
				}else if(left < 0){
					boxer.style.left = (5)+"px";
					imger.style.left = (left -5)+"px";
				}else{
					boxer.style.left = (left)+"px";
					imger.style.left = (0)+"px"
				}
			}
			tr.onmouseout = function(){
				boxp.innerHTML = "";
				boxer.style.top = "-1000px";
			}
			//a_array[i].href = "javascript:void(0)";
		}
	}
	//
}
//
init();
