var officeMapLeft=0,officeMapTop=0
//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function hide()
{
    hide.div.style.display    = "none";
    window.clearTimeout(hide.t);
}
var _active_point = 0;
//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function OnPoint(obj,img)
{
	
	if(obj.sel != 1){ obj.src = img}
}
function OffPoint(obj,img)
{
	
	if(obj.sel != 1) obj.src = img
}

function ShowPointInfo(ind,len,imglen,imgon,imgoff)
{
	
	ShowParentDiv(ind);
	
	var obj = document.getElementById(_CTRL_PREFIX +"_MapPointImage_"+ind);
	if(obj && obj.sel == 1) return
    
	for(var i = 0; i < imglen; i++)
	{
		var obj = document.getElementById(_CTRL_PREFIX +"_MapPointImage_"+i);
		if(obj)
		{
			if(i==ind)
			{
				obj.src = imgon
				obj.sel = 1
			}
			else
			{
				obj.src = imgoff
				obj.sel = 0
			}
		}
	}
	

}

function ShowParentDiv(ind)
{
	
	
	var divCollection = window.document.getElementsByTagName("DIV");
	for(var i=0; i<divCollection.length; i++)
	{
	    if(divCollection[i].style.display=="block"){
		        _active_point = divCollection[i].getAttribute("MapPoint");
		        divCollection[i].style.display = 'none';
	    }
	    if(ind == divCollection[i].getAttribute("MapPoint"))
		{
			divCollection[i].style.display = 'block';
			document.documentElement.scrollTop = 300;
	
		}
    }
	
	
	
	_active_point = ind;
	
}

function setMapPosition(){
    
   	setBullets()
}
//---------------------------------------
function setBullets(){
		
		try{	
		    var bulletImage=new Image();
		    var _ImagesContainer = document.getElementById(ImagesContainer);
    		
		    for(var i=0;i<bulletArr.length;i++){
		        try{		   
		            var im=document.createElement("img")
			        var div=document.createElement("div")
        			
			        var corX=Number(bulletArr[i].left)
		   	        var corY=Number(bulletArr[i].top)
        						
			        im.src = bulletArr[i].imageoff
			        im.title = bulletArr[i].title
        						
        			
        			
			        im.setAttribute('imgon',bulletArr[i].imageon)
			        im.setAttribute('imgoff',bulletArr[i].imageoff)
			        im.setAttribute('index',i)
        			
			        im.setAttribute("class","bulletcss")
			        im.className = "bulletcss";
			        im.setAttribute("border", "0"); 
			        im.border=0;
			        
			        if(im.width==0)im.width = "20"; 
			        if(im.height==0)im.height = "18";
			        
			       if (navigator.userAgent.indexOf("Firefox")!=-1){
		                getLeftPos(im,Number(1*officeMapLeft+1*corX-1*im.width),true);
		            }else{
		                getLeftPos(im,Number(1*officeMapLeft+1*corX-1*im.width),true);
		               
		            } 
		          
			        getTopPos(im,officeMapTop+corY,true);
        			
        			
			        if(bulletArr[i].imageon!=""){
			           im.onmouseover = function(){this.src = this.getAttribute("imgon");}
			           im.onmouseout = function(){this.src= this.getAttribute("imgoff");}
			           im.onclick = function(){eval(bulletArr[this.getAttribute('index')].click)}
			        }
			        div.setAttribute("class","pointcss")
			        div.className = "pointcss";
        			
			        div.innerHTML = bulletArr[i].title;
			        getLeftPos(div,Number(1*officeMapLeft+1*corX-1*im.width-3),true);
			        getTopPos(div,officeMapTop+corY+1*im.height/2+3,true);
                    						
			        _ImagesContainer.appendChild(im)
			        _ImagesContainer.appendChild(div)
			    }catch(e){}
    			
		    }
		}catch(e){}
	}
/////////////////////////////////////////////////////////////////	
function getLeftPos(elmnt, pos,newelement)
{
    if (!newelement&&!(elmnt = getObjById(elmnt))) return 0;
    if (elmnt.style && (typeof(elmnt.style.left) == 'string')) {
        if (typeof(pos) == 'number') elmnt.style.left = pos + 'px';
        else {
	        pos = parseInt(elmnt.style.left);
	        if (isNaN(pos)) pos = 0;
        }
    }
    else if (elmnt.style && elmnt.style.pixelLeft) {
        if (typeof(pos) == 'number') elmnt.style.pixelLeft = pos;
        else pos = elmnt.style.pixelLeft;
    }
    return pos;
}
/////////////////////////////////////////////////////////////////	
function getTopPos(elmnt, pos,newelement)
{
    if (!newelement&&!(elmnt = getObjById(elmnt))) return 0;
    if (elmnt.style && (typeof(elmnt.style.top) == 'string')) {
        if (typeof(pos) == 'number') elmnt.style.top = pos + 'px';
        else {
	        pos = parseInt(elmnt.style.top);
	        if (isNaN(pos)) pos = 0;
        }
    }
    else if (elmnt.style && elmnt.style.pixelTop) {
        if (typeof(pos) == 'number') elmnt.style.pixelTop = pos;
        else pos = elmnt.style.pixelTop;
    }
    return pos;
}
/////////////////////////////////////////////////////////////////	

 function getObjById(element)
 {
    if (document.getElementById) element = document.getElementById(element);
    else if (document.all) element = document.all[element];
    else element = null;
    return element;
}

function backToTop()
{
    document.documentElement.scrollTop = 0;
}

