function dg(id){return document.getElementById(id);}
function dc(tag){return document.createElement(tag);}
function m24Info(){}

m24Info.iframeId = 'm24InfoFrame';
m24Info.m24InfoMainTableId = 'm24InfoMainTable';
m24Info.m24GlobalStyles = '';
m24Info.m24GlobalContent = '';
m24Info.m24GlobalContentTemplate = '';

m24Info.appendIFrame = function(){
	document.getElementsByTagName('body')[0].appendChild(m24Info.createIFrame());
	frames[m24Info.iframeId].document.open('text/html');
	frames[m24Info.iframeId].document.writeln('<html><head><title>NN4D - </title></head><body>');
	frames[m24Info.iframeId].document.writeln('');
	frames[m24Info.iframeId].document.writeln('</body></html>');
	frames[m24Info.iframeId].document.close();
}

m24Info.setGlobalStyles = function(styleContent){
	m24Info.m24GlobalStyles = styleContent;
}

m24Info.setGlobalContentTemplate = function(contentTemplate){
	m24Info.m24GlobalContentTemplate = contentTemplate;
}


m24Info.createIFrame = function(){
	var iframe = dc('iframe');
	iframe.id = m24Info.iframeId;
	iframe.name = m24Info.iframeId;
	iframe.scrolling = 'no';
	iframe.frameBorder = 0;
	iframe.marginwidth = '0';
	iframe.marginheight = '0';
	iframe.allowTransparency = 'true';
	iframe.style.background = 'none transparent';
	iframe.style.padding = '0px';
	iframe.style.position = 'absolute';
	iframe.style.top = '0px';
	iframe.style.left = '0px';
	iframe.style.textAlign = 'center';
	iframe.style.verticalAlign = 'middle';
	iframe.style.zIndex = '-1';
	iframe.style.display = 'none';
	iframe.onmouseover = 'm24Info.showInfo(event)';
	return iframe;
}

m24Info.fillIFrame = function(){
	var scriptContent = '';
		scriptContent += 'var dg = function(id){return document.getElementById(id);}';
		frames[m24Info.iframeId].document.open('text/html');
		frames[m24Info.iframeId].document.writeln('<html style="background:none transparent;"><head><title>NN4D - </title><script language="Javascript">'+scriptContent+'</script><style type="text/css">'+m24Info.m24GlobalStyles+'</style></head><body style="margin:0px; padding:0px; background:none transparent;">');
		frames[m24Info.iframeId].document.writeln('<table id="'+m24Info.m24InfoMainTableId+'" style="border-collapse:collapse; border:0px none red; background:none transparent; width:200px;"><tbody style="background:none transparent;"><tr><td>');
		frames[m24Info.iframeId].document.writeln(m24Info.m24GlobalContent);
		frames[m24Info.iframeId].document.writeln('</td></tr></tbody></table>');
		frames[m24Info.iframeId].document.writeln('</body></html>');
		frames[m24Info.iframeId].document.close();
		
		dg(m24Info.iframeId).style.display = 'block';
		var m24InfoMainTableHeight = getObjectHeight(frames[m24Info.iframeId].dg(m24Info.m24InfoMainTableId));
		//var m24InfoMainTableWidth = getObjectWidth(frames[m24Info.iframeId].dg(m24Info.m24InfoMainTableId));
		var m24InfoMainTableWidth = 850;
		setHeight(m24Info.iframeId, m24InfoMainTableHeight);
		setWidth(m24Info.iframeId, m24InfoMainTableWidth);
}

m24Info.delIFrameContent = function(){
	var scriptContent = '';
		scriptContent += 'var dg = function(id){return document.getElementById(id);}';
		frames[m24Info.iframeId].document.open('text/html');
		frames[m24Info.iframeId].document.writeln('<html style="background:none transparent;"><head><title>NN4D - </title><script language="Javascript">'+scriptContent+'</script><style type="text/css">'+m24Info.m24GlobalStyles+'</style></head><body style="margin:0px; padding:0px; background:none transparent;">');
		frames[m24Info.iframeId].document.writeln('<table id="'+m24Info.m24InfoMainTableId+'" style="border-collapse:collapse; border:0px none red; background:none transparent; width:200px;"><tbody style="background:none transparent;"><tr><td>');
		frames[m24Info.iframeId].document.writeln('');
		frames[m24Info.iframeId].document.writeln('</td></tr></tbody></table>');
		frames[m24Info.iframeId].document.writeln('</body></html>');
		frames[m24Info.iframeId].document.close();

		var m24InfoMainTableHeight = getObjectHeight(frames[m24Info.iframeId].dg(m24Info.m24InfoMainTableId));
		//var m24InfoMainTableWidth = getObjectWidth(frames[m24Info.iframeId].dg(m24Info.m24InfoMainTableId));
		var m24InfoMainTableWidthvar = 850;
		setHeight(m24Info.iframeId, m24InfoMainTableHeight);
		setWidth(m24Info.iframeId, m24InfoMainTableWidth);
}


m24Info.showInfo = function(evt, content){
	if(!(dg(m24Info.iframeId))){
		m24Info.appendIFrame();
	}
	//if(typeof content == 'string' && content != ''){
		
	//}
	
	m24Info.m24GlobalContent = m24Info.m24GlobalContentTemplate.replace('%content%', content);
	
	var coordsHash = m24Event.getMouseXY(evt);
	coordsHash.X = coordsHash.X +10;
	coordsHash.Y = coordsHash.Y -20;

	//dg(m24Info.iframeId).style.left = coordsHash.X + 'px';
	dg(m24Info.iframeId).style.left = '50px';
	dg(m24Info.iframeId).style.top = (coordsHash.Y+35) + 'px';
	
	dg(m24Info.iframeId).style.zIndex = 100;
	dg(m24Info.iframeId).style.display = 'block';
	
	setTimeout("m24Info.fillIFrame('"+content+"')", 100);

	
return true;		
	var infoTable = m24DOM.getNewTable(null, 'map24InfoLayer');
		infoTable.style.width = '100%';
		var Row = m24DOM.getNewTableRow(null);
		var Cell = m24DOM.getNewTableCell(gIMGTag('button_info_std.gif', 7, 12, 'common', null, null), 'infoLayerIButton');
		Cell.style.paddingRight = '5px';
		Row.appendChild(Cell);
		var Cell = m24DOM.getNewTableCell(gT(resId), null);
		Row.appendChild(Cell);
	infoTable.appendChild(Row);
}

m24Info.hideInfo = function(){
	if(dg(m24Info.iframeId)){
		dg(m24Info.iframeId).style.zIndex = '-1';
		//dg(m24Info.iframeId).style.top = '0px';
		//dg(m24Info.iframeId).style.left = '0px';
		dg(m24Info.iframeId).style.display = 'none';
		m24Info.delIFrameContent();
	}
}

getObjectWidth = function(obj)  {
    var elem = obj;
    var result = 0;
    if (elem.offsetWidth) {
        result = elem.offsetWidth;
    } else if (elem.clip && elem.clip.width) {
        result = elem.clip.width;
    } else if (elem.style && elem.style.pixelWidth) {
        result = elem.style.pixelWidth;
    }
    return parseInt(result);
}
getObjectHeight = function(obj)  {
    var elem = obj;
    var result = 0;
    if (elem.offsetHeight) {
        result = elem.offsetHeight;
    } else if (elem.clip && elem.clip.height) {
        result = elem.clip.height;
    } else if (elem.style && elem.style.pixelHeight) {
        result = elem.style.pixelHeight;
    }
    return parseInt(result);
}
setHeight = function(id, height) {
	if(typeof height != 'number'){height = 0;}
	if(dg(id)){
		dg(id).style.height = height+'px';
	}
}
setWidth = function(id, width) {
	if(typeof width != 'number'){width = 0;}
	if(dg(id)){
		dg(id).style.width = width+'px';
	}
}

m24Event = function (){}

m24Event.getMouseXY = function(evt) {
	e = evt || window.event;
	if(!e) return null;
	
	var coordsHash = {};
	
	if(document.layers) {
		coordsHash.X = e.pageX;
		coordsHash.Y = e.pageY
	}else if(window.opera){
		coordsHash.X = e.clientX;
		coordsHash.Y = e.clientY;
	}else if(document.all) {
		coordsHash.X = e.clientX + document.getElementsByTagName('body')[0].scrollLeft;
		coordsHash.Y = e.clientY + document.getElementsByTagName('body')[0].scrollTop;
	}else if(document.getElementById) {
		coordsHash.X = e.pageX;
		coordsHash.Y =  e.pageY;
	}
	return coordsHash;
}
