
	function PageProperties()
	{
		this.DefaultResolution = 1280;
		this.CurrentResolution = 1280;
		this.BrowserResolution = 1280;
		this.SupportedResolutions = new Array(1280,1024);
		this.MaxResolution = 1280;
		
		this.DefaultLanguage = "de";
		this.CurrentLanguage = "de";
		this.BrowserLanguage = "de";
		this.SupportedLanguages = new Array("de","en","fr","hu","it","pt","ru"); 
		
		this.DefaultPage = "../index.html";	
		
		this.FrameMain =	null;	
		this.FrameLeftMenu = null;
		this.FrameContent = null;
	}
	
	
	function PageController(pageProps)
	{
		this.PageProps = pageProps;
		
	
		try{
			this.PageProps.FrameMain =	top.frames['main'];	
			this.PageProps.FrameLeftMenu = top.frames['main'].frames['IfMenu3'];
			this.PageProps.FrameContent =  top.frames['main'].frames['IfMainArea'];	
		}
		catch(exception)
		{
		}
		
		
		try{
			if(navigator.language) 					this.PageProps.BrowserLanguage = navigator.language;		
			else if(navigator.BrowserLanguageuage) 	this.PageProps.BrowserLanguage= navigator.BrowserLanguageuage;	 
			else if(navigator.systemLanguage) 		this.PageProps.BrowserLanguage= navigator.systemLanguage;		
			else if(navigator.userLanguage) 		this.PageProps.BrowserLanguage= navigator.userLanguage;	 
			else 									this.PageProps.BrowserLanguage= "de";
			
		}
		catch(exception)
		{
		}
		
	
		try{
			if(screen != null && screen.width != null)  this.PageProps.BrowserResolution = screen.width;
			else  										this.PageProps.BrowserResolution = "1280";
		}
		catch(exception)
		{
		}
		
		
		
		this.IsLanguageSupported = function(lang)
		{
			if(lang== null || lang.length == 0)
				return false;
	
			for(var i=0; i < this.PageProps.SupportedLanguages.length; i++)
			{
				if(this.PageProps.SupportedLanguages[i].indexOf(lang) != -1)
					return true;
			}
			
			return false;
		}
		
		this.IsBrowserLanguageSupported = function()
		{
			return this.IsLanguageSupported(this.PageProps.BrowserLanguage);
		}
		
		this.IsResolutionSupported = function(res)
		{
			if(res== 0 || res== null)
				return false;
				
			var newRes = parseInt(res);
		
			for(var i=0; i < this.PageProps.SupportedResolutions.length; i++)
			{
				if(this.PageProps.SupportedResolutions[i] == newRes)
					return true;
			}
			
			return false;
		}
		
		this.IsBrowserResolutionSupported = function()
		{
			return this.IsResolutionSupported(this.PageProps.BrowserResolution);
		}
		
		this.ChangeLanguage = function(lang)
		{
			var newLang = lang;
			
			if(newLang != this.PageProps.CurrentLanguage)
			{
				if(!this.IsLanguageSupported(newLang))
					newLang = this.PageProps.DefaultLanguage;
			
				
				top.frames['main'].location.href = newLang + "/index" + this.PageProps.CurrentResolution +".html";
				this.PageProps.CurrentLanguage = newLang;
			}		
		}

		this.FindBestLanguage = function()
		{
			if(this.IsLanguageSupported("en"))
			  return "en";
			else
			  return this.PageProps.DefaultLanguage;
		}
		
		this.ChangeResolution = function(res)
		{
			var newRes = parseInt(res);
			
			if(newRes == this.PageProps.CurrentResolution || newRes > this.PageProps.MaxResolution )
				return;
				
			if(!this.IsResolutionSupported(newRes))
				newRes =  this.PageProps.DefaultResolution;
			
			top.frames['main'].location.href = "index" + newRes +".html";
			this.PageProps.CurrentResolution = newRes;
		}

		this.FindBestResolution = function()
		{
			var newRes = this.PageProps.MaxResolution;			
				
			if(!this.IsResolutionSupported(newRes))
				newRes =  this.PageProps.DefaultResolution;
			
			return newRes;
		}


		this.FindBestLangAndRes = function()
		{
			var redirectUrl = null;

			if( this.PageProps.BrowserLanguage == this.PageProps.DefaultLanguage &&  this.PageProps.BrowserResolution == this.PageProps.DefaultResolution)
			{
		   		//for de users with 1280 res, nothing to do
			
			}
			if( this.PageProps.BrowserLanguage == this.FindBestLanguage() &&  this.PageProps.BrowserResolution == this.FindBestResolution())
			{
		   		//for all where current settings is the suitablest, nothing do to
			
			}
			else if( !this.IsBrowserResolutionSupported() && !this.IsBrowserLanguageSupported() )
			{
		   		//for absolute not supportet client settings (language & resolution)
				redirectUrl = this.FindBestLanguage() + "/index" + this.FindBestResolution() +".html";				
			}
			else if( this.IsBrowserLanguageSupported() )
			{
		   		//language is ok, find the correct resolution
		   		redirectUrl = this.PageProps.CurrentLanguage + "/index" + this.FindBestResolution() +".html";
			}
			else if( this.IsBrowserLanguageSupported() )
			{
		   		//resolution ok, find the correct language
		   		redirectUrl = top.frames['main'].location.href = this.FindBestLanguage() + "/index" + this.PageProps.CurrentResolution +".html";
			}
			else
			{
		   		//upps...  keep as it is
			}


			//redirect if usefull
			if(redirectUrl != null && ("/" + redirectUrl) != top.frames['main'].location.pathname)
			{
			   top.frames['main'].location.href = redirectUrl;
			}


		}

	}
	
	
	

function SetActiveStyleSheet()
{
	window.setTimeout("InternalSetActiveStyleSheet()",2);
}

	
	
function InternalSetActiveStyleSheet()
{
	var doc = null;
	var res = 1280;
	
	if(top._PageProperties != null)
		res = top._PageProperties.CurrentResolution;
	
	 top.activeStyle= res; 
		 
	 for(var i=0; (doc = document.getElementsByTagName("link")[i]); i++)
	 {
  		if(doc.getAttribute("rel").indexOf("style") != -1 && doc.getAttribute("title") && doc.getAttribute("title") != "static")
	 	{		 		
	  		doc.disabled = true;
	   
			if(doc.getAttribute("title") == res)
			{
				doc.disabled = false;
			}
		}
	}	
	

}

function ChangeRes(res)
{
	if(top._PageController != null)
	{
		top._PageController.ChangeResolution(res);
	}
	else
	{		
		var newRes = parseInt(res);
		if(newRes == 0 || newRes == null) newRes = Site.DefaultResolution;	
		else if (newRes >= 1280) newRes = 1280;		
		else newRes = 1024;
		

		
		top.frames['main'].location.href = "index" + newRes +".html";
	}
}

function SetResolution(res)
{
	if(top._PageController != null && top._PageController.IsResolutionSupported(res))
	{
		top._PageController.PageProps.CurrentResolution = res;
	}
	
	
}
	
//Navigation
function SetSubMenu(page)
{
	if(top.frames['main']!=null && top.frames['main'].frames['IfMenu3'] != null)
		top.frames['main'].frames['IfMenu3'].location.href = page;
	else if(top.frames['IfMenu3'] != null)
		top.frames['IfMenu3'].location.href = page;
	else
		top.frames[1].location.href = page;
}

function SetContentPage(page)
{

	if(top.frames['main']!=null && top.frames['main'].frames['IfMainArea'] != null)
		top.frames['main'].frames['IfMainArea'].location.href = page;
	else if(top.frames['IfMainArea'] != null)
		top.frames['IfMainArea'].location.href = page;
	else
		top.frames[0].location.href = page;
}


function LeftMenuAnimation()
{
	if(document.getElementById('Menu3Container'))
	{
		document.getElementById('Menu3Container').style.display='none';
		window.setTimeout("document.getElementById('Menu3Container').style.display='block';",100);
	}
}


function DisplayResolutionSelector()
{
	if(document.getElementById('ResSelector'))
	{
		document.getElementById('ResSelector').style.display='block';
	}

}

function HideResolutionSelector()
{
	if(document.getElementById('ResSelector'))
	{
		document.getElementById('ResSelector').style.display='none';
	}
}