jQuery( 'html' ).addClass( "js" );

if( typeof ltm !== 'undefined' )
{
	throw new Error( 'ERROR: Namespace already defined.' );
}
else
{
	ltm = {};
}

ltm.storage = {};
ltm.storage._unique = 0;

$.fn.uniqueID = function(options)
{
	this.each(
		function()
		{
			if( jQuery( this ).attr( "id" ) === '' )
			{
				 jQuery( this ).attr( "id", ltm.getUniqueId() );
			}
	});
	return this;
};

ltm.getUniqueId = function ()
{
	ltm.storage._unique ++;
	return "dbgo_unique_id_" + ltm.storage._unique;
};

ltm.gotoGoogleMaps = function ()
{
	var url = "http://maps.google.de/maps?q=Reisholzer+Werftstra%C3%9Fe+31,+Holthausen+40589+D%C3%BCsseldorf,+Nordrhein-Westfalen&hl=de&ie=UTF8&sll=51.151786,10.415039&sspn=23.233557,45.351563&geocode=FYXCDAMdCFVoAA&t=h&z=16";
	window.open( url, "_blank" )
};

ltm.namespace = function(_sNamespace)
{
	var _col = _sNamespace.split('.');
	// set namespace 
	var _oBase = dbgo;
	for( var _i = 0; _i < _col.length; _i++)
	{
		// don't have currend obj
		if( typeof( _oBase[ _col [ _i ] ] ) === 'undefined' )
		{
			// add obj
			_oBase[_col[_i]] = {};
		}
		_oBase= _oBase[_col[_i]];
	}
	return _oBase;
};

if( window.navigator.userAgent.indexOf( "Mac" ) > -1 )
{
	ltm.userSystem = "mac";
} 
if( window.navigator.userAgent.indexOf( "Windows" ) > -1 )
{
	ltm.userSystem = "win";
} 
if( window.navigator.userAgent.indexOf( "Firefox/2" ) > -1 )
{
	ltm.userAgent = "FF2";
}  
if( window.navigator.userAgent.indexOf( "Firefox/3" ) > -1 )
{
	ltm.userAgent = "FF3";
}  
if( window.navigator.userAgent.indexOf( "Firefox/4" ) > -1 )
{
	ltm.userAgent = "FF4";
}  
if( window.navigator.userAgent.indexOf( "Firefox/5" ) > -1 )
{
	ltm.userAgent = "FF5";
}  
if( window.navigator.userAgent.indexOf( "MSIE 6" ) > -1 )
{
	ltm.userAgent = "IE6";
} 
if( window.navigator.userAgent.indexOf( "MSIE 7" ) > -1 )
{
	ltm.userAgent = "IE7";
}
if( window.navigator.userAgent.indexOf( "MSIE 8" ) > -1 )
{
	ltm.userAgent = "IE8";
}
if( window.navigator.userAgent.indexOf( "Opera/9" ) > -1 )
{
	ltm.userAgent = "Opera9";
}
if( window.navigator.userAgent.indexOf( "Opera/10" ) > -1 )
{
	ltm.userAgent = "Opera10";
}
if( window.navigator.userAgent.indexOf( "Opera/11" ) > -1 )
{
	ltm.userAgent = "Opera11";
}
if( window.navigator.userAgent.indexOf( "WebKit" ) > -1 )
{
	ltm.userAgent = "webkit";
}
if( window.navigator.userAgent.indexOf( "Android" ) > -1 )
{
	ltm.userSystem = "Android";
}
if( window.navigator.userAgent.indexOf( "iPad" ) > -1 )
{
	ltm.userSystem = "iPad iOS";
	if( window.innerHeight == 661 )
	{
		
	}
	else
	{
		ltm.userSystem +=" iPadFavBar";
	}
}
if( window.navigator.userAgent.indexOf( "iPhone" ) > -1 )
{
	ltm.userSystem = "iPhone iOS";
}
if( window.navigator.userAgent.indexOf( "iPod" ) > -1 )
{
	ltm.userSystem = "iPod iOS";
}

var DEFAULT_LANGUAGE = "de";
if( window.location.href.indexOf( 'index_en.php' ) >= 0 ) ltm.language = "en";
	else ltm.language = DEFAULT_LANGUAGE;
 
ltm.html5video = !!document.createElement( 'video' ).canPlayType;
ltm.gMapsInitialized = false;
ltm.languages = [ "de", "en" ];
ltm.currentpath = "";
ltm.debug = false;

jQuery( 'html' ).addClass( ltm.userAgent );
jQuery( 'html' ).addClass( ltm.userSystem );
