
function GetElementPosition(Element)
{var pos={x:0,y:0};do{pos.x+=Element.offsetLeft;pos.y+=Element.offsetTop;}while(Element=Element.offsetParent);return pos;}
function GetElementDimensions(Element)
{if(!Element)return false;var Result=new Object();Result.Width=Element.offsetWidth;Result.Height=Element.clientHeight;return Result;}
function AddEvent(Element,EventType,TheFunction,UseCaption)
{if(Element.addEventListener)
{var ReturnValue=Element.addEventListener(EventType,TheFunction,UseCaption);return ReturnValue;}
else if(Element.attachEvent)
{var ReturnValue=Element.attachEvent("on"+EventType,TheFunction);return ReturnValue;}
return false;}
function RemoveEvent(Element,EventType,TheFunction,UseCaption)
{if(Element.removeEventListener)
{var ReturnValue=Element.removeEventListener(EventType,TheFunction,UseCaption);return ReturnValue;}
else if(Element.attachEvent)
{var ReturnValue=Element.detachEvent("on"+EventType,TheFunction);return ReturnValue;}
return false;}
function GetBodyWidth(Document)
{if(Document==undefined)Document=window.document;if(!Document.getElementsByTagName('body')[0])return false;return Document.getElementsByTagName('body')[0].offsetWidth;}
function GetInnerWindowHeight()
{if(IsInternetExplorer())
{if(document.documentElement.clientHeight!=0)return document.documentElement.clientHeight;return document.body.clientHeight;}
else
{return window.innerHeight;}}
function GetInnerWindowWidth()
{if(IsInternetExplorer())
{if(document.documentElement.clientWidth!=0)return document.documentElement.clientWidth;return document.body.clientWidth;}
else
{return window.innerWidth;}}
function ScrollToAnchor(id)
{var Element=document.getElementById(id);if(!Element)return false;var ElementPosition=GetElementPosition(Element);window.scrollTo(ElementPosition['x'],ElementPosition['y']);return true;}
function RemoveElement(id)
{var node=document.getElementById(id);if(typeof node=='object'){node.parentNode.removeChild(node);}}
function ExtractQueryParameter(URL,QueryParamName)
{URL=new String(URL);if((pos=URL.indexOf("?"))!=-1)
var QueryString=URL;else
var QueryString=new String(URL.substring(pos+1));var QueryCommands=QueryString.split("&");for(var i=0;i<QueryCommands.length;i++)
{if((pos=QueryCommands[i].indexOf("="))==-1)continue;var QueryName=QueryCommands[i].substring(0,pos);var QueryValue=QueryCommands[i].substring(pos+1);if(QueryName==QueryParamName)return QueryValue;}
return false;}
function urlencode(string){return escape(string);}
function urldecode(string){return unescape(string);}
function basename(path)
{var pos=null;if((pos=path.indexOf('?'))!=-1)path=path.substr(0,pos);if((pos=path.lastIndexOf('/'))!=-1)path=path.substr(pos+1);return path;}
function dirname(path)
{var pos=null;if((pos=path.indexOf('?'))!=-1)path=path.substr(0,pos);if((pos=path.lastIndexOf('/'))!=-1)path=path.substr(0,pos);return path;}
function SlashPath(Path,BeginSlash,EndSlash,NoSingleSlashAsResult)
{Path=new String(Path);if(Path.substr(0,1)=="/"&&BeginSlash===false)
Path=Path.substr(1);if(Path.substr(0,1)!="/"&&BeginSlash===true)
Path="/"+Path;if(Path.substr(Path.length-1)=="/"&&EndSlash===false)
Path=Path.substr(0,Path.lenth-1);if(Path.substr(Path.length-1)!="/"&&EndSlash===true)
Path+="/";if(NoSingleSlashAsResult&&Path=="/")Path="";return Path;}
function IsInternetExplorer()
{if(navigator.appName=="Microsoft Internet Explorer")
return true;return false;}
function GetTopWindow()
{var TopWindow=window;if(parent)
{TopWindow=parent;while(true)
{if(!TopWindow.parent||TopWindow.parent==TopWindow)break;TopWindow=TopWindow.parent;}}
return TopWindow;}
function GetIFrameDocument(aID)
{var rv=null;if(!document.getElementById(aID))return false;if(document.getElementById(aID).contentDocument){rv=document.getElementById(aID).contentDocument;}else{rv=document.frames[aID].document;}
return rv;}
function GetIFrameWindow(IFrameId)
{var rv=null;if(!document.getElementById(IFrameId))return false;if(document.getElementById(IFrameId).contentDocument){rv=document.getElementById(IFrameId);}else{rv=document.frames[IFrameId];}
return rv;}
function ReloadFramesIfNecessary(FramePage)
{var TopWindow=GetTopWindow();var TopFile=basename(TopWindow.location.href);var FrameFile=basename(FramePage);if(FrameFile=="index.php"||FrameFile=="index.htm"||FrameFile=="index.php4"||FrameFile=="index.php5"||FrameFile=="index.php6")
FrameFile="";if(TopFile=="index.php"||TopFile=="index.htm"||TopFile=="index.php4"||TopFile=="index.php5"||TopFile=="index.php6")
TopFile="";if(TopFile==FrameFile)return true;var NewURL=FramePage;NewURL=NewURL.replace('${page}',basename(document.location.href));document.location.href=NewURL;}
function IsRightClick(TheEvent)
{if((TheEvent.type&&TheEvent.type=="contextmenu")||(TheEvent.button&&TheEvent.button==2)||(TheEvent.which&&TheEvent.which==3))
return true;return false;}
function GetScrollPos(Document)
{if(Document==undefined)Document=window.document;var scrollTop=0;var scrollLeft=0;if(Document.body&&Document.body.scrollTop)scrollTop=Document.body.scrollTop;else
{if(!Document.documentElement)return false;scrollTop=Document.documentElement.scrollTop;}
if(Document.body&&Document.body.scrollLeft)scrollLeft=Document.body.scrollLeft;else
{if(!Document.documentElement)return false;scrollLeft=Document.documentElement.scrollLeft;}
var Result=new Object();Result.Top=scrollTop;Result.Left=scrollLeft;return Result;}
function SetScrollPos(Left,Top)
{if(Top!==undefined)
{window.scrollTo(GetScrollPos().Left,Top);}
if(Left!==undefined)
{window.scrollTo(Left,GetScrollPos().Top);}
return true;}
function GetMousePosAbs(MouseX,MouseY,Document)
{if(Document==undefined)Document=window.document;var ScrollPos=new GetScrollPos(Document);this.Left=MouseX+ScrollPos.Left;this.Top=MouseY+ScrollPos.Top;return this;}
function GetClassName(object)
{var Type=String(object.constructor);if(Type==="[Window]"||Type==="undefined"){return false;}
Type=Type.split(' ')[1];Type=Type.substr(0,Type.indexOf('('));return Type;}
function GetCookie(name)
{var cookieValue=false;var search=name+"=";if(document.cookie.length>0)
{offset=document.cookie.indexOf(search);if(offset!=-1)
{offset+=search.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;cookieValue=unescape(document.cookie.substring(offset,end));}}
return cookieValue;}
function SetCookie(name,value,DurationTime)
{var DurationTime="";if(DurationTime!=null)
{expire=new Date((new Date()).getTime()+DurationTime);expire="; expires="+expire.toGMTString();}
document.cookie=name+"="+escape(value)+expire+";path=/";}
function VarDump(Variable,Title)
{var VarDumpString="";if(Title===undefined||Title===null)Title="";switch(typeof(Variable))
{case"object":VarDumpString+="object\r\n{\r\n";for(var i in Variable)
{VarDumpString+="\t["+i+"] => "+Variable[i]+"\r\n";}
VarDumpString+="}\r\n";break;case"string":VarDumpString+="string("+Variable.length+")('"+Variable+"')";break;case"number":VarDumpString+="number("+Variable+")";break;case"boolean":VarDumpString+="bool("+Variable+")";break;default:alert("VarDump: Unbekannter Variablentyp ("+typeof(Variable)+")");return false;break;}
var WindowHandler=window.open(CommonSystem.RelativePathToRoot+CommonSystem.PathToCommonSystem+"Docs/VarDump.php?Info="+urlencode(VarDumpString)+"&Title="+Title);return true;}
function VarDumpMsgBox(Variable,Title)
{var VarDumpString="";if(Title===undefined||Title===null)Title="";switch(typeof(Variable))
{case"object":VarDumpString+="object\r\n{\r\n";for(var i in Variable)
{VarDumpString+="\t["+i+"] => "+Variable[i]+"\r\n";}
VarDumpString+="}\r\n";break;case"string":VarDumpString+="string("+Variable.length+")('"+Variable+"')";break;case"number":VarDumpString+="number("+Variable+")";break;case"boolean":VarDumpString+="bool("+Variable+")";break;default:alert("VarDump: Unbekannter Variablentyp ("+typeof(Variable)+")");return false;break;}
alert(Title+"\r\n"+VarDumpString);return true;}
function var_dump(Variable,Title)
{return VarDump(Variable);}
function OpenLink(Link,Target)
{if(Target===undefined||Target===null)Target="_self";Link=decodeURIComponent(Link);switch(Target)
{case"_self":document.location.href=Link;break;case"_top":GetTopWindow().document.location.href=Link;break;case"_blank":window.open(Link);break;case"_parent":parent.document.location.href=Link;break;case"_javascript":eval(Link);break;default:parent.frames[Target].document.location.href=Link;break;}
return true;}
String.prototype.ltrim=function(clist){if(clist)
return this.replace(new RegExp('^['+clist+']+'),'');return this.replace(/^\s+/,'');}
String.prototype.rtrim=function(clist){if(clist)
return this.replace(new RegExp('['+clist+']+$'),'');return this.replace(/\s+$/,'');}
String.prototype.trim=function(clist){if(clist)
return this.ltrim(clist).rtrim(clist);return this.ltrim().rtrim();};function ArraySearch(Array,SearchString)
{for(result=[],x=0;x<Array.length;x++)
{if(Array[x]==SearchString)
result[result.length]=x;}
return result.length?result:-1;};function ParseInt(SrcVar)
{SrcVar=parseInt(SrcVar);if(SrcVar===null||(typeof SrcVar=='undefined')||isNaN(SrcVar))
SrcVar=0;return SrcVar;}
Object.clone=function(what){NewObject=new Object;for(i in what){if(typeof what[i]=='object'){}
else
NewObject[i]=what[i];}
return NewObject;}
function CQueryString(qs){this.params={};if(qs==null)qs=location.search.substring(1,location.search.length);if(qs.length==0)return;qs=qs.replace(/\+/g,' ');var args=qs.split('&');for(var i=0;i<args.length;i++){var pair=args[i].split('=');var name=decodeURIComponent(pair[0]);var value=(pair.length==2)?decodeURIComponent(pair[1]):name;this.params[name]=value;}}
CQueryString.prototype.Get=function(key,default_){var value=this.params[key];return(value!=null)?value:default_;}
CQueryString.prototype.Contains=function(key){var value=this.params[key];return(value!=null);}
function serialize(mixed_value){var _getType=function(inp){var type=typeof inp,match;var key;if(type=='object'&&!inp){return'null';}
if(type=="object"){if(!inp.constructor){return'object';}
var cons=inp.constructor.toString();match=cons.match(/(\w+)\(/);if(match){cons=match[1].toLowerCase();}
var types=["boolean","number","string","array"];for(key in types){if(cons==types[key]){type=types[key];break;}}}
return type;};var type=_getType(mixed_value);var val,ktype='';switch(type){case"function":val="";break;case"boolean":val="b:"+(mixed_value?"1":"0");break;case"number":val=(Math.round(mixed_value)==mixed_value?"i":"d")+":"+mixed_value;break;case"string":val="s:"+encodeURIComponent(mixed_value).replace(/%../g,'x').length+":\""+mixed_value+"\"";break;case"array":case"object":val="a";var count=0;var vals="";var okey;var key;for(key in mixed_value){ktype=_getType(mixed_value[key]);if(ktype=="function"){continue;}
okey=(key.match(/^[0-9]+$/)?parseInt(key,10):key);vals+=this.serialize(okey)+
this.serialize(mixed_value[key]);count++;}
val+=":"+count+":{"+vals+"}";break;case"undefined":default:val="N";break;}
if(type!="object"&&type!="array"){val+=";";}
return val;}
function CenterWebsiteVertical(ContainerId)
{if(!document.getElementById(ContainerId))
{throw(new Error('Das Container-Element mit der Id "'+ContainerId+'" ist nicht gesetzt.'));return false;}
var Dimensions=GetElementDimensions(document.getElementById(ContainerId));var MarginTop=((GetInnerWindowHeight()-Dimensions.Height)/2);if(MarginTop>0)
document.getElementById(ContainerId).style.top=((GetInnerWindowHeight()-Dimensions.Height)/2)+'px';return true;}
function CCommonSystem()
{this.RelativePathToRoot=null;this.PathToCommonSystem=null;this.URLRoot=null;var DynamicallyLoadedJavaScriptFiles="";this.LoadJavaScriptFile=function(FileName)
{var ScriptElem=document.createElement('script');ScriptElem.type="text/javascript";ScriptElem.src=this.RelativePathToRoot+this.PathToCommonSystem+"JavaScript/"+FileName;alert(document.getElementsByTagName("head")[0].appendChild(ScriptElem));return true;}}
CommonSystem=new CCommonSystem();if(typeof(CommonSystem_RelativePathToRoot)!=='undefined')
{CommonSystem.RelativePathToRoot=CommonSystem_RelativePathToRoot;CommonSystem_RelativePathToRoot=undefined;}
if(typeof(CommonSystem_PathToCommonSystem)!=='undefined')
{CommonSystem.PathToCommonSystem=CommonSystem_PathToCommonSystem;CommonSystem_PathToCommonSystem=undefined;}
if(typeof(CommonSystem_URLRoot)!=='undefined')
{CommonSystem.URLRoot=CommonSystem_URLRoot;CommonSystem_URLRoot=undefined;}
