/** GLOBAL VARIABLES **************************************************/
var _NL = "\n";
var _TAB = "\t";

/** COLOR ARRAY **/
var globalColorArray = {
	"activeborder":			"#d4d0c8",
	"activecaption":			"#c0c0c0",
	"activecaptiontext":			"#0e1010",
	"aliceblue":			"#f0f8ff",
	"antiquewhite":			"#faebd7",
	"appworkspace":			"#808080",
	"aqua":			"#00ffff",
	"aquamarine":			"#7fffd4",
	"azure":			"#f0ffff",
	"beige":			"#f5f5dc",
	"bisque":			"#ffe4c4",
	"black":			"#000000",
	"blanchedalmond":			"#ffebcd",
	"blue":			"#0000ff",
	"blueviolet":			"#8a2be2",
	"brown":			"#a52a2a",
	"burlywood":			"#deb887",
	"cadetblue":			"#5f9ea0",
	"chartreuse":			"#7fff00",
	"chocolate":			"#d2691e",
	/*"control":			"#e0dfe3",
	"controldark":			"#9d9da1",
	"controldarkdark":			"#716f64",
	"controllight":			"#f1efe2",
	"controllightlight":	"#ffffff",
	"controltext":			"#000000",*/
	"coral":			"#ff7f50",
	"cornflowerblue":	 "000000",
	"cornsilk":			"#fff8dc",
	"crimson":			"#dc143c",
	"cyan":			"#00ffff",
	"darkblue":			"#00008b",
	"darkcyan":			"#008b8b",
	"darkgoldenrod":			"#b8860b",
	"darkgray":			"#a9a9a9",
	"darkgreen":			"#006400",
	"darkkhaki":			"#bdb76b",
	"darkmagenta":			"#8b008b",
	"darkolivegreen":			"#556b2f",
	"darkorange":			"#ff8c00",
	"darkorchid":			"#9932cc",
	"darkred":			"#8b0000",
	"darksalmon":			"#e9967a",
	"darkseagreen":			"#8fbc8b",
	"darkslateblue":			"#483d8b",
	"darkslategray":			"#2f4f4f",
	"darkturquoise":			"#00ced1",
	"darkviolet":			"#9400d3",
	"deeppink":			"#ff1493",
	"deepskyblue":			"#00bfff",
	"desktop":			"#dcdce2",
	"dimgray":			"#696969",
	"dodgerblue":			"#1e90ff",
	"firebrick":			"#b22222",
	"floralwhite":			"#fffaf0",
	"forestgreen":			"#228b22",
	"fuchsia":			"#ff00ff",
	"gainsboro":			"#dcdcdc",
	"ghostwhite":			"#f8f8ff",
	"gold":			"#ffd700",
	"goldenrod":			"#daa520",
	"gray":			"#808080",
	"graytext":			"#aca899",
	"green":			"#008000",
	"greenyellow":			"#adff2f",
	"highlight":			"#b2b4bf",
	"highlighttext":			"#000000",
	"honeydew":			"#f0fff0",
	"hotpink":			"#ff69b4",
	"hottrack":			"#648bcb",
	"inactiveborder":			"#d4d0c8",
	"inactivecaption":			"#ffffff",
	"inactivecaptiontext":			"#a2a1a1",
	"indianred":			"#cd5c5c",
	"indigo":			"#4b0082",
	"info":			"#ffffe1",
	"infotext":			"#000000",
	"ivory":			"#fffff0",
	"khaki":			"#f0e68c",
	"lavender":			"#e6e6fa",
	"lavenderblush":			"#fff0f5",
	"lawngreen":			"#7cfc00",
	"lemonchiffon":			"#fffacd",
	"lightblue":			"#add8e6",
	"lightcoral":			"#f08080",
	"lightcyan":			"#e0ffff",
	"lightgoldenrodyellow":			"#fafad2",
	"lightgray":			"#d3d3d3",
	"lightgreen":			"#90ee90",
	"lightpink":			"#ffb6c1",
	"lightsalmon":			"#ffa07a",
	"lightseagreen":			"#20b2aa",
	"lightskyblue":			"#87cefa",
	"lightslategray":			"#778899",
	"lightsteelblue":			"#b0c4de",
	"lightyellow":			"#ffffe0",
	"lime":			"#00ff00",
	"limegreen":			"#32cd32",
	"linen":			"#faf0e6",
	"magenta":			"#ff00ff",
	"maroon":			"#800000",
	"mediumaquamarine":			"#66cdaa",
	"mediumblue":			"#0000cd",
	"mediumorchid":			"#ba55d3",
	"mediumpurple":			"#9370db",
	"mediumseagreen":			"#3cb371",
	"mediumslateblue":			"#7b68ee",
	"mediumspringgreen":			"#00fa9a",
	"mediumturquoise":			"#48d1cc",
	"mediumvioletred":			"#c71585",
	"menu":			"#ffffff",
	"menutext":			"#000000",
	"midnightblue":			"#191970",
	"mintcream":			"#f5fffa",
	"mistyrose":			"#ffe4e1",
	"moccasin":			"#ffe4b5",
	"navajowhite":			"#ffdead",
	"navy":			"#000080",
	"oldlace":			"#fdf5e6",
	"olive":			"#808000",
	"olivedrab":			"#6b8e23",
	"orange":			"#ffa500",
	"orangered":			"#ff4500",
	"orchid":			"#da70d6",
	"palegoldenrod":			"#eee8aa",
	"palegreen":			"#98fb98",
	"paleturquoise":			"#afeeee",
	"palevioletred":			"#db7093",
	"papayawhip":			"#ffefd5",
	"peachpuff":			"#ffdab9",
	"peru":			"#cd853f",
	"pink":			"#ffc0cb",
	"plum":			"#dda0dd",
	"powderblue":			"#b0e0e6",
	"purple":			"#800080",
	"red":			"#ff0000",
	"rosybrown":			"#bc8f8f",
	"royalblue":			"#4169e1",
	"saddlebrown":			"#8b4513",
	"salmon":			"#fa8072",
	"sandybrown":			"#f4a460",
	"scrollbar":			"#d4d0c8",
	"seagreen":			"#2e8b57",
	"seashell":			"#fff5ee",
	"sienna":			"#a0522d",
	"silver":			"#c0c0c0",
	"skyblue":			"#87ceeb",
	"slateblue":			"#6a5acd",
	"slategray":			"#708090",
	"snow":			"#fffafa",
	"springgreen":			"#00ff7f",
	"steelblue":			"#4682b4",
	"tan":			"#d2b48c",
	"teal":			"#008080",
	"thistle":			"#d8bfd8",
	"tomato":			"#ff6347",
	"transparent":			"#ffffff",
	"turquoise":			"#40e0d0",
	"violet":			"#ee82ee",
	"wheat":			"#f5deb3",
	"white":			"#ffffff",
	"whitesmoke":			"#f5f5f5",
	/*"window":			"#ffffff",
	"windowframe":			"#000000",
	"windowtext":			"#000000",*/
	"yellow":			"#ffff00",
	"yellowgreen":			"#9acd32"
};
function getColorKeys()
{
	var arr = new Array();
	for (var key in globalColorArray)
	{
		arr.push(key);
	}	
	return arr;
}
function getColorValues ()
{
	var arr = new Array();
	for (var key in globalColorArray)
	{
		arr.push(globalColorArray[key]);
	}	
	return arr;
}

// ###################################################################################
function isMS()
{
	if(navigator.appName.indexOf("Microsoft")>=0) return true;
	return false;
}
function isNS()
{
	
	if(navigator.appName=="Netscape")
		return true;
	else
		return false;
}
function Obj (objId)
{
	return document.getElementById (objId);	
}
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}
function hideObj (obj)
{
	obj.style.visibility='hidden';
}
function showObj (obj)
{
	obj.style.visibility='visible';
}
function displayObj(obj)
{
	obj.style.display='';
}
function undisplayObj(obj)
{
	obj.style.display='none';
}
Date.prototype.toLocaleString = function ()
{
	if(currentCulture==null) currentCulture = "de-DE";
	var d, m, y;
	d = this.getDate();
	m = this.getMonth()+1; 
	y = this.getFullYear();
	if (currentCulture=="de-DE")
	{
		if(m<10) m = "0" + m;
		if(d<10) d = "0" + d;
		return d + "." + m + "." + y;
	}
	else if (currentCulture=="en-US")
	{
		return m + "/" + d + "/" + y;
	}
	else if (currentCulture=="nl-NL")
	{
		return m + "-" + d + "-" + y;
	}
	else if (currentCulture=="es-ES")
	{
		return m + "-" + d + "-" + y;
	}
	else
	{
		
		if(m<10) m = "0" + m;
		if(d<10) d = "0" + d;
		return d + "/" + m + "/" + y;
	}
		
	
	
}
function getActualDateString(formatFullDate,showTime,showSeconds)
{
	var d = new Date();
	var t = d.toLocaleTimeString();
	
	if (formatFullDate)
	{
		if (showTime)
			return d.toLocaleShortDateString() + ", "+ t;
		else
			return d.toLocaleShortDateString();
	}
	else
	{
		var ds = d.toLocaleShortDateString();// (d.getDate()<=9?"0":"") + d.getDate() + "." + 
			//(d.getMonth()<=8?"0":"") + (d.getMonth()+1) + "." + d.getFullYear();
		if (showTime)
		{
			if (showSeconds==true)
				ds = d.toLocaleShortDateString () + ", "+ t;
			else
				ds = toLocaleShortDateString ()  +", "  + t;//;ds + ", "+ d.getHours()+":" + (d.getMinutes()<10?"0":"")+d.getMinutes();
			
		}
		return ds;
	}
	
	
}
function Trim(str)
{
	if(str.length < 1){
		return "";
	}
	str = RTrim(str);
	str = LTrim(str);
	if(str =="")
	{
		return "";
	}
	else
	{
		return str;
	}
}

function RTrim(str)
{
	var len = str.length;
	var res = "";
	if(len < 0)
	{
		return "";
	}
	var i = len--;
	while(i > -1)
	{
		if(str.charCodeAt(i) > 32)
		{
			res = str.substring(0,i +1);
			break;
		}
		i--;
	} 
	return res;

} 


function LTrim(str)
{
	var len = str.length;	
	if(len < 1)
	{
		return "";
	}
	var res = "";
	var i = 0;

	while(i < len)
	{
		
		if(str.charCodeAt(i) > 32)
		{
			res = str.substring(i,len);
			break;
		}
		i++;
	}
	return res;
}


function getWindowWidth () 
{
  if (window.innerWidth) 
  {
    return window.innerWidth;
  } 
  else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else 
  {
    return 0;
  }
}

function getWindowHeight () 
{
  if (window.innerHeight) 
  {
    return window.innerHeight;
  } 
  else if (document.body && document.body.offsetHeight) 
  {
    return document.body.offsetHeight;
  } 
  else 
  {
    return 0;
  }
}


function validateNumber(inp)
{
	if (inp==null) inp = this;
	if (inp==null) return false;
	if(inp.value==null || inp.value=="") return false;
	var val = inp.value;
	if(!isNumeric(val))
	{
		alert (GetString("InvalidNumberWarning"));
		inp.focus();
		return true;
	}
	return false;	
	if(val=="-")
	{
		
		inp.focus();
		return;
	}
	if(val.toString().substr(0,1)=="-")
		val = val.substr(1);
	
	//Replace Comma
	val = val.replace(",",".");
	var t = Number(val);
	if (t>=0)
		return true;	
	else
	{
		alert (GetString("InvalidNumberWarning"));
		inp.focus();
		
	}
}

function validateDate(inp)
{
	if (inp==null) return false;
	if(inp.value==null || inp.value=="") return false;
	var val = inp.value;
	var res = false;
	var parts = null;
	
	if(val.indexOf(".")>=0) //German format
	{
		parts = val.split(".");
	}
	else if(val.indexOf("-")>=0) //Dutch format
	{
		parts = val.split("-");
	}
	else if(val.indexOf("/")>=0) //English format
	{
		parts = val.split("/");
		if(currentCulture=="en-US")
			if(parts.length>=3) // US-English format
			{
				var tmp = parts[1];
				parts[1] = parts[0]; //Switch day and month
				parts[0] = tmp;
			}
	}
	if(parts!=null && parts.length>=3)
	{
		var d = parts[0];
		var m = parts[1];
		var y = parts[2];
		
		if(Number(d)>=1 && Number(d)<=31)
			if(Number(m)>=1 && Number(m)<=12)				
				if(Number(y)>=0)
				{		
					if(String(y).length<=2)
					{
						if(Number(y)<=20)	//2000 till 2020
						{
							
							y =2000 + Number(y);
							
						}
						else				//1921 till 1999
							y =1900 + Number(y);
					}
						
					var check = new Date(Number(y),Number(m)-1,Number(d));
					
					var comp = new Date(1,0,1,0,0,0);// 1. Jan 1, 00:00:00
					
					if(check>=comp)
						res = true;
				}
	}
	if (!res)
	{
		alert (GetString("InvalidDateWarning"));
		inp.focus();
	}
	return res;
}
function getBrowserName()
{
	var ua = navigator.userAgent;
	if(ua.indexOf("Opera")>=0)
		return "Opera";
	else if(ua.indexOf("Firebird")>=0)
		return "Firebird";
	else if(ua.indexOf("Firefox")>=0)
		return "Firefox";
	else if(ua.indexOf("Netscape")>=0)
		return "Netscape";	
	else if(ua.indexOf("MSIE")>=0)
		return "MSIE";	
	else 
		return "Unknown browser";
}
function getBrowserVersion()
{
	var ua = navigator.userAgent;if(ua==null) return "";
	var bname = getBrowserName(); if(bname==null) return "";
	if(bname=="MSIE")
	{
		name_version=ua.match("MSIE [0-9\.]+");
		if(name_version==null) return "";		
		return name_version.toString().match (/[0-9\.]+/);
	}
	var name_version = ua.match(bname + "/\.+");if(name_version==null) return "";
	if(bname=="Opera" || bname=="Netscape")
	{
		return name_version.toString().split("/")[1].match("[0-9\.]+");
	}
	return name_version.toString().split("/")[1];
}


function getBrowserInfo(html)
{
	var br = "\r\n";
	if(navigator.platform!="Win32")
		br = "\n";
	if(html) br = "<br>";
	var res =	
			"appCodeName:  " + 			navigator.appCodeName + br + 
			"appMinorVersion:  " +  	navigator.appMinorVersion+ br + 
			"appName:  " +  			navigator.appName + br + 
			"appVersion:  " +  			navigator.appVersion + br + 
			"userAgent:  " +  			navigator.userAgent+ br + 
			"userLanguage:  " +  		navigator.userLanguage+ br + 
			"userProfile:  " +  		navigator.userProfile+ br + 
			"platform:  " +  			navigator.platform+ br + 
			"opsProfile:  " +  			navigator.opsProfile+ br + 
			"onLine:  " +  				navigator.onLine+ br + br + 
			//"mimeTypes:  " +  			br + 
			//							getMimeTypes(navigator.mimeTypes,html) + br +br+ 
			"cpuClass:  " +  			navigator.cpuClass+ br + 
			"cookieEnabled:  " +  		navigator.cookieEnabled+ br +
			"systemLanguage:  " +  		navigator.systemLanguage+ br +
			"javaEnabled:  " +  		navigator.javaEnabled()+ br +
			"taintEnabled:  " +  		navigator.taintEnabled()+ br +br;
			//"plugins:  " +  			getMimeTypes(navigator.plugins,html);
	
	return res;
				
}

function getMimeTypes(mt,html)
{
	var br = "\r\n";
	if(navigator.platform!="Win32")
		br = "\n";
	if(html) br = "<br>";
	var res = "";
	if(mt!=null && mt.length>=1)
	{
		
		for(var i=0; i<mt.length; i++)
		{
			res +="    " + mt.item(0) + ": " + arrayToString(mt.item(0),html) + br;
		}
	}
	return res;
}

function arrayToString(arr,html)
{
	var br = "\r\n";
	if(navigator.platform!="Win32")
		br = "\n";
	if(html) br = "<br>";
	
	var res="";
	if(arr==null) return "";
	if(arr.length==0) return "";
	for (var key in arr)
	{
		res+= key + ": " + arr[key] + br;
	}
	return res;
}

function setCookie (name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) +
    	((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
	
function getCookie(name, subname) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	if(subname!=null && setStr!=null)
	{
		var arr = setStr.split("&");
		for(var i=0; i< arr.length; i++)
		{
			var arr2 = arr[i].split("=");
			if(arr2.length>=2)
			{
				if(arr2[0]==subname)
					return arr2[1];
			}
		}
	}
	return(setStr);
}
function deleteCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			
			setStr = cookie.replace(cookie.substring(offset, end)+";","");
			document.cookie = setStr;
		}
	}
	
}
function getQueryString(name,querystring) {
	if(querystring==null)
		querystring = document.location.search.substr(1);
	var search = "" + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (querystring.length > 0) {
		offset = querystring.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = querystring.indexOf("&", offset)
			if (end == -1) {
				end = querystring.length;
			}
			setStr = unescape(querystring.substring(offset, end));
		}
	}
	return(setStr);
}

function displayPopupAtRelativeLocation (EVENT, popup, objDiv, divWidth, divHeight,offsetLeft, offsetTop, wind, doc)
{
	
	if(wind==null) wind = window;
	if(doc == null) doc  = document;
	var left=100, top=100;
	objDiv.style.display = "";	
	if (isNS())
	{
		left = EVENT.pageX;
		top = EVENT.pageY;	
		
		//Wenn Top > Fensterhöhe
		if ( (top + divHeight) > ( wind.pageYOffset + wind.innerHeight ))
			top = wind.pageYOffset + wind.innerHeight - divHeight;
		//Wenn  Top < 0 
		if (top < wind.pageYOffset)
			top = wind.pageYOffset-10;

		//Wenn Left+Width > Fensterbreite
		if ( (left+divWidth) > ( wind.pageXOffset + wind.innerWidth ) )
			left = wind.pageXOffset + wind.innerWidth - divWidth;
		//Wenn Lef < 0
		if ( left < wind.pageXOffset )
			left = wind.pageXOffset+10;
	}
	else
	{
		left = EVENT.x + doc.body.scrollLeft+ offsetLeft+left;
		top = EVENT.y + doc.body.scrollTop+ offsetTop+top;	
		
		//Debug-Info:
		//window.status= objDiv.currentStyle.height; //top + " - " + document.body.offsetHeight;
		
		
		//Wenn Top > Fensterhöhe
		if ( (top + divHeight) > ( doc.body.offsetHeight + doc.body.scrollTop) )
			top = EVENT.y + doc.body.scrollTop - divHeight;
		//Wenn  Top < 0 
		if (top < doc.body.scrollTop)
			top = EVENT.y + doc.body.scrollTop;
		//Wenn Left+Width > Fensterbreite
		if ( (left+divWidth) > ( doc.body.offsetWidth + doc.body.scrollLeft) )
			left = EVENT.x + doc.body.scrollLeft - divWidth;
		//Wenn Lef < 0
		if ( left < doc.body.scrollLeft )
			left = EVENT.x + doc.body.scrollLeft;
				
	}
	popup.show(left,top,divWidth, divHeight,document.body);
	
}

//Displays an object at a location relative to the cursor
function displayAtRelativeLocation (EVENT, objDiv, divWidth, divHeight,offsetLeft, offsetTop, wind)
{
	if(wind==null) wind = window;
	var doc  = wind.document;
	var left=100, top=100;
	
	if (isNS())
	{
		left = EVENT.pageX;
		top = EVENT.pageY;	
		
		//Wenn Top > Fensterhöhe
		if ( (top + divHeight) > ( wind.pageYOffset + wind.innerHeight ))
			top = wind.pageYOffset + wind.innerHeight - divHeight;
		//Wenn  Top < 0 
		if (top < wind.pageYOffset)
			top = wind.pageYOffset-10;

		//Wenn Left+Width > Fensterbreite
		if ( (left+divWidth) > ( wind.pageXOffset + wind.innerWidth ) )
			left = wind.pageXOffset + wind.innerWidth - divWidth;
		//Wenn Lef < 0
		if ( left < wind.pageXOffset )
			left = wind.pageXOffset+10;
			
			
			
	}
	else
	{
		left = EVENT.x + doc.body.scrollLeft+ offsetLeft;
		top = EVENT.y + doc.body.scrollTop+ offsetTop;	
		
		//Debug-Info:
		//window.status= objDiv.currentStyle.height; //top + " - " + document.body.offsetHeight;
		
		
		//Wenn Top > Fensterhöhe
		if ( (top + divHeight) > ( doc.body.offsetHeight + doc.body.scrollTop) )
			top = EVENT.y + doc.body.scrollTop - divHeight;
		//Wenn  Top < 0 
		if (top < doc.body.scrollTop)
			top = EVENT.y + doc.body.scrollTop;
		//Wenn Left+Width > Fensterbreite
		if ( (left+divWidth) > ( doc.body.offsetWidth + doc.body.scrollLeft) )
			left = EVENT.x + doc.body.scrollLeft - divWidth;
		//Wenn Lef < 0
		if ( left < doc.body.scrollLeft )
			left = EVENT.x + doc.body.scrollLeft;
				
	}
	//objDiv.style.left =left;
	//objDiv.style.top = top ;
	//objDiv.style.display = "";		
	
	
	
	
}


function ObjectParameters (obj)
{
	this.top  =obj.style.top; this.top=(this.top!=null?new Number(this.top.substr(0,this.top.length-2)):null);		
	this.left  =obj.style.left; this.left=(this.left!=null?new Number(this.left.substr(0,this.left.length-2)):null);		
	this.height  =obj.style.height; this.height=(this.height!=null?new Number(this.height.substr(0,this.height.length-2)):null);
	this.width  =obj.style.width; this.width=(this.width!=null?new Number(this.width.substr(0,this.width.length-2)):null);

}
//var oAttributesPopup=window.createPopup();
var oAttributesPopup;
if (!navigator.appName=="Netscape")
{
	oAttributesPopup=window.createPopup();
}
var sortres ="";
function sortCollection(coll)
{
	var keys=new Array();
	for (var key in coll)
	{
		keys.push(key);
	}
	keys.sort();
	var newColl = new Array();
	for (var k=0; k < keys.length; k++)
	{
		var key = keys[k];
		newColl[key] = coll[key];
	}
	return newColl;
}
function sortAttributes(a,b)
{
	return -1;
}
function alert$(o)
{
	alert($$(o));
}
function $$(obj,html)
{
	return $Attr(obj,html);
}
function $Attr(obj,html)
{
	return getAttributes(obj,html);
}
function getAttributes(obj,html)
{
	var lastObject = null;
	var lastKey = null;
	//try
	{
		var res = "";
		if(obj==null) return;
		var keys=new Array();
		var tabs = "";
		
		//Check if it is a xml nodes collection
		if(typeof(obj)=="object" &&
			obj.expr !=null && obj.context !=null )
		{
			return  "length:	" + obj.length + "\n" + 
			"expr:	" + obj.expr + "\n" + 
			"context:	" + obj.context;
		}
		//Check if it is an xml node
		if(typeof(obj)=="object" &&
			obj.nodeType ==1 && obj.nodeTypeString == "element"
			&& obj.xml)
		{
			keys = new Array( "nodeName","nodeValue","nodeType","parentNode","childNodes","firstChild","lastChild","previousSibling","nextSibling","attributes","ownerDocument","nodeTypeString","text","specified","definition","nodeTypedValue","dataType","xml","parsed","namespaceURI","prefix","baseName","tagName");
		}
		else
		{
			for (var a in obj)
			{
				keys[keys.length]=a;
			}
		}
		keys.sort();
		if(!html)
		{
			var cellsPerRow = 0;
			for (var k in keys)
			{
				//No inner or outer html
				var strKey = new String(keys[k]);
				lastObject = obj[keys[k]];
				lastKey = keys[k];
				var strValue  = "";
				try
				{
					strValue = obj[keys[k]].toString();
				}catch (err){
					try
					{
						strValue = String (obj[keys[k]]);
					}catch (err){
						strValue="unavailable";
					}
				}
				if(isNull(strValue)) strValue = "null";
					
					if(strKey=="innerHTML" || strKey =="outerHTML" || strKey=="innerText" || strKey=="outerText") { continue;}
					if( strValue.indexOf("function ")==0 || strValue.indexOf("function(")==0)
						strValue = "[ FUNCTION ]";
					var textLength = (strKey + ": " + strValue).length;
					tabs = "\t";
					
					if(textLength < 33)				
					tabs +="\t";
					
					if(textLength < 21)				
					tabs +="\t";			
					
					if(textLength < 12)				
					tabs +="\t";		
					
					res+= strKey + ": " + strValue;
					cellsPerRow++;
					if (cellsPerRow >=3 )
					{
						res+="\r\n";
						cellsPerRow =0;
					}
					else
						res+=tabs;
				
			}
			return res;
		}
		else
		{
			if (navigator.appName=="Netscape")
			{
				oAttributesPopup=window.open();
			}
			oAttributesPopup.document.body.style.backgroundColor="whitesmoke";
			oAttributesPopup.document.body.style.border="1px solid gray";
			
			res="<table border=1 cellpadding=2 style='font-family:Arial;font-size:8pt;width:100%' cellpadding=2 cellspacing=0>";
			
			for (var k in keys)
			{
				var valText = String(obj[keys[k]]);
				valText = valText.replace (/</g,"&lt;");
				valText = valText.replace (/>/g,"&gt;");
				res+="<tr><td valign=top><b>"+keys[k]+"</b></td>" +
					"<td valign=top>" + valText + "&nbsp;</td></tr>";
			}
			res+="</table>";
			oAttributesPopup.document.body.innerHTML = "<div style='overflow:auto;width:100%;height:100%'>" + res + "</div>";
			oAttributesPopup.show(100,100,500,500,window.document.body);
			
		}
	}
	//catch (err)
	{
		
		return "Fehler: "+ lastKey + ": " + lastObject + "\n" + err.message;
	}
}

function getStyleSheet(st)
{
	var res = "";
	if(st==null) return;
	if(st.rules==null)return;
		if (navigator.appName=="Netscape")
		{
			oAttributesPopup=window.open();
		}
		oAttributesPopup.document.body.style.backgroundColor="whitesmoke";
		oAttributesPopup.document.body.style.border="1px solid gray";
		
		res="<table style='font-family:Arial;font-size:8pt' cellpadding=2 cellspacing=0>";
		
		for (var r in st.rules)
		{
			if(st.rules[r].style!=null && st.rules[r].style["cssText"]!=null)
			{
				res+="<tr><td valign=top><b>"+st.rules[r].selectorText+"</b></td>" +
					"<td  valign=top>" + 
					getStyleList(st.rules[r].style["cssText"],true) + 
					 "</td></tr>";
			}
		}
		res+="</table>";
		oAttributesPopup.document.body.innerHTML = "<div style='overflow:auto;width:100%;height:100%'>" + res + "</div>";
		oAttributesPopup.show(100,100,500,500,window.document.body);
		
}
function getStyleList(st,html)
{
	if(st==null) return "";
	if(html==null) html=false;
	var styles=st.split(";");
	var res="";
	if(!html)
	{
		for(var s in styles)
		{
			var s2=styles[s].split(":");
			if(s2==null) continue;
			res+=s2[0]+":\t" + s2[1]+"\r\n";
		}
	}
	else
	{
		res="<table style='font-family:Arial;font-size:8pt' cellpadding=0 cellspacing=0>";
		for(var s in styles)
		{
			var s2=styles[s].split(":");
			if(s2==null) continue;
			
			res+="<tr><td><font color=blue><b>" + s2[0] +"</b></font></td><td>&nbsp;" +	s2[1]+"</td></tr>";
		}
		res+="</table>";
	}
	return res;
}
function scrollListBox (lb_id,step)
{
	
	var lb = Obj(lb_id);
	if(lb==null) return;
	var index = lb.selectedIndex;
	index += step;
	if(index<0) index=0;
	if(index>(lb.options.length-1)) index = lb.options.length-1;
	lb.selectedIndex = index;	
	if(window.cancelOverwriting!=null)
		window.cancelOverwriting(null);
}

function setListboxIndex (lb,val,ignoreCase)
{
	lb.style.border="1px solid black";
	
	if(ignoreCase==null) ignoreCase = true;
	if(lb==null) return;
	
	for (var o=0; o<lb.options.length;o++)
	{
		if(ignoreCase)
		{
			if(String(lb.options[o].value).toLowerCase()==String(val).toLowerCase())
			{
				lb.options[o].selected=true;
				return;
			}
		}
		else
		{
			if(String(lb.options[o].value)==String(val))
			{
				lb.options[o].selected=true;
				return;
			}
		}			
	}
	
	lb.selectedIndex=-1;	
}
function scrollerDown (scroller)
{
	if (scroller==null) return;
	scroller.style.borderTop = "1px solid black";
	scroller.style.borderLeft = "1px solid black";
	scroller.style.borderRight = "1px solid white";
	scroller.style.borderBottom = "1px solid white";
	

}
function scrollerUp (scroller)
{
	if (scroller==null) return;
	scroller.style.borderTop = "1px solid white";
	scroller.style.borderLeft = "1px solid white";
	scroller.style.borderRight = "1px solid black";
	scroller.style.borderBottom = "1px solid black";	
}
function getCurrentStyleValue(class_name, style_name, sheet_name)
{
	if(document.styleSheets==null) return "";
	//First find thestylesheet
	for(var s=0; s<document.styleSheets.length; s++)
	{
		var stSheet = document.styleSheets[s];		
		
		if(sheet_name!=null && stSheet.href!=null && 
			stSheet.href.toLowerCase().indexOf(sheet_name.toLowerCase())==-1)
		{
			if(stSheet.imports!=null)
			{
				for (var imp=0; imp<stSheet.imports.length; imp++)
				{
					var stSheet2 = stSheet.imports[imp];
					
					if(sheet_name!=null && stSheet2.href!=null && 
						stSheet2.href.toLowerCase().indexOf(sheet_name.toLowerCase())==-1)
						continue;
					var res = getStyleSheetRuleValue (stSheet2, class_name, style_name);
					return res;
				}
			}
			else if (stSheet.cssRules!=null)
			{
				for (var cr = 0; cr<stSheet.cssRules.length;cr++)
				{
					var r = stSheet.cssRules[cr];
					if(r.type==3)
					{
						var stSheet2 = r.styleSheet;
						
						if(sheet_name!=null && stSheet2.href!=null && 
							stSheet2.href.toLowerCase().indexOf(sheet_name.toLowerCase())==-1)
							continue;
						var res = getStyleSheetRuleValue (stSheet2, class_name, style_name);
						return res;
					}
				} 
				continue;
			}
			else
				continue;
		}	
		var res = getStyleSheetRuleValue (stSheet, class_name, style_name);
		return res;
	}	
	return null;
}
function getStyleValue (o, cssRule)
{
	var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle){
        strValue = document.defaultView.getComputedStyle(o, "").getPropertyValue(cssRule);
    }
    else if(o.currentStyle){
        cssRule = cssRule.replace(/\-(\w)/g, function (strMatch, p1){
            return p1.toUpperCase();
        });
        strValue = o.currentStyle[cssRule];
    }
 //   debugger;
    if(strValue==null || strValue=="" || strValue=="auto")
    {
		switch (cssRule.toLowerCase())
		{
			case "height":
				return o.offsetHeight;
			case "width":
				return o.offsetWidth;
			case "left":
				return o.offsetLeft;
			case "top":
				return o.offsetTop;
		}
    }
    return strValue;
}
function getObjectWidth(cell)
{
	if(!cell) return 0;
	var stWidth = int(cell.currentStyle.width);
	if (stWidth>0) return stWidth;
	
	var clientWidth = int(cell.clientWidth);
	var padLeft = int(cell.currentStyle.paddingLeft);
	var padRight = int(cell.currentStyle.paddingRight);
	return clientWidth - padLeft - padRight;
}
function getObjectHeight(cell)
{
	if(!cell) return 0;
	var stHeight= int(cell.currentStyle.height);
	if (stHeight>0) return stHeight;
	
	var clientHeight = int(cell.clientHeight);
	var padTop = int(cell.currentStyle.paddingTop);
	var padBottom = int(cell.currentStyle.paddingBottom);
	return clientHeight - padTop - padBottom;
}

function getStyleSheetRuleValue (stSheet, ruleName,style_name)
{
	if(stSheet==null || ruleName==null || style_name==null) return null;
	var rules  = stSheet.rules;
	if(rules==null) rules = stSheet.cssRules;
	if(rules==null ) return null;
	
	for (var r = 0; r < rules.length; r++)
	{
		var rule = rules[r];
		if(rule.selectorText!=null && rule.selectorText.toLowerCase()==ruleName.toLowerCase())
		{
			if(!style_name) return rule.cssText;
			var styles = rule.style;
			if(styles==null) continue;
			var res =styles[style_name];
			if(res==null || res=="")
				res = styles[style_name.toUpperCase()];
			return res;
		}
	}	
	return null;	
}
function getStylesheetVariable(sh_name,variable,style, return_value_if_not_found)
{
	
	if(sh_name==null || variable==null) return return_value_if_not_found;
	if(document.styleSheets==null) return return_value_if_not_found;
	
	var st=null;
	//First find the right stylesheet
	for(var s=0; s<document.styleSheets.length; s++)
	{
		if(document.styleSheets[s].href!=null && 
			document.styleSheets[s].href.toLowerCase().indexOf(sh_name.toLowerCase())>=0)
		{
			st = document.styleSheets[s];
			break;
		}	
	}
		
	if(st==null) return return_value_if_not_found;
	//Second, find the right rule
	var rules  = st.rules;
	if(rules==null) rules = st.cssRules;
	if(rules==null ) return return_value_if_not_found;
	
	for (var r = 0; r < rules.length; r++)
	{
		var rule = rules[r];
		if(rule.selectorText!=null && rule.selectorText.toLowerCase()==variable.toLowerCase())
		{
			var styles = rule.style;
			if(styles==null) continue;
			return styles[style];
		}
	}
	return return_value_if_not_found;
}
function convertCssRuleToJsProperty(cssRule)
{	
	cssRule = cssRule.replace(/\-(\w)/g, function (strMatch, p1){
            return p1.toUpperCase();
        });
   
	return cssRule;
}
function convertJsPropertyToCssRule(propName)
{	
	if(!propName) return null;
	var res = "";
	var letter = "";
	for (var i=0; i<propName.length;i++)
	{
		letter = propName.substr(i,1);
		if(letter.toLowerCase()!=letter && i>0)
			res+= "-";
		res += letter.toLowerCase();
	}
	return res;
}


var childrenCollectionResult = null;
function getChildObject(obj,tagname,id)
{
	if(obj==null || tagname==null) return null;
	if(!obj.hasChildNodes()) return null;
	childrenCollectionResult = new Array();
	scanObjectForChildren(obj,tagname);
	return childrenCollectionResult;
}

function scanObjectForChildren(obj,tagname){
	var children = obj.childNodes;	
	
	for(var i=0; i<children.length; i++)
	{
		var child = children[i];		
		if(child!=null && child.tagName!=null)
		{
			if(child.tagName.toLowerCase() == tagname.toLowerCase())
				childrenCollectionResult[childrenCollectionResult.length] = child;
			scanObjectForChildren(child,tagname);
		}
	}
}

function convertColorNameToHex(color)
{
	if(globalColorArray!=null)
		return globalColorArray[color.toLowerCase()];
	return null;
}
function convertHexToColorName(hex)
{
	
	if(globalColorArray==null) return;
	
	for(var cn in globalColorArray)
	{
		if(globalColorArray[cn].toLowerCase()==hex.toLowerCase())
			return cn;
	}
	return null;
}
/** SOME USEFUL CLASSES **/
function DimensionClass ()
{
	this.dimension	= null;
	this.unit		= "px";
} 
function getDimension(size)
{
	var res = new DimensionClass();
	if(size==null || size=="") return res;
	if(parseInt(size)==size)
	{
		res.dimension = size;		
	}
	else
	{
		res.dimension = parseInt(size);
		res.unit = size.substr(res.dimension.length+1);
	}
	return res;
}
/** IMAGE CLASS **/
function ImageClass (img)
{
	this.imgObject = img; //Image object
	this.name = null; //Image name
	this.origWidth=null; //Original size
	this.origHeight=null;
	this.optWidth=null; //Optimal size
	this.optHeight=null;
	this.udWidth=null; //User defined size
	this.udHeight=null;	
	this.src = img.src; //Source
	this.border = "0"; //Border
	this.borderWidth ="0"; 
	this.borderColor ="#000000";
	this.borderStyle ="solid";
	this.vSpace	= 0; //Spacing
	this.hSpace = 0; 
	this.align = "absmiddle"; //Alignment
	this.alt = img.src;	//Alternative text
	this.title = img.src;
}

function formatFileSize (file_size)
{
	if(file_size<=1024)
		return file_size + " bytes";
	if(file_size<=1024*1024)
		return Math.round(file_size/1024*10)/10 + " KB";
	if(file_size<=1024*1024*1024)
		return Math.round(file_size/(1024*1024)*10)/10 + " MB";
	else
		return Math.round(file_size/(1024*1024*1024)*10)/10 + " GB";
	return file_size;
}
var showTmp = true;
var r2 = "";
function isInArray(arr,val)
{
	if (val==null) return false;
	for (var i=0; i<arr.length; i++)
	{
		var val2 = arr[i];
		try
		{
			//r2 += (String(val2)).toLowerCase() + "==" + (String(val)).toLowerCase() + ": " + ( String(val2)).toLowerCase()==(String(val)).toLowerCase() + "\n";
			//r2+= (String(val2)).toLowerCase() + "==" + ( String(val)).toLowerCase() + "\n";
			if(val2!=null && ( String(val2)).toLowerCase()==(String(val)).toLowerCase())
			return true;
		}catch (err){}
	}
	/*if(showTmp) 
	{
		alert(r2);
		showTmp=false;
	}*/
	return false;
}
function isKeyInArray(arr,val)
{
	if (val==null) return false;
	for (var key in arr)
	{
		try
		{
			if((String(key)).toLowerCase()==(String(val)).toLowerCase())
			return true;
		}
		catch (err){}
	}
	return false;
}

//Gibt die Nachricht nur auf dem PC des Entwicklers aus
function alert2 (txt)
{
	if ((String(document.location.href)).toLowerCase().indexOf(".local.de")>0)
		alert(txt);
}

String.prototype.stripTags = stripTags;
//Removing all html tags
function stripTags (str)
{
	if(str==null) str = this;
	var res = String(str);
	res = res.replace(/(<(\/?[^>]+)>)/ig,"");
	return res;
}

function getPopupPosition(EVENT, divHeight, divWidth, offsetLeft, offsetTop, inner_div)
{
	var left=100, top=100;
	
	if (isNS())
	{
		left = EVENT.pageX+offsetLeft;
		top = EVENT.pageY+offsetTop;	
		
		//Wenn Top > Fensterhöhe
		if ( (top + divHeight) > ( window.pageYOffset + window.innerHeight ))
			top = window.pageYOffset + window.innerHeight - divHeight;
		//Wenn  Top < 0 
		if (top < window.pageYOffset)
			top = window.pageYOffset-10;

		//Wenn Left+Width > Fensterbreite
		if ( (left+divWidth) > ( window.pageXOffset + window.innerWidth ) )
			left = window.pageXOffset + window.innerWidth - divWidth;
		//Wenn Lef < 0
		if ( left < window.pageXOffset )
			left = window.pageXOffset+10;
	}
	else
	{
		//Scroll parameters
		var scrollLeft, scrollTop;
		var o1 = inner_div;
		var o2 = document.body;
		
		scrollLeft = o2.scrollLeft;
		scrollTop = o2.scrollTop;
		
		if (o1!=null)
		{
			scrollLeft += o1.scrollLeft;
			scrollTop  += o1.scrollTop;
		}
		//Window dimensions
		var winHeight, winWidth;
		winHeight = o2.clientHeight + o2.scrollTop;
		winWidth = o2.clientWidth + o2.scrollLeft; 
		if(o1!=null)
		{
			winHeight = o1.clientHeight + o1.scrollTop;
			winWidth = o1.clientWidth + o1.scrollLeft; 
		}
		
		
		
		left = EVENT.x + scrollLeft+ offsetLeft;
		top = EVENT.y+ offsetTop +  + scrollTop;	
		
		window.status = "";
		/* Check TOP parameter */
		// top + div height > window height
		if ( (top + divHeight) > winHeight)
		{
			top = winHeight - divHeight;
		}
			
		// top < 0
		if (top < scrollTop)
			top = scrollTop;
		
		/* Check LEFT parameter */		
		// left + div width > window width		
		if ((left + divWidth) > winWidth)
			left = winWidth - divWidth;
		
		//Left < 0
		if (left < scrollLeft)
			left = scrollLeft; 
		
	}
	var res = new Object();
	res.left = left;
	res.top = top;
	return res;
}
function isNumeric(txt)
{
	if(txt==null) return false;
	var tmp = String(txt);
	if(tmp.substr(0,1)=="0" && tmp.length==1) return true;
	var rex = new RegExp("^[-]{0,1}[0-9]{0,}[.|,]{0,1}[0-9]{1,}$","ig");
	return rex.test(tmp);
}
var alert_once = true;
function alertOnce(txt)
{
	if(alert_once)
		alert(txt);
	alert_once=false;
}
String.prototype.startsWith = startsWith;
String.prototype.endsWith = endsWith;

function startsWith (txt, ignoreCase)
{
	if(ignoreCase==null) ignoreCase = true;
	if(txt==null) return false;
	if(txt.length>this.length) return false;
	if(ignoreCase)
	{
		return (this.toLowerCase().indexOf(txt.toLowerCase())==0);
	}
	else
		return (this.indexOf(txt)==0);
	
}
function endsWith (txt, ignoreCase)
{
	if(txt==null) return false;
	if(txt.length>this.length) return false;
	if(ignoreCase)
	{
		return (this.toLowerCase().substr(this.length-txt.length)==txt.toLowerCase());
	}
	else
		return (this.substr(this.length-txt.length)==txt);
	
}

function cloneHtmlElement(el)
{
	clone = el.cloneNode(true);
	try
		{
		if(el.attributes!=null)
			for(var attr in el.attributes)
			{
					clone.setAttribute(attr,el.getAttribute(attr));
				
			}
		clone.style.cssText = el.style.cssText + el.currentStyle.cssText;
		
	}catch (err) {}
	
	if(clone.tagName!=null && 
		(clone.tagName.toLowerCase()=="td" || clone.tagName.toLowerCase()=="th") )
	{
		clone.innerHTML = "&nbsp;";
		clone.oncontextmenu=contextmenuTableCell;
		clone.onclick =displayVerticalAlignmentButtons;
	}
	else if(clone.tagName!=null && clone.tagName.toLowerCase()=="tr" &&
		clone.childNodes!=null)
	{
		for(var c=0; c<clone.childNodes.length; c++)
		{
			clone.childNodes[c].innerHTML="&nbsp;";
			clone.childNodes[c].oncontextmenu=contextmenuTableCell;
			clone.childNodes[c].onclick =displayVerticalAlignmentButtons;
		}		
	}
	return clone;
}


function generateNewGuid()
{
	var new_guid = "";
	for(var c = 0; c < 32; c++)
	{
		new_guid += Math.floor(Math.random () * 0xF ).toString(0xF);
		if (c == 7 || c == 11 || c == 15 || c == 19)
			new_guid+= "-";

	}
	return "{" + new_guid + "}";
}
function getVirtualPath ()
{
	var path = document.location.pathname;
	var pos2 = path.indexOf("/",1);
	if(pos2>=0)
		return path.substr(0,pos2)+"/";	
	return "/";
}
function getPathWithoutVirtualFolder(path, vpath)
{
	if(path==null)return null;
	if(vpath==null) vpath = getVirtualPath();
	var proto = document.location.protocol;
	var host =  document.location.host;
	var pos = proto.length+2 + host.length;
	var location = document.location.href;
	path = path.substr(pos);
	if(path.indexOf("?")>0)
		path = path.substr(0, path.indexOf("?"));
	return path.substr(vpath.length);
}
function showMsg(txt)
{	
	window.status = txt;
}
//Compare if the given property is not null and is the same as the compare_with parameter
function equals (prop, compare_with, case_sensitive)
{
	if(prop==null || compare_with == null) return false;
	if ( case_sensitive )
		return prop==compare_with;
	else
		return prop.toLowerCase()==compare_with.toLowerCase();
}
function CopyText(obj, strip_tags)
{
	if (obj==null) return;
	if( equals (obj.tagName, "textarea") || 
		(equals (obj.tagName, "input") && equals (obj.type, "text")))
	{
		window.clipboardData.setData("Text", 
		(stripTags? unescape(stripTags(obj.value)):obj.value));
	}
	else
	{
		window.clipboardData.setData("Text", 
		(stripTags? unescape(stripTags(obj.innerHTML)):obj.innerHTML)
		);
	}
}
function Round (number, radix)
{
	if(radix==0 ||radix==null) return Math.round(number);
	return Math.round( number*(10*radix))/10*radix;
}
function getTagAndType(o, case_sensitive)
{
	var ignoreCase = !case_sensitive;
	var tt = new Object();
	tt.tag = null;
	tt.type = null;
	if(o==null) return tt;
	if(o.tagName!=null)
		tt.tag = (ignoreCase?o.tagName.toLowerCase():o.tagName);
	if(o.type!=null)
		tt.type = (ignoreCase?o.type.toLowerCase():o.type);
	return tt;
}
function doAutoResizing()
{
	
	var inp = ( arguments[0]? arguments[0]: this);
	if(inp==null)return;
	var tt = getTagAndType(inp);
	if(tt.tag!="div" && tt.tag!="textarea" && tt.type !="text") return;
	var newHeight, newWidth;
	newHeight = inp.clientHeight;
	newWidth  = inp.clientWidth;
	if(tt.tag=="div" || tt.tag=="textarea")
	{
		newHeight = parseInt(inp.scrollHeight);
		
	}
	else if (tt.tag=="input" && tt.type=="text")
	{
		
		newWidth = parseInt(inp.scrollWidth);
		
	}
	if(inp.minWidth!=null && newWidth < inp.minWidth)
		newWidth = inp.minWidth;
	if(inp.minHeight!=null && newHeight < inp.minHeight)
		newHeight = inp.minHeight;
		
	inp.style.height = newHeight +"px";
	inp.style.width = newWidth +"px";
}	
function makeAutoResizable (o,minWidth, minHeight)
{
	if(!o) return;
	o.onchange = o.onclick = o.ondrop = o.onkeypress = o.onmouseup = doAutoResizing;
	o.minWidth = (minWidth==null? o.offsetWidth:minWidth);
	o.minHeight = (minHeight==null? o.offsetHeight: minHeight);
}
function getNodeValue(node)
{
	if(!document.all) return node.textContent;
	else return node.text;
}
function AddProperties (xmlNode, curObject)
{
	if(xmlNode==null || xmlNode.childNodes==null) return;
	for (var ch=0; ch < xmlNode.childNodes.length; ch++)
	{
		var node = xmlNode.childNodes[ch];
		
		if(node.nodeType!=3)
		{
			var t = new String( getNodeValue(node));
			if(t!=null)
			{
				if(t!="false" && t!="false")
				{
					t = t.replace(/\r/ig,escape("\r"));
					t = t.replace(/\n/ig,escape("\n"));
					
					if(!isNumeric(t) && !t.startsWith("new Array")) 
					{
						t = t.replace(/\"/g, "\\\"");
						//t = t.replace(/^'/, "");
						//t = t.replace(/'$/, "");
						t = "\"" + t + "\"";
					}
				}
			}
			
			if(t==null)
				t="null";
			else if(t=="")
				t="\"\"";
				
			try
			{
				eval("curObject." + node.nodeName + " = " + t + ";");				
			}
			catch (err)
			{
				//alert(t);
			}
		}
		
	}	
	return curObject;
	
}
function isChildOf (obj1, obj2)
{
	if(!obj1 || !obj2)
		return false;
	while(obj1)
	{
		if(obj1.parentNode==obj2) return true;
		obj1 = obj1.parentNode;
	}
	return false;
	
}
function isNull()
{	
	if(!arguments) return true;
	for (var i=0; i<arguments.length; i++)
	{
		var o = arguments[i];	
		if(o==null)return true;
		if(o==undefined) return true;
		if(typeof(o)=="undefined") return true;
		if(typeof(o)=="null") return true;
		if((o)=="null") return true;
		//What else?
	}	
	return false;
}
function isEmpty()
{	
	if(!arguments) return true;
	for (var i=0; i<arguments.length; i++)
	{
		if(isNull(arguments[i]))return true;
		if(arguments[i]=="") return true;		
	}	
	
	return false;
}
function join ()
{
	var res = "";
	var separator = arguments[arguments.length-1];
	for (var arg=0; arg<arguments.length-1; arg++)
	{
		res += (arg>0?separator:"") + arguments[arg];
	}
	return res;
}
function int(o)
{
	if(isEmpty(o))return 0;
	var res = parseInt(o);
	if(isNaN(res))return 0;
	return res;
}

//A fake for HtmlEncoding:
//converts only the braces, quotes and German Umlauts
//feel free to add more encoding

function HtmlEncode (str)
{
	if(str==null) return null;
	/** this works only partly
	var div = document.createElement('div');
	var text = document.createTextNode(str);
	div.appendChild(text);
	return div.innerHTML;
	**/

	
	str = String(str);
	//Braces
	str = str.replace(/>/ig, "&gt;");
	str = str.replace(/</ig, "&lt;");
	//Quotes
	str = str.replace(/"/ig, "&quot;");
	
	//Umlauts
	/* ä */
	str = str.replace(/ä/ig, "&auml;");	
	str = str.replace(/Ä/ig, "&Auml;");	
	/* ö */
	str = str.replace(/ö/ig, "&ouml;");	
	str = str.replace(/Ö/ig, "&Ouml;");	
	/* ü */
	str = str.replace(/ü/ig, "&uuml;");	
	str = str.replace(/Ü/ig, "&Uuml;");	
	/* ß */
	str = str.replace(/ß/ig, "&szlig;");	
	
	/* § */
	//str = str.replace(/§/ig, "&sect;");	
	
	return str;	
}

function HtmlEncodeForXml (str)
{
	if(str==null) return null;
	
	str = String(str);
	//Braces
	str = str.replace(/>/ig, "&gt;");
	str = str.replace(/</ig, "&lt;");

	return str;	
}
function HtmlDecode(str)
{
	if(str==null) return null;
	
	str = String(str);
	//Braces
	str = str.replace(/&gt;/ig, ">");
	str = str.replace(/&lt;/ig, "<");

	return str;	
}

function HighlightTags(html, style, formatLineBreaks)
{
	//Init
	if(!html) return html;
	html = String(html);
	
	if(!style) style = "color:blue;font-weight:bold";
	
	
	//opening and closing tags design
	var openTag  = "<span style=\"" + style + "\">";
	var closeTag = "</span>";
	
	//Reg expression
	var regEx = new RegExp(/<([\/]{0,1}[^\/<>]+)>/ig);
	
	//Replacement?
	
	var repl = 
		openTag + "&lt;$1&gt;" + closeTag;
	
	html = html.replace(regEx,repl);
	return html;
}

function convertRoman2Arabic(rome)
{
	var tokens = new Array("M",  "CM", "D", "CD", "CCC", "CC", "C", "XC", "L", "XL", "XXX", "XX", "X", "IX", "V", "IV", "III", "II", "I");
var values = new Array( 1000, 900,  500, 400,  300,   200,  100, 90,   50,  40,   30,    20,   10,  9,    5,   4,    3,     2,    1); 
var invalid = new Array("CMCM",  "CMD",  "CMCD", "CMC", "DD", "DCD", "CDCD", "CDC", "CCCC", "XCXC",  "XCL", "XCXL", "XCX", "LL", "LXL", "XLXL", "XLX", "XXXX", "IXIX",  "IXV", "IXIV", "IXI", "IVIV", "IVI", "IIII");
var replace = new Array("MDCCC", "MCD",  "MIII", "M",   "M",  "CM",  "DCCC", "D",   "CD",   "CLXXX", "CXL", "CIII", "C",   "C",  "XC",  "LXXX", "L",   "XL",   "XVIII", "XIV", "XIII", "X",   "VIII", "V",   "IV");

	rome.replace(/ /g, "");
	rome= rome.toUpperCase();
	rome = rome.replace(/[^IVXLCDM]/g, "");
	
	var pos = 0;
	var val = 0;

	var t1 = -1;

	while ( pos < rome.length )
	{
		var t = getNextToken(rome, pos);
		if ( t1 != 0 )
		{
			if ( values[t1] < values[t] )
			{
				//Syntay error
				return null;
			}
		}
		if ( t < 0 )
			return;
		pos += tokens[t].length;
		val += values[t];
		t1 = t;
	}
	
	return val;
	
	function getNextToken(s, pos)
	{

		for (i=0; i<invalid.length; i++)
		{
			if ( s.indexOf(invalid[i], pos) == pos )
			{
				return -1;
			}
		}

		for (i=0; i<tokens.length; i++)
		{
			if ( s.indexOf(tokens[i], pos) == pos )
				return i;
		}
		return -1;
	}
	
}
function convertArabic2Roman(arab)
{
	var values = new Array(1000000, 900000, 500000, 400000, 100000, 90000, 50000, 40000, 10000, 9000, 5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1);
	
	var strings = new Array(
		"<span style='text-decoration: overline'>M</span>",
		"<span style='text-decoration: overline'>CM</span>",
		"<span style='text-decoration: overline'>D</span>",
		"<span style='text-decoration: overline'>CD</span>",
		"<span style='text-decoration: overline'>C</span>",
		"<span style='text-decoration: overline'>XC</span>",
		"<span style='text-decoration: overline'>L</span>",
		"<span style='text-decoration: overline'>XL</span>",
		"<span style='text-decoration: overline'>X</span>",
		"<span style='text-decoration: overline'>IX</span>",
		"<span style='text-decoration: overline'>V</span>",
		"<span style='text-decoration: overline'>IV</span>",
		"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" );
	
	var num = parseInt(arab);
	if (isNaN(num) )
	{
		return null;
   	}
	if ( num > 3999999 || num < 1)
	{
		return null;
	}
	var res = "";
	var work = num;
	while ( work > 0 )
	{
		var i;
		for (i=0; i< values.length; i++)
		{
			if ( work >= values[i] )
			{
				res += strings[i];
				work -= values[i];
				break;
			}
		}
	}
	return res;
}
function convertStringToDate(s)
{
	try
	{
		//debugger;
		var d = s.toString();
		var t = null;
		if(s.indexOf(" ")>0) //Contains time string
		{
			d = s.split(" ")[0];
			t = s.split(" ")[1];
		}
		var sep = "."; 
		if(d.indexOf("/")>0)
			sep = "/";
		else if(d.indexOf("-")>0)
			sep = "-";
		var day,month,year;
		var arr = d.split(sep);
		day		=   arr[0];
		month	=	arr[1]; if(int(month)>12) { day = month; month = arr[0] }
		year	=	arr[2]; 
		if(year.length==2)
		{
			year = int(year);
			if(year>49) year = 1900 + year;
			else year = 2000 + year;
		}
		return new Date(int(year), int(month)-1, int(day));		
		//return Date.parse(String(s));
	}catch (err)
	{
		return null;
	}
}
function importJavaScript (src)
{
	if(document==null)return;
	var headTag = document.getElementsByTagName("HEAD")[0];
	if(headTag==null)return;
	var jScript= document.createElement("SCRIPT"); 
	jScript.setAttribute("type", "text/javascript");
	jScript.setAttribute("src", src);
	headTag.appendChild(jScript);	
}
//Concatting associative arrays
function mergeArray (anotherArray)
{	
	if(anotherArray==null) return this;
	
	try
	{
		for (var p in anotherArray)
		{
			try
			{
				if(p.toString().toLowerCase().indexOf("function ")!=0)
					this[p] = anotherArray[p];
			} catch (err){}
		}
	}catch(err2){}
	return this;
};
	
//Cross browser
function addEvent (object, event_name, handler)
{
	if(!event_name) return;
	//modify event_name
	if(event_name.toLowerCase().startsWith("on"))
		event_name = event_name.substr(2);
	if(document.all)
		object.attachEvent("on" + event_name, handler);
	else
		object.addEventListener(event_name, handler, false);
}
function removeEvent (object, event_name, handler)
{
	if(!event_name) return;
	//modify event_name
	if(event_name.toLowerCase().startsWith("on"))
		event_name = event_name.substr(2);
	
	if(document.all)
		object.detachEvent("on" + event_name, handler);
	else
		object.removeEventListener(event_name, handler, false);
}
function callEvent (object, event_name)
{
	if(!event_name) return;
	//modify event_name
	if(event_name.toLowerCase().startsWith("on"))
		event_name = event_name.substr(2);
	if(document.all || !document.createEvent)
		object.fireEvent("on" + event_name);
	else
	{
		var events = "Events";
		//Check the event type
		event_name = event_name.toLowerCase();
		if (event_name.indexOf("click")>=0 
			|| event_name.indexOf("mouse")>=0)
			events = "MouseEvents";
		else if (event_name.indexOf("key")>=0 
			|| event_name.indexOf("cut")>=0)
			events = "KeyEvents";
		
		var evt = document.createEvent(events);
		evt.initEvent(event_name, true, true);
		object.dispatchEvent(evt);
	}
}
function calculatePercentage(n100,nX)
{
	if(n100==0) return 0;
	return Math.round(((nX*100)/n100)*100)/100;
}
function GetInstanceName(o)
{
	if(o==null) return null;
	if(!o.constructor) return typeof(o);
	var c = o.constructor;
	c = c.toString();
						
	var regExp = new RegExp(/function[ ]+([a-zA-Z0-9]+)[ \(\r\n]+/);
	regExp.ignoreCase = false;
	var res = regExp.exec(c);
	
	if(res!=null && res[1]!=null)
	{
		return res[1];
	}
	return typeof(o);
}
function GetFunctionBody(o)
{
	if(o==null) return null;
	var sC = null;
	if(typeof(o)=="object" && o.constructor!=null)
	{
		sC = o.constructor.toString();
	}
	else if(typeof(o)=="function")
	{
		sC = o.toString();
	}
	if(sC==null)return null;
	var rex = new RegExp(/{([^{}]+)}/ig);
	var res = rex.exec(sC);
	if(res!=null && res[1]!=null)
	{
		var s = res[1];
		s = Trim(s);
		var rex2 = new RegExp(/\t/g);
		
		s = s.replace(rex2,"");
		return s;
	}
	return res;
}
Number.prototype.between = function (a,b)
{
	var num = this;
	if(typeof(num)!="number") 
		num = Number(num);
	if(typeof(num)!="number") 
		return false;
	return num>=a && num <=b;
}
Number.prototype.equals = function ()
{
	var num = this;
	if(typeof(num)!="number") 
		num = Number(num);
	if(typeof(num)!="number") 
		return false;
	
	if(arguments==null ||arguments.length==0) return false;
	for (var a=0; a< arguments.length; a++)
	{
		if(Number(arguments[a])==num)
			return true;
	}
	return false;
}
String.prototype.equals= function ()
{
	var str = this;
	if(typeof(str)!="string") 
		str = String(str);
	if(typeof(str)!="string") 
		return false;
		
	if(arguments==null ||arguments.length==0) return false;
	for (var a=0; a< arguments.length; a++)
	{
		if(arguments[a]==str)
			return true;
	}
	return false;
}
function getObjectTop(obj)
{
	var top = 0;
	var o = obj;
	while (o)
	{
		top+=int(o.offsetTop);
		o = o.offsetParent;
	}
	return top;
}
function getObjectLeft(obj)
{
	var left = 0;
	var o= obj;
	while (o)
	{
		left +=int(o.offsetLeft);
		o = o.offsetParent;
	}
	return left;
}
function getObjectPosition(obj) {
	var left,top;
	left=top =0;
	var o= obj;
	if (o.offsetParent) {
		
		while (o) {
			left += o.offsetLeft; if(o==obj) left+= o.clientLeft;
			top += o.offsetTop;   if(o==obj) top+= o.clientTop;
			o = o.offsetParent;
		}
	}
	return [left,top];
}

function setFocus(el)
{
	try
	{
		if(el==null) return;
		el.focus();
	}
	catch (ex)
	{
	}
}
function getEventSource(e)
{
	return (isMS()? e.srcElement: e.target);
}
function isTag (tag, o, type)
{
	if(tag==null) return false;
	if(o==null) return false;
	
	var tagName = o.tagName;
	if(tagName==null) return false;
	if(type==null)
		return (tagName.toLowerCase()==tag.toLowerCase());
	else
	{
		if(tagName.toLowerCase()!=tag.toLowerCase()) return false;
		if(o.type==null) return false;
		return (o.type.toLowerCase()==type.toLowerCase());
	}
	return false;
}

document.writeln("<script language=\"javascript\" src=\"" + getVirtualPath() + "multimed/dom-drag.js\"></script>");
