
document.domain = window.location.host;


var n='0';
if (navigator.appName=="Microsoft Internet Explorer")
	n='4';

// ######## GLOBALS ########
var Xoffset=-30;
var Yoffset= 20;
var popwidth=350;
var popYOffset=Yoffset;
var yyy=-1000;

var skin;
	
var iex=(document.all);
var nav=(document.layers);
var old=(navigator.appName=="Netscape" && !document.layers && !document.getElementById);
var n_6=(window.sidebar);

if(nav)document.captureEvents(Event.MOUSEMOVE);
if(n_6) document.addEventListener("mousemove",get_mouse,true);
if(nav||iex)document.onmousemove=get_mouse;


//mmLoadMenus();

// ######## END: GLOBALS ########


function pageLoad()
{
	Yoffset = 20;
	MM_preloadImages('/img/teb_logo.jpg', '/img/zaglavlje_en.jpg');
	popupPrepare();
}

function pageLoadIndex()
{
	Yoffset = 20;
	MM_preloadImages('/img/index_teb_logo.png', '/img/teb_the_power_behind_your_system.jpg');
	popupPrepare();
}

var adrProzor;
function adresa(adrURL)
{
	adrProzor = window.open(adrURL,null,"width=586 height=406");
}


var pathOpenImage,pathCloseImage;
function showHide(elementId)
{
	var obj = document.getElementById(elementId);
	if(obj!=null) {
		if(obj.style.display=='') obj.style.display='none';
		if (obj.style.display == 'none')
		{
			obj.style.display = 'block';
		}
		else
		{
			obj.style.display = 'none';
		}
	}
}
function openSelectedMenu(input) 
{
	var menu = ['aaa','aab','aabaaa','aabaab','aabaabaaa','aabaabaab','aabaabaac','aabaabaacaaa','aabaabaacaab','aabaabaacaac','aabaabaacaad','aabaabaacaad','aabaabaacaae','aabaabaacaaf','aac','aad','aae','aaf','aag','aah','aai','aaj','aak','aal'];
	var open = new String(input);
	var openMenu = new Array();
	n=open.length/3;
	for (i=1;i<=n;i++) {
		openMenu[i]= open.substring(0,i*3);
	}
	for (i = 1; i <= openMenu.length; i++) {
		if (document.getElementById(openMenu[i]))
		{
			document.getElementById(openMenu[i]).style.display='block';
		}
	}
}



function MM_preloadImages() //v3.0
{
	var d=document; if(d.images)
	{ 
		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0)
			{
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
	}
}




// SCRIPTS FROM TEMPLATE BODY
function popupPrepare()
{
	if(nav) skin = document.pup;
	if(iex) 
	{
		skin = pup.style;
	}
	if(n_6) skin = document.getElementById("pup").style;
}


var x,y;
function get_mouse(e)
{
	//var x,y;
	
	if(nav || n_6)
		x = e.pageX;
	if(iex)
		x = event.x+document.body.scrollLeft; 

	if(nav || n_6)
		y = e.pageY;
	if(iex)
	{
		y=event.y;
		if (navigator.appVersion.indexOf("MSIE 4") == -1)	// ako nije MSIE 4
		{
			// if IE 6 in standards compliant mode => document.documentElement.scrollTop
			if (document.documentElement && document.documentElement.scrollTop)
				y += document.documentElement.scrollTop;
			// else if IE 6 in non-standards compliant mode => document.body.scrollTop
			else if (document.body)
				y += document.body.scrollTop;
		}
	}
	
	if (skin != null)
	{
		if(iex || nav)
		{
			skin.top = y + yyy;
			skin.left = x + Xoffset;
			skin.width = popwidth;
		}
		if(n_6)
		{
			skin.top = (y + yyy) + "px";
			//skin.top = (y + Yoffset) + "px";
			skin.left = x + Xoffset + "px";
			skin.width = popwidth + "px";
		}
		
		nudge(x);
	}
}

function nudge(x)
{
	var extreme,overflow,temp;
	
	if(iex) 
		extreme=(document.body.clientWidth - popwidth - 10);
	if(n_6 || nav) 
		extreme=(window.innerWidth - popwidth - 10 );
	
	if(parseInt(skin.left) > extreme)
	{
		overflow = parseInt(skin.left) - extreme;
		temp = parseInt(skin.left);
		temp -= (overflow + 10);
		if(nav || iex)
			skin.left = temp;
		if(n_6)
			skin.left = temp + "px";
	}
	if(parseInt(skin.left) < 1)
	{
		overflow = parseInt(skin.left) - 1;
		temp = parseInt(skin.left);
		temp -= overflow;
		if(nav || iex)
			skin.left = temp;
		if(n_6)
			skin.left = temp + "px";
	}
}

function popup_index(msg)
{
	if (typeof msg=="number")
	{
		switch (msg)
		{
			case 1:
			popwidth=350;
			popYOffset = iex ? Yoffset + 100 : Yoffset;
			msg="In our concept of continued care for our users and integrity of our solutions, special emphasis is paid to user support with the goal of making our program solutions fully functional to the satisfaction of us, project engineers, and users of our solutions.<br>User support in all stages of development, implementation and production are the basic elements of confidence we inspire, as well as of mutual satisfaction of success.";
			break;
			
			case 2:
			popwidth=350;
			popYOffset = iex ? Yoffset + 100 : Yoffset;
			msg="We have been running a successful business with over 50 years of tradition and experience, which is exceptional even outside the borders of our country. Years of experience and expertise of our project engineers ensure reliability, coherence and functionality of our projects and solutions defined, realized and maintained with the use of the latest achievements in information technology.";
			break;
			
			case 3:
			popwidth=350;
			popYOffset = iex ? Yoffset + 100 : Yoffset;
			msg="Our references and experience refer to a range of program solutions, from classic business-financial, production-technological, integrated production-business systems, to solutions for the support to the decision-making process, especially in the field of road management.<br>It is important to emphasize that our long experience and references in the establishment of a modern, efficient, computer-supported system of road network management in the Republic of Croatia places us at the very top of project offices in our country.<br>We recognized the role and importance of GIS technology early on, not only in the field of manipulation and visualization of spatial planning, but also as an ideal tool for system integration and support to the decision-making system within integral information systems.<br>GIS as a mainstream, not as an autonomous system, is the cornerstone of our philosophy of GIS technology development and implementation.";
			break;
			
			case 4:
			popwidth=350;
			popYOffset = iex ? Yoffset + 100 : Yoffset;
			msg="Relying on our company's long tradition, as well as on new technologies, methods and principles, our project team develops all stages of computerization of turn-key business systems: analysis, design, development, implementation, client training, system maintenance.<br>We keep abreast of the latest developments in technology by constantly investing in knowledge, education of our employees, equipment, as well as by following the dynamic development of information technology. This enables us to meet all the demands of our users.<br>We rely on the very best of program equipment producers and, to mutual satisfaction, have the status of:<ul><li class=small> Oracle Certified Partner</li><li class=small> Microsoft Certified Partner </li><li class=small>Intergraph Principal Registered Solutions Provider</li></ul>";
			break;
			
			case 5:
			popwidth=350;
			popYOffset = iex ? Yoffset + 100 : Yoffset;
			msg="In keeping with our desire to prove worthy of the confidence of our clients by providing a complete service, continued education of both our designers and users presents a cornerstone of our success.<br>TEB Informatika training center is certified <em><font color=#DC0066>Intergraph Authorized Training Center</font></em>, unique in the whole region.";
			break;
			
			case 6:
			popwidth=120;
			popYOffset = Yoffset;
			msg="Sailing boats charter.";
			break;
			
			case 7:
			popwidth=55;
			popYOffset = Yoffset;
			msg="Intergraph";
			break;
		}
	}

	var content = msg;

	if(old)
	{
		alert(msg);
		return;
	}
	
	yyy=popYOffset;
	skin.width=popwidth;
	if(nav)
	{
		skin.document.open();
		skin.document.write(content);
		skin.document.close();
		skin.visibility="visible";
	}
	if(iex)
	{
		pup.innerHTML=content;
		skin.visibility="visible";
	}
	if(n_6)
	{
		document.getElementById("pup").innerHTML=content;
		skin.visibility="visible";
	}
	//alert("height: " + skin.height);
}


function popup(msg)
{
	if (typeof msg=="number")
  	{
		switch (msg)
		{
			case 1:
				popwidth=100;
				msg="Home Page";
				break;
			case 2:
				popwidth=165;
				msg="Application Overview";
				break;
			case 3:
				popwidth=50;
				msg="Enlarge";
				break;
			case 4:
				popwidth=170;
				msg="Microsoft Certified Professional";
				break;
			case 5:
				popwidth=220;
				msg="Intergraph Certified Developer (Desktop)";
				break;
			case 6:
				popwidth=240;
				msg="Oracle Forms Developer Certified Professional";
				break;
			case 7:
				popwidth=220;
				msg="Microsoft Certified Systems Administrator";
				break;
			case 8:
				popwidth=190;
				msg="Intergraph Certified Product Trainer";
				break;
			case 9:
				popwidth=200;
				msg="Intergraph Certified Solutions Trainer";
				break;
			case 10:
				popwidth=200;
				msg="Intergraph Certified Developer (Web)";
				break;
		}
	}

	var content = msg;
	if(old)
	{
		alert(msg);
		return;
	}

	yyy=Yoffset;
	if(iex || nav)
	{
		skin.top = y + yyy;
		skin.left = x + Xoffset;
	}
	if(n_6)
	{
		skin.top = (y + yyy) + "px";
		skin.left = x + Xoffset + "px";
	}    
	skin.width=popwidth;

	if(nav)
	{ 
		skin.document.open();
		skin.document.write(content);
		skin.document.close();
		skin.visibility="visible";
	}
	if(iex)
	{        
		pup.innerHTML=content;
		skin.visibility="visible";
	}  
	if(n_6)
	{
		document.getElementById("pup").innerHTML=content;
		skin.visibility="visible";
	}

}

function kill()
{
	if(!old)
	{
		yyy=-1000;
		skin.visibility="hidden";
		skin.width=0;
	}
}



function openInNewWindow(href)
{
	// Change "_blank" to something like "newWindow" to load all links in the same new window
	var newWindow = window.open(href, '_blank');
	newWindow.focus();
}




function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];		// array: left, top
}

// ########## MENUS SHOWING-HIDING
// global
var hideMenu = true;
var menuMouseOut = new Date();
var timeout = 1200;

function showMenu(elementIdName, senderName)
{
	hideActiveMenus();
	hideActiveSubMenus();
	keepShowingMenu();

	var obj = document.getElementById(elementIdName);
	if(obj!=null) {
		obj.style.display='block';
		obj.style.left = findPos(document.getElementById(senderName))[0] + 'px';
	}
}
function showSubMenu(elementIdName, senderName, subSenderName)
{
	hideActiveSubMenus();
	keepShowingMenu();
	
	var obj = document.getElementById(elementIdName);
	if(obj!=null) 
	{
		var shiftRight = (senderName == 'link4') ? 198 : 98;
		var posLeft = parseInt(findPos(document.getElementById(senderName))[0]) + shiftRight;
		var posTop = parseInt(findPos(document.getElementById(subSenderName))[1]) + 3;
		obj.style.display='block';
		obj.style.left = posLeft + 'px';
		obj.style.top = posTop + 'px';
	}
}
function keepShowingMenu()
{
	hideMenu = false;
	menuMouseOut.setTime(menuMouseOut.getTime() - timeout);
}

function startHideMenus()
{
	hideMenu = true;
	menuMouseOut = new Date();
	menuMouseOut.setTime(menuMouseOut.getTime() + timeout);
	hideActiveMenusTimer();
}


function hideActiveMenusTimer()
{
	if (!hideMenu)
		return;

	if(menuMouseOut > new Date() )	// while not timeout passed
	{
		window.setTimeout('hideActiveMenusTimer()', 100);				// reenter function (avoids blocking in function)
		return;
	}
	hideActiveSubMenus();
	hideActiveMenus();
}

function hideActiveMenus()
{
	document.getElementById('menuTehnologije').style.display = 'none';
	document.getElementById('menuONama').style.display = 'none';
	document.getElementById('menuProjektnaRjesenja').style.display = 'none';
	hideMenu = false;
}
function hideActiveSubMenus()
{
	document.getElementById('menuProgramskaRjesenjaPrikupljanje').style.display = 'none';
	document.getElementById('menuProgramskaRjesenjaGotova').style.display = 'none';
	document.getElementById('menuProgramskaRjesenjaKorisnicka').style.display = 'none';
	document.getElementById('menuProgramskaRjesenjaGIS').style.display = 'none';
	document.getElementById('menuProgramskaRjesenjaWeb').style.display = 'none';
	document.getElementById('menuIntergraph').style.display = 'none';
	hideMenu = false;
}
