

function initJsBox(){

	var box = document.createElement('div');
	$(box).attr('id', 'jsbox-container');

	var inner = document.createElement('div');
	$(inner).attr('id', 'js_fill_box');
	
	box.appendChild(inner);

	document.body.appendChild(box);

	var ancs = $('a');
	for (var c = 0; c < ancs.length ; c++){
		
		if ($(ancs[c]).attr('title')){
			$(ancs[c]).attr('rel',$(ancs[c]).attr('title'));

			if($(ancs[c]).attr('class') != "imgpop"){
				$(ancs[c]).attr('title','');
			}
			
			ancs[c].onmouseover = function(e){
				Locate(e);
				document.onmousemove = Locate;
				if($(this).attr('rel').length > 15){
					showBox($(this).attr('rel'));	
				}else{
					showBox($(this).attr('rel'),1);
				}
			}
			ancs[c].onmouseout = function(e){
				document.onmousemove = null ;
				hideBox();	
			}	
		}	
	}

}
var jsbox_out=1;
function showBox(cont,shrink){
jsbox_out=0;
if(shrink == null){
	shrink = 0;
}
box = document.getElementById('jsbox-container');
innerbox = document.getElementById("js_fill_box");
innerbox.innerHTML = cont;
box.style.visibility = 'visible';
$('#jsbox-container').hide();

if (shrink){
	innerbox.style.display = 'inline';
	var w = $('#js_fill_box').width();
	$(box).css('max-width' , w+"px");
	$(box).css('width' , w+"px");
	$(box).css('height' , $('#js_fill_box').height()+"px");
}else{
	innerbox.style.display = 'block';
	$(box).css('max-width' , 100000)+"px";
}
box.style.display = 'block';
$('#jsbox-container').hide();
setTimeout(function(){
if (innerbox.innerHTML == cont){
$('#jsbox-container').fadeIn(500,function(){if(jsbox_out==1)$('#jsbox-container').hide()});

}
},500)

}

function hideBox(){
jsbox_out=1;
$('#jsbox-container').fadeOut(100);
$('#jsbox-container').hide();
}

function Locate(e){
var posx=0,posy=0;
if(e==null) e=window.event;
if(e.pageX || e.pageY){
posx=e.pageX; posy=e.pageY;
}
else if(e.clientX || e.clientY){
if(document.documentElement.scrollTop){
posx=e.clientX+document.documentElement.scrollLeft;
posy=e.clientY+document.documentElement.scrollTop;
}
else{
posx=e.clientX+document.body.scrollLeft;
posy=e.clientY+document.body.scrollTop;
}
}
document.getElementById('jsbox-container').style.top=(posy+10)+"px";
document.getElementById('jsbox-container').style.left=(posx)+"px";
}
