var posx = 0;
var posy= 0;
document.onmousedown = MousePosition;
function MousePosition (Ev) {
 if (!Ev)
  Ev = window.event;
  posx =  Ev.clientX;
  posy =  Ev.clientY;
}

function cm_bwcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera 
  this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera   
  this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
  this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
  this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6)
	this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)
  this.ie = (this.ie4 || this.ie5 || this.ie6)
	this.mac=(this.agent.indexOf("mac")>-1)
	this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ns4=(!this.dom && document.layers)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)
  this.usedom= this.ns6//Use dom creation
  this.reuse = this.ie||this.usedom //Reuse layers
  this.px=this.dom&&!this.op5?"px":""  
	return this
	
}
var bw=new cm_bwcheck()


function getXMLObject(url)
{ 
 	var http_request = null;	
	if (window.XMLHttpRequest) 	{
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}			
	} else if (window.ActiveXObject) {
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}		
	} else {
		return http_request;
	}	
	return http_request;		
}

function Xml2XslTransform(objNaviXMLDoc,strXSLFile)
{
	try
	{
		if(bw.ie)	{							 
			var xsl = new ActiveXObject("Microsoft.XMLDOM");		
			xsl.async = false;
			xsl.load(strXSLFile);						  
			output = objNaviXMLDoc.transformNode(xsl);
		}
		else{				
			var processor = new XSLTProcessor();
			xslt = document.implementation.createDocument("", "", null);
			xslt.async = false;
			xslt.load(strXSLFile);		
			
			processor.importStylesheet(xslt);
			result = processor.transformToDocument(objNaviXMLDoc);
			xmls = new XMLSerializer();
			output = xmls.serializeToString(result);
		}		
		return output;
	}
	catch(e)
	{	  
		return e.description;
	}
  
}
function number_format( number, laenge, sep, th_sep ) 
{
	number = Math.round( number * Math.pow(10, laenge) ) / Math.pow(10, laenge);
	str_number = number+"";
	arr_int = str_number.split(".");
	if(!arr_int[0]) arr_int[0] = "0";
	if(!arr_int[1]) arr_int[1] = "";
	if(arr_int[1].length < laenge){
		nachkomma = arr_int[1];
		for(i=arr_int[1].length+1; i <= laenge; i++){  nachkomma += "0";  }
		arr_int[1] = nachkomma;
	}
	if(th_sep != "" && arr_int[0].length > 3){
		Begriff = arr_int[0];
		arr_int[0] = "";
		for(j = 3; j < Begriff.length ; j+=3){
			Extrakt = Begriff.slice(Begriff.length - j, Begriff.length - j + 3);
			arr_int[0] = th_sep + Extrakt +  arr_int[0] + "";
		}
		str_first = Begriff.substr(0, (Begriff.length % 3 == 0)?3:(Begriff.length % 3));
		arr_int[0] = str_first + arr_int[0];
	}
	return arr_int[0]+sep+arr_int[1];
}
/*
function comma2point(n)
{
  n=ReplaceAll(n,".","");
	return n.replace(",",".");
}
*/
function convertFromLocaleString(value)
{      
  var charThSign = "";
  var charDecimal = "";
  var intDecimalAt = -1;
  var strNumerals = "0123456789";
  for(var i= value.length - 1 ;i>-1;i--)
  {  
    if (strNumerals.indexOf(value.charAt(i)) == -1)
    {
			if(charDecimal=="")
			{
				charDecimal = value.charAt(i);				
			}
			else				
			  charThSign = value.charAt(i)
    }      
  }
  
  if(charThSign!="")
		value = ReplaceAll(value,charThSign,"")  
  
  if(charDecimal!=".")
		value.replace(charDecimal,".")

	return value;
		
}
function newWindow(theURL,winName,features)
{
	winName = window.open(theURL,winName,features);
	if(winName == null || winName.closed){window.open(theURL,winName,features);}  
	else{winName.location.href = theURL;}  
	if (!winName.closed) 
	winName.focus();
}

function moveWindowRight(width){
	window.onerror = moveWindow_erHandler;
	var wi;
	if(!parent.opener.parent.inhalt!=true){
		if(navigator.appName=='Netscape')wi=parent.opener.parent.innerWidth
		else wi=parent.opener.parent.document.body.offsetWidth;
		if(parseInt(navigator.appVersion) >= 4){self.moveTo(wi - width - 10,100);}
	}
}

function moveWindow_erHandler(){
}

function winOpen(theURL,winName,features) {   
	window.onerror = winOpen_errHandler;
	newWindow(theURL,winName,features)
}
function winOpen_errHandler(){
	newWindow(theURL,winName,features)
}
function checkMail(email)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) return true;
	else return false;
}