var isIE = false;
var isOther = false;
var isNS4 = false;
var isNS6 = false;
if(document.getElementById)
{
	if(!document.all)
	{
		isNS6=true;
	}
	else
	{
		isIE=true;
	}
}
else
{
	if(document.layers)
	{
		isNS4=true;
	}
	else 
	{
		isOther=true;
	}
}

function getOpenerWndCtrl(objID)
{
	var returnObj;
	if(isIE)
	{
		returnObj = eval("opener.document.all." + objID);
	}
	if(isNS6)
	{
		returnObj = eval("opener.document.getElementById('" + objID+ "')");
	}
	if(isNS4)
	{
		returnObj = eval("opener.document." + objID);
	}
	if(isOther)
	{
		returnObj = "null";
		alert("ERROR\n\nDue to your browser you will probably not\nbe able to view all of the following page.");
	}
	return returnObj;
}

function setCalcValue() 
{
	var fieldVol = getOpenerWndCtrl("idVolume");
	var fieldVolResult = this.document.getElementById("idVolResult");
	fieldVol.value = fieldVolResult.innerHTML;
	this.window.close();
	return true;
}

function NewWindow(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random")
	{
		LeftPosition = (screen.width) ? Math.floor(Math.random()*(screen.width-w)) : 100;
		TopPosition = (screen.height) ? Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	
	if(pos=="center")
	{
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null)
	{
		LeftPosition=0;
		TopPosition=20
	}
	
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win = window.open(mypage,myname,settings);
}

function showCalc()
{
	NewWindow( url_base+'formular/vcalc.php', '', '400', '700', 1, 'center');
}

function showCalc_En()
{
	NewWindow( url_base+'formular/vcalc_en.php', '', '400', '700', 1, 'center');
}

