function openCenterWin(url,theWidth,theHeight){
	var theTop=(screen.height/2)-(theHeight/2);
	var theLeft=(screen.width/2)-(theWidth/2);
	var features='height='+theHeight+',width='+theWidth+',top='+theTop+',left='+theLeft+",scrollbars=no";
	theWin=window.open(url,'',features);
}

/**
 * @param object currentNode 
 * @param string classToplevel
 */
function getToplevelNode(currentNode, classToplevel) {
	while(currentNode) {
	   if(currentNode.parentNode) {
		currentNode = currentNode.parentNode;
		if(currentNode.className == classToplevel ) {
		   	break;
		}
	   } else {
			break;
	   }
	}
	return currentNode;		
}

function showHideFCE_rightBlock(objImage, direct) {
	var objToExpand = new Array();
	var divclasses = {
		none : "scMap",
		expand: "expand",
		collapsed: 'collapsed'
	}
	var linkclasses = {
		none : "scMapLink"
	}
	var images = {
		none :  "/fileadmin/topcon_design/scMapLink.gif",
		closed : "/fileadmin/topcon_design/scMapClose.gif",
		opened : "/fileadmin/topcon_design/scMapOpen.gif"
	};		
	var imgClassName = 'scMapInline';
	var elements = (direct) ? objImage.getElementsByTagName('DIV') : getToplevelNode(objImage, 'scShell').getElementsByTagName('DIV');

	for ( i = 0, iCount = elements.length; i < iCount; i++ ) {			

	//	alert(elements[i].className);		
		/* Push element which needed to be expanded */
		if(elements[i].className == divclasses['collapsed']) {
			objToExpand.push(elements[i]);
		}
		if(elements[i].className != 'scMapBot') {
			elements[i].className = divclasses['none'];
			elements[i].innerHTML = '<img>' + elements[i].innerHTML;
			childsCount = elements[i].getElementsByTagName('DIV').length;
			imgs = elements[i].getElementsByTagName('img');
		}		
		
		for( j = 0, jCount = imgs.length; j < jCount ; j++) {
			
			links = imgs[j].parentNode.getElementsByTagName('A');
			for ( l = 0, lCount = links.length; l<lCount; l++ ) {
				links[l].className = linkclasses['none'];
			}
			
//			imgs[j].src = (childsCount == 0) ? images['none'] : images['closed'];				
			if(childsCount != 0) {
				imgs[j].src = images['closed'];			
			} else {
//			imgs[j].parentNode.style="padding-left:15px";
				imgs[j].parentNode.style.paddingLeft = '15px';
				imgs[j].width='0';				
				imgs[j].height='0';
			}
			imgs[j].className = imgClassName;					

			
			if(childsCount == 0) {
				
				imgs[j].onclick = function() { return false; };
			} else {
				imgs[j].onclick = function() {
					this.src = (this.src.toString().indexOf(images['closed']) == -1) ? images['closed'] : images['opened'];
					nodes = this.parentNode.getElementsByTagName('DIV');											
					for(k = 0, kCount = nodes.length;  k < kCount; k++ ) {
						nodes[k].style.display = (nodes[k].style.display == 'none') ? '' : 'none';
					}
				};
			}				
			
			/* Collapse structures which are not marked as expanded */
			for(m = 0, mCount = objToExpand.length; m<mCount; m++) {
				if(imgs[j].parentNode == objToExpand[m]) {
					imgs[j].onclick();
				} 				
			}
		}
	}		
}

function showHideFCE_t1(childElement) {	
	var classes = {
		'open' : 'showHideInline',
		'close' : 'showHideNone',
		'container' : 'showHideNoneContentContainer',
		'toplevel' : 'showHideContainer'
	};
	
	var divs = new Array();		
	elements = getToplevelNode(childElement, classes['toplevel']).getElementsByTagName('DIV');	
	
	for (i = 0, iCount = elements.length; i<iCount; i++) {
		for( j in classes) {
			if(elements[i].className.toString() == classes[j].toString()) {
				divs[j] = elements[i];
			}
		}
	}
	
	noneState = (divs['container'].style.display == 'none') || (!divs['container'].style.display);	
	
	for (j in divs) {		
		divs[j].style.display = ((j.toString() == 'open') ? !noneState : noneState )? 'block' : 'none';
	}
}


/*********************************************************************************************************/
// JavaScript Document
/*********************************************************************************************************/

var activeTab;
var activeTabArea;

function setActiveTabIDS(tabID,divID)
{
	activeTab = tabID;
	activeTabArea = divID;
}
function changeTabDivs(tabID,divID)
{
	activateTab(activeTab,activeTabArea,false);
	activateTab(tabID,divID,true);
	setActiveTabIDS(tabID,divID);
}
function activateTab(tabID,divID,state)
{
	var tempObj;
	if(document.getElementById)
	{
		if(tabID)
		{
			
			tempObj =  document.getElementById(tabID);
			if(state)
			{
				tempObj.className = 'tabActiveTab';
			}
			else
			{
				tempObj.className = '';
			}
			
		}
		if(divID)
		{
			tempObj =  document.getElementById(divID);
			if(state)
			{
				tempObj.className = 'tabShowDiv';
			}
			else
			{
				tempObj.className = 'tabHideDiv';
			}
		}
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function ToggleDiv()
{
		division = document.getElementById('displaymore');
		division2 = document.getElementById('displayless');
		state = division.style.display;
		//state2 = division.style.display;
		if (state == "none")
		{
			division.style.display = "inline";
			division2.style.display = "none";
		}
		else
		{
			division.style.display = "none";
			division2.style.display = "none";
		}
}

function check_selection(arg, form)
{
	if (arg.options[arg.selectedIndex].disabled == false)
	{
		form.submit();
	}
}

function showElementSection(id)
{
	section = document.getElementById(id);
	state = section.style.display;
	
	if (state == "none" || state == "")
	{
		section.style.display = "inline";
	}
	else
	{
		section.style.display = "none";
	}
}

/*
	function showHideElement(id)
	{
		var contentDiv = document.getElementById(id);
		
		if (contentDiv.className == 'showHideContent')
		{
			contentDiv.className = 'showHideNone';
		}
		else
		{
			contentDiv.className = 'showHideContent';
		}
	}
	
	function showHideElementInline(id)
	{
		var contentDiv = document.getElementById(id);
		
		if (contentDiv.className == 'showHideInline')
		{
			contentDiv.className = 'showHideNone';
		}
		else
		{
			contentDiv.className = 'showHideInline';
		}
	}
	
	function showHideElementAction(id)
	{
		showHideElement('element' + id);
		showHideElementInline('Close' + id);
		showHideElementInline('Open' + id);
	}
*/