<!--
/**
 * @name - LightwareBrowserDetection.js
 * @author - Rene Stephan Dettelbacher
 * @create - 05.10.2006
 * @modify - 26.11.2006
 * @state - RELEASED
 *
 * Copyright (c) by Rene Stephan Dettelbacher, 2004 - 2006 all rights reserved
 */

function LightwareCheckBrowser(){
	var browser=navigator.userAgent;
	var userAgent=0;
	if (browser.indexOf('Gecko')!=-1 && browser.indexOf('Safari')==-1){
		userAgent=101;
	}else if (browser.indexOf('MSIE')!=-1){
		if (browser.indexOf('7.0')!=-1){
			userAgent=204;
		}else if (browser.indexOf('6.0')!=-1){
			userAgent=203;
		}else if (browser.indexOf('5.5')!=-1){
			userAgent=202;
		}else if (browser.indexOf('5.0')!=-1){
			userAgent=201;
		}
	}else if (browser.indexOf('Opera')!=-1 || window.opera){
		userAgent=301;
	}else if (browser.indexOf('Safari')!=-1){
		userAgent=401;
	}
	LW['Browser']=userAgent;
	return ''+userAgent;//enshure string
}
function LightwareCheckBrowser2(){

	var userAgent=0;
//zum integrieren
/* Autor, Entwicklung 8/2002 Kristof Lipfert Duesseldorf Version 2005-12-09 */
if(document.ids)x='nc4';
else if( document.all && !document.getElementById )x='ie4';
else if( window.opera && !document.createElement )x='op5';
else if( window.opera && window.getComputedStyle )  {
          if(document.createRange)x='op8';
            else if(window.navigate)x='op7.5';
                             else x='op7.2';                   }
else if( window.opera && document.compatMode )x='op7';
else if( window.opera && document.releaseEvents )x='op6';
else if( document.contains && !window.opera )x='kq3';
else if(window.pkcs11&&window.XML)x='f15';
else if( window.getSelection && window.atob )x='nn7';
else if( window.getSelection && !document.compatMode )x='nn6';
else if( window.clipboardData && document.compatMode )
  x=window.XMLHttpRequest? 'IE7' : 'IE6';
else if( window.clipboardData ){x='ie5';
     if( !document.createDocumentFragment ) x+='.5';
     if( document.doctype && !window.print ) x+='m';}
else if( document.getElementById && !document.all ) x='op4';
else if( document.images && !document.all ) x='nn3';
else if(document.clientWidth&&!window.RegExp)x='kq2';
else x='???';
	return ''+userAgent;
}

/**
 * create global namespace for all Lightware applications
 */
var Lightware={
	$:function(ElementName){
		return document.getElementById(ElementName);
	},
	GetMiddleOfScreen:function(){
		var position=new Array();
		if (!isset(window.pageXOffset)){//IE
			var body=document.getElementsByTagName('body')[0];
			position=new Array(body.offsetWidth/2+body.scrollLeft,body.offsetHeight/2+body.scrollTop);
		}else{
			position=new Array(window.innerWidth/2+window.pageXOffset,window.innerHeight/2+window.pageYOffset);
		}
		return position;
	},
	AddStyleClass:function(StyleClass,Element){
		if (is_object(Element)){
			var className=Element.className;
			if (isset(className) && className.indexOf(StyleClass)==-1){
				Element.className=trim(Element.className+' '+StyleClass);
			}
			return true;
		}
		return false;
	},
	RemoveStyleClass:function(StyleClass,Element,All){
		if (is_object(Element)){
			if (isset(All) && All){
				Element.removeAttribute('class');
			}else{
				var classNames=Element.className;
				if (!isset(classNames)) return true;
				classNames=classNames.split(' ');
				var newClassNames=new Array();
				for(var i=0;i<classNames.length;i++){
					if (classNames[i]!=StyleClass){
						newClassNames[newClassNames.length]=classNames[i];
					}
				}
				if (newClassNames.length==0) Element.className='';
				else Element.className=newClassNames.join(' ');
			}
			return true;
		}
		return false;
	},
	FindNextElement:function(ElementName,Element){
		ElementName=ElementName.toUpperCase();
		if (!isset(Element) || !is_object(Element.nextSibling)) return null;
		while(Element.nextSibling){
			if (Element.nextSibling.nodeName==ElementName) return Element.nextSibling;
			if (is_object(Element.nextSibling)) Element=Element.nextSibling;
			else break;
		}
		return null;
	},
	FindPreviousElement:function(ElementName,Element){
		ElementName=ElementName.toUpperCase();
		if (!isset(Element) || !is_object(Element.previousSibling)) return null;
		while(Element.previousSibling){
			if (Element.previousSibling.nodeName==ElementName) return Element.previousSibling;
			if (isset(Element.previousSibling)) Element=Element.previousSibling;
			else break;
		}
		return null;
	},
	GetEvent:function(EventArgs){
		if (!is_object(EventArgs)){//IE
			return window.event;
		}
		return EventArgs;
	},
	KillEvent:function(EventArgs){
		EventArgs.cancelBubble=true;
		if(EventArgs.preventDefault){//MOZILLA
			EventArgs.preventDefault();
		}
		delete(EventArgs);
	}
}


/**
 * Global array to communicate between different components
 */
var LW=new Array();
/**
 * @index Ajax - global access to the ajax objects
 */
LW['Ajax']=new Array();
/**
 * @index Browser - the currently used browser of the client
 */
LW['Browser']=1;
/**
 * @index CssFiles - the name of a cssfile that has allready been appended on the screen
 */
LW['CssFiles']=new Array();
/*/
 * @index DragElements - objects that are used as container for drag and drop functionallity
 */
LW['DragElements']=new Array();
/**
 * @index GoodBrowser - indicates that a browser is supported without telling which browser currently renders the site
 *    if this is false advanced javascriptcode is not executed
 */
LW['GoodBrowser']=false;
/**
 * @index JavaScriptFiles - the name of a jsfile that has allready been appended on the screen
 */
LW['JavaScriptFiles']=new Array();
/**
 * @index Window - global access to the LightwareWindow
 */
LW['Window']=null;
/**
 * @index WindowItems - global reference for all LightwareWindowItems
 */
LW['WindowItems']=new Array();
LightwareCheckBrowser();

//-->