var syn={
	timer:null,
	sfEls:null,//Array for 1st level nav elements
	onchangeProductEls:null, // Array for product finder select boxes with onchange event
	mapImgPath:'/de/pics/',
	mapPics:new Array,
	ww_button:null,
	ww_layer:null,
	isOpenLayer:false,
	overLayer:false,
	isPopup:false, // is set to true when print preview popup is opened
	printPopupWidth:700,
	printPopupHeight:500,
	

/**************************************************************************************************
** Initialize Scripts - is this a browser that understands DOM?
**************************************************************************************************/
	scriptInit:function() {
		if (!document.getElementById) {
			return false;
		}else{
			return true;
		}
	},

/************************************************************************************************
** Set up Event Listener - the script that allows us to use the addEvent call below
*************************************************************************************************/

	addEvent:function(elm, evType, fn, useCapture) {
		if (elm.addEventListener) {
			elm.addEventListener(evType, fn, useCapture);
			return true;
		} else if (elm.attachEvent) {
			var r = elm.attachEvent('on' + evType, fn);
			return r;
		} else {
			elm['on' + evType] = fn;
		}
	},
	
	log:function(string){
		if (typeof(console)=="undefined"){
        	alert(string);
		}else{
			console.log(string);
	    }
	},
	
/***********************************************************************************************
** helper functions:
** $: get object
** getElementsByClass: does what the function name says
** changeClass: add, remove, swap, check classes for an object
************************************************************************************************/

	$:function() {
		var elements = new Array();
		for (var i = 0; i < arguments.length; i++) {
			var element = arguments[i];
			if (typeof element == 'string'){
				if(document.getElementById(element)){
					element = document.getElementById(element);
				}
			}
			if (arguments.length == 1){
				if (typeof element == 'object'){
					return element;
				}else{
					return false;
				}
			}
			if (typeof element == 'object'){
				elements.push(element);
			}
		}
		return elements;
	},
	
	getElementsByClass:function(searchClass,node,tag) {
		var classElements = new Array();
		if ( node == null )
			node = document;
		if ( tag == null )
			tag = '*';
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		
		var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) {
				classElements[j] = els[i];
				j++;
			}
		}
		return classElements;
	},
	/* AG: getting the left and top cooardinates of an object */
	getObjectPosition  : function (G)
	{
			var F, K, M, N, J = (document.body || document.documentElement); 
			G = syn.$(G); 
			if(G == J) {
				return[0, 0]
			}
			if(G.getBoundingClientRect) 
			{
				M = G.getBoundingClientRect(); 
				N = syn.objectPosition_GetScroll(document); 
				return[M.left + N.left, M.top + N.top]
			}
			var OO = 0, L = 0; F = G; 
			var E = getCssValue (G, "position") == "absolute"; 
			while(F) {
				OO += F.offsetLeft; L += F.offsetTop; if(!E && getCssValue (F, "position") == "absolute") 
				{
					E = true
				}
				if(CurrentNavigator.isGecko) 
				{
					K = C(F); 
					var P = parseInt (getCssValue (K, "borderTopWidth"), 10) || 0; 
					var H = parseInt(getCssValue (K, "borderLeftWidth"), 10) || 0; 
					OO += H; 
					L += P; 
					if(F != G && getCssValue (K, "overflow") != "visible") 
					{
						OO += H; 
						L += P
					}
				}
				F = F.offsetParent
			}
			if(CurrentNavigator.isSafari && E) 
			{
				OO -= J.offsetLeft; 
				L -= J.offsetTop
			}
			if(CurrentNavigator.isGecko &&!E) 
			{
				var I = syn.objectPosition_C(J); 
				I = J;
				OO += parseInt(getCssValue (I, "borderLeftWidth"), 10) || 0; 
				L += parseInt(getCssValue (I, "borderTopWidth"), 10) || 0
			}
			F = G.parentNode; 
			while(F && F != J) {
				if(!CurrentNavigator.isOpera || (F.tagName != "TR" && getCssValue(F, "display") != "inline")
			) 
			{
				OO -= F.scrollLeft; L -= F.scrollTop
			}
			F = F.parentNode
			}
			return[OO, L];
		},
	
	objectPosition_C : function (E)
	{
		var B = new ObjectPosition_FlyWeight();
		B.dom = E;
		return B;
	}, 
	
	objectPosition_GetScroll : function (d)
	{
		var doc = document;
		if (d==doc || d == doc.body)
		{
			var l, t;
			if (CurrentNavigator.isIE && CurrentNavigator.isStrict)
			{
				l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);
				t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);
			}
			else 
			{
				l = window.pageXOffset || (doc.body.scrollLeft || 0);
				t = window.pageYOffset || (doc.body.scrollTop || 0);
			}
			return { left: l, top : t};
		}
		else 
		{
			return { left: d.scrollLeft, top : d.scrollTop };
		}
	}, 
		         
	
/*****************************************************************************************
** This function takes four parameters:
** a defines the action you want the function to perform.
** O the object in question.
** c1 the name of the first class
** c2 the name of the second class
**
** Possible actions are:
** swap replaces class c1 with class c2 in object o.
** add adds class c1 to the object o.
** remove removes class c1 from the object o.
** check tests if class c1 is already applied to object o and returns true or false.
******************************************************************************************/
	
	changeClass:function(a,o,c1,c2){
		switch(a){
			case 'swap':
				o.className=!syn.changeClass('check',o,c1)?o.className.replace(c2,c1) : o.className.replace(c1,c2);
			break;
			case 'add':
				if (!syn.changeClass('check',o,c1)){o.className+=o.className ? ' ' + c1 : c1;}
			break;
			case 'remove':
				var rep=o.className.match(' ' + c1) ? ' ' + c1 : c1;
				o.className = o.className.replace(rep,'');
			break;
			case 'check':
				return new RegExp('\\b' + c1 + '\\b').test(o.className)
			break;
		}
	},

/********************************************************************************
** take url, extract get parameters
********************************************************************************/
	receiveGetString:function(){
		query = self.location.search;
		sammlung = new Array();
		if (query != ''){
			query = query.substr(1, query.length - 1);
			query = query.replace(/%26/,'&');
			teile = query.split('&');
			for (i = 0; i < teile.length; i++){
				teile[i] = teile[i].split('=');
				if (teile[i][0] == "status" && teile[i][1] == "print"){
					syn.setActiveStyleSheet("print");
					syn.isPopup = true;
					/*var allCSSLinks = document.getElementsByTagName('link');
					for (var j=0;j<allCSSLinks.length;j++){
						
						if (allCSSLinks[j].getAttribute("media") != 'print'){
							allCSSLinks[j].getAttribute("media") = 'handheld';
						}else{
							allCSSLinks[j].disabled = false;
						}
					}*/
				}else{
					syn.isPopup = false;
				}
			}
		}
	},
	
	
	setActiveStyleSheet:function (title) {
		var i, a, main;
		for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
				a.disabled = true;
				if(a.getAttribute("title") == "default") a.disabled = false;
				if(a.getAttribute("title") == title) a.disabled = false;
			}
		}
	},

	getActiveStyleSheet:function () {
		var i, a;
		for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
		}
		return null;
	},

/***********************************************************************************
** navigation functions
** hoverNavItem: mouseover and mouseout behaviour of element 
** id: number value for the image to be changed
** suffix: a = mouseover, i = mouseout
** image suffixes: _i=inactive,_h=hover,_ti=temp inactive (pic in front of active nav item - no right pipe)
***********************************************************************************/
	
	hoverNavItem:function(id,suffix){
		var aktItem = syn.$('navImg_'+(id+1));
		var itemBefore = syn.$('navImg_'+(id));
		var itemAfter = (id+2 < syn.sfEls.length)? syn.$('navImg_'+(id+2)) : null;
		if (suffix=="a"){ // change to mouseover status
			aktItem.src = aktItem.src.replace(new RegExp("_i"), "_h");
			aktItem.src = aktItem.src.replace(new RegExp("_ti"), "_h");
			itemBefore.src = (id>0) ? itemBefore.src.replace(new RegExp("_i"), "_ti") : itemBefore.src;
			
			//Current image 
			var imageIndex = parseInt (i);
			var currentItemImage = syn.$("navImg_" + String (imageIndex));
			if (currentItemImage)
				currentItemImage.src = currentItemImage.src.replace (new RegExp (String(imageIndex) + ".gif"), String(imageIndex) + "_over.gif");
			/* AG: put an iframe behind the menu item in order to move it over elements like
				OBJECT, SELECT etc. 
				*/
			//Background iframe
			var isIE = (document.all? true : false);
			var bgIframe = syn.$("background_subnav_" + id);
			if (!bgIframe)
			{
				bgIframe = document.createElement ("IFRAME");
				bgIframe.id = "background_subnav_" + id;
				bgIframe.style.position = "absolute";
				bgIframe.style.visibility = "hidden";
				bgIframe.style.fontSize = "1px";
				bgIframe.frameborder = "no";
				bgIframe.scrolling = "no";
				var container = syn.$("subnav_" + id);
				if (container)
					container.parentNode.appendChild (bgIframe);
				
			}
			var menuItem = syn.$("subnav_" + String(parseInt(id)+1));
			//if (!isIE) menuItem = syn.$("subnav_" + String(parseInt(id+2)));
				
			if (bgIframe && menuItem)
			{
				menuItem.style.zIndex = "1001";
				menuItem.style.display = "block";
				bgIframe.style.zIndex = "1000";
				bgIframe.style.visibility = "visible";
				var left = 0;
				var top = 0;
				
				if (!isIE)
				{
					var aHref = syn.$("nav_" + String (parseInt(id)+1));
					var offsetParent = aHref.parentNode.parentNode.parentNode.parentNode;
					left = offsetParent.offsetLeft;
					top = "20";
				}
				else
				{
					left =menuItem.previousSibling.offsetParent.offsetLeft;
					top = menuItem.offsetTop;
				}
				bgIframe.style.left = left + "px";
				bgIframe.style.top = top + "px";
				//document.title = menuItem.offsetHeight + ", " + menuItem.offsetWidth;
				
				
				bgIframe.style.height = String(parseInt (menuItem.offsetHeight)-1) + "px";
				bgIframe.style.width = menuItem.offsetWidth + "px";
				
				
			}
			
		}else if (suffix=="i"){ // change to mousout status
			if (itemAfter != null && syn.changeClass('check',itemAfter,'activeNavImg')){
				aktItem.src = aktItem.src.replace(new RegExp("_h"), "_ti");
			}else{
				aktItem.src = aktItem.src.replace(new RegExp("_h"), "_i");
			}
			if (!syn.changeClass('check',aktItem,'activeNavImg')){
				itemBefore.src = (id>0) ? itemBefore.src.replace(new RegExp("_ti"), "_i") : itemBefore.src;
			}
			
			//Background iframe
			var bgIframe = syn.$("background_subnav_" + id);
			var menuItem = syn.$("subnav_" + id);
			if (bgIframe)
				bgIframe.style.visibility = "hidden";
		}
	},
	changeSrc:function(o,c1,c2){
		o.src = o.src.replace(new RegExp(c1), c2);
	},
	preloadImages:function(){
		for (var i=0; i<syn.sfEls.length; i++) {
			syn.mapPics[i] = new Image();
			syn.mapPics[i].src = syn.mapImgPath+'map'+i + '.gif';
		}
	},
/***********************************************************************************
** init main navigation:
** set correct images (especially regarding pipes in front of active or hover status
** provide onmouseover and onmouseout eventhandlers
***********************************************************************************/
	initMainNav:function(){
		syn.sfEls = syn.getElementsByClass('level1');
		for (var i=0; i<syn.sfEls.length; i++) {
			syn.sfEls[i].tempId = i;
			var navItem = syn.$('navImg_'+(i+1));
			var navItem2 = syn.$('navImg_'+i);
			if (syn.changeClass('check',navItem,'activeNavImg')){
				navItem2.src = (i>0) ? navItem2.src.replace(new RegExp("_i"), "_ti") : navItem2.src;
			}
			
			syn.sfEls[i].onmouseover=function() {
				this.className+=" synHover";
				syn.hoverNavItem(this.tempId,"a");
				
			}
			syn.sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" synHover\\b"), "");
				syn.hoverNavItem(this.tempId,"i");
			}
		}
	},
/***********************************************************************************
** init worldwide layer:
** close layer on any click in document if mouse is not over layer
** provide onmouseover and onmouseout eventhandlers for layer, button to open layer, close button
** handle events for continents (mouseover, mouseout, click)
***********************************************************************************/
	initWorldwideLayer:function(){
		syn.parseWorldwideLinks();
		document.onclick=function(){
			if (syn.isOpenLayer && !syn.overLayer){
				syn.changeSrc(syn.ww_button,'_a','_i');
				syn.closeWorldLayer();
			}
		}
		syn.ww_layer = syn.$('worldWideLayer');
		syn.ww_layer.onmouseover=function(){
			syn.overLayer = true;
		},
		syn.ww_layer.onmouseout=function(){
			syn.overLayer = false;
		},
		syn.ww_button = syn.$('btSyngentaWorldwide');
		syn.ww_button.onmouseover = function(){
			syn.overLayer = true;
			syn.changeSrc(this,'_i','_h');
		}
		syn.ww_button.onmouseout = function(){
			syn.overLayer = false;
			syn.changeSrc(this,'_h','_i');
		}
		syn.ww_button.onclick = function(){
			if (syn.changeClass('check',syn.ww_layer,'hiddenLayer')){
				syn.changeSrc(this,'_h','_a');
				syn.isOpenLayer = true;
			}else{
				syn.changeSrc(this,'_a','_h');
				syn.isOpenLayer = false;
			}
			syn.showContinent(0);
			syn.changeClass('swap',syn.ww_layer,'hiddenLayer','visibleLayer');
			
		}
		var closeButton = syn.$('closeWorldLayer');
		closeButton.onclick = function(){
			syn.changeSrc(syn.ww_button,'_a','_i');
			syn.closeWorldLayer();
		}
		syn.ww_continents = syn.getElementsByClass('cont_shape',syn.ww_layer);
		syn.ww_continentsCountries = syn.getElementsByClass('countryListLayer',syn.ww_layer);
		syn.ww_continentLinks = syn.getElementsByClass('continentLink',syn.ww_layer);
		syn.ww_continentsLength = syn.ww_continents.length;
		for (var i=0;i<syn.ww_continents.length;i++){
			var tempArray = syn.ww_continentLinks[i].id.split('_');
			syn.ww_continentLinks[i].tempId = tempArray[1];
			syn.ww_continentLinks[i].onclick= function(){
				syn.showContinent(this.tempId);
				return false;
			}
			syn.ww_continents[i].tempId=i+1;
			syn.ww_continents[i].onmouseover=function(){
				syn.hoverContinent(this.tempId);
			}
			syn.ww_continents[i].onmouseout=function(){
				syn.hoverContinent(0);
			}
			syn.ww_continents[i].onclick=function(){
				syn.showContinent(this.tempId);
				return false;
			}
		}
		
	},
	hoverContinent:function(id){
		syn.$('map_hover').src = syn.mapImgPath +'map' + id + '.gif';
	},
	showContinent:function(id){
		syn.$('map_active').src = syn.mapImgPath +'map' + id + '.gif';
		for (var j =0;j<syn.ww_continentsLength+1;j++){
			if(syn.changeClass('check',syn.ww_continentsCountries[j],'visibleLayer')){
				syn.changeClass('remove',syn.ww_continentsCountries[j],'visibleLayer');
				syn.changeClass('add',syn.ww_continentsCountries[j],'hiddenLayer');
			}
		}
		syn.changeClass('swap',syn.$('countries_' + id),'hiddenLayer','visibleLayer');
	},
	
	closeWorldLayer:function(){
		syn.changeClass('swap',syn.ww_layer,'visibleLayer','hiddenLayer');
		syn.isOpenLayer = false;
	},
	
	parseLabelLinks:function(){
		var allLabelLinks = syn.getElementsByClass('labelLink');
		for (var i=0;i<allLabelLinks.length;i++){
			allLabelLinks[i].onclick=function(){
				window.open(this.href);
				return false;
			}
		}
	},
	parsePrintLinks:function(){
		var allPrintLinks = syn.getElementsByClass('printPage');
		for (var i=0;i<allPrintLinks.length;i++){
			allPrintLinks[i].onclick = function(){
				if (syn.changeClass('check',this,'printPopup') && (!syn.isPopup)){
					//var url = (this.getAttribute) ? this.getAttribute('href') : this.href;
					var url = document.location.href+"?status=print";
					if (!url) return true;
					syn.openPopup(url,'pp',syn.printPopupWidth,syn.printPopupHeight);
					return (document.fenster) ? false : true;
				}else{
					self.print();
					return false;
				}
			}
		}
	},
	parseWorldwideLinks:function(){
		var allWWLinks = syn.getElementsByClass('worldwideLink');
		for (var i=0;i<allWWLinks.length;i++){
			allWWLinks[i].onmouseover = function(){
				syn.overLayer = true;
			}
			allWWLinks[i].onmouseout = function(){
				syn.overLayer = false;
			}
			allWWLinks[i].onclick = function(){
				if (syn.changeClass('check',syn.ww_layer,'hiddenLayer')){
					syn.changeSrc(syn.ww_button,'_h','_a');
					syn.isOpenLayer = true;
					syn.showContinent(0);
					syn.changeClass('swap',syn.ww_layer,'hiddenLayer','visibleLayer');
				}
				
			}
		}
		return false;
	},
	parseCloseLinks:function(){
		var allCloseLinks = syn.getElementsByClass('closePopup');
		for (var i=0;i<allCloseLinks.length;i++){
			allCloseLinks[i].onclick = function(){
				window.close();
				return false;
			}
		}
	},
	parseCSSLinks:function(){
		var allCSSLinks = document.getElementsByTagName('link');
		for (var i=0;i<allCSSLinks.length;i++){
			
			if (allCSSLinks[i].getAttribute("media") == 'all');
			allCSSLinks[i].disabled = true;
			//console.log(allCSSLinks[i].getAttribute("media"));
		}
	},
	validateContactForm:function(){
		if (syn.$('txtName').value.length < 1) {
			alert("Please enter your name");
		}else if (syn.$('txtFrom').value.indexOf("@") == -1 || 
		syn.$('txtFrom').value.indexOf(".") == -1 || 
		syn.$('txtFrom').value.length < 7){
			alert("Please enter a valid email address");
		}else if (document.syng_email.optCountry[document.syng_email.optCountry.selectedIndex].value == ""){
			alert("Please select a country");
		}else if (syn.$('txtMessage').value.length < 1){
			alert("Please enter a message");
		}else{
			syn.$('new_optCountry').value = document.syng_email.optCountry[document.syng_email.optCountry.selectedIndex].value;
			syn.$('syng_email').submit();
		}
	},
	initContactSubmit:function(){
		syn.$('syng_email').onsubmit = function(){
			syn.validateContactForm();
			return false;
		};
	},
	validateSelectContactForm:function(){
		if (document.contact1.contacts[document.contact1.contacts.selectedIndex].value == "") {
			alert("Please select a contact!");
		} else {
			syn.$('current_contact').value = syn.$('contact1').contacts[syn.$('contact1').contacts.selectedIndex].value;
			syn.$('current_contactname').value = syn.$('contact1').contacts[syn.$('contact1').contacts.selectedIndex].text;
			syn.$('contact1').submit();
			return false;
		}
	},
	initSelectContactSubmit:function(){
		syn.$('contacts').onchange = function(){
			syn.validateSelectContactForm();
			return false;
		};
		syn.$('selectContactSubmit').onclick = function(){
			syn.validateSelectContactForm();
			return false;
		};
	},
	/* popup function for print preview */
	popdown:function() {
		if (document.fenster && !document.fenster.closed) document.fenster.close();
	},
	openPopup:function(adresse,name,breite,hoehe) {
		document.fenster = null;
		window_left = (screen.width-breite)/2;
		window_top = (screen.height-hoehe)/2;
		syn.popdown();
		document.fenster=window.open(adresse,name,"width="+breite+",height="+hoehe+",top="+window_top+",left="+window_left+",resizable=yes,scrollbars");
		document.fenster.focus();
		if (name=='pp') document.fenster.print();
		//console.log(document.fenster);
	},
	/* popup function for regular popups - taken from original js */
	openwin:function (url,w,h,s,r) {
	    var scrl; var resze;
    	if (s) { scrl="scrollbars=yes,"; w = w+16;} 
		else { scrl="scrollbars=no,"; }
		if (r) { resze = "resizable=yes,"; }
		else { resze="resizable=no,"; }
    	if (!w) w = 449;
    	if (!h) h = 270;
		document.fenster = window.open(url,"_blank",scrl+resze+"width="+w+",height="+h+",screenX=200,screenY=50");
		document.fenster.referrer = window;	
    	document.fenster.focus();
	},
	
	initSearchField:function(){
		syn.searchField = syn.$('inputSearch');
		syn.searchField.onfocus = function(){
			if(this.value == 'Search') this.value = '';
			syn.changeClass('add',this,'textfieldActive');
		}
		syn.searchField.onblur = function(){
			if(this.value == '') this.value = 'Search';
			syn.changeClass('remove',this,'textfieldActive');
		}
	},
		
	
/**************************************************************************
**	main init function
** add functions you want to execute on load
***************************************************************************/

	init:function(){
		if(syn.scriptInit){
			//if(startBereich != undefined) syn.receiveGetString();
			if(syn.$('ulNav')) syn.initMainNav();
			if(syn.$('btSyngentaWorldwide')) syn.initWorldwideLayer();
			if(syn.$('inputSearch')) syn.initSearchField();
			if(syn.$('syng_email')) syn.initContactSubmit();
			if(syn.$('contact1')) syn.initSelectContactSubmit();
			syn.receiveGetString();
			syn.parseLabelLinks();
			syn.parsePrintLinks();
			syn.parseCloseLinks();
			//syn.parseCSSLinks();
		}
	}
}
syn.addEvent(window, 'load', syn.init, false);

/**************************************************************************
**	Stock ticker XML Parsing Function
***************************************************************************/
/*
function loadXMLDoc(dname) 
{
try //Internet Explorer
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  }
catch(e)
  {
  try //Firefox, Mozilla, Opera, etc.
    {
    xmlDoc=document.implementation.createDocument("","",null);
    }
  catch(e) {alert(e.message)}
  }
try 
  {
  xmlDoc.async=false;
  xmlDoc.load(dname);
  return(xmlDoc);
  }
catch(e) {alert(e.message)}
return(null);
}
*/

var http;
var xmldata;

function loadXMLDoc(xmldoc) {
    http = false;
    if (window.XMLHttpRequest) {
        try {
            http = new XMLHttpRequest();
            if (http.overrideMimeType) {
                http.overrideMimeType('text/xml');
            }
        } catch (e) {
            alert(e.message);
        }
    } else if (window.ActiveXObject) {
        try {
            http = new ActiveXObject('Msxml2.XMLHTTP');
        } catch (e) {
            try {
                http = new ActiveXObject('Microsoft.XMLHTTP');
            } catch (e) {
                alert(e.message);
            }
        }
    } else {
        alert(e.message);
        return false;
    }

    http.onreadystatechange = function() 
    {
        if (http.readyState == 4) {
            xmldata = http.responseXML;
        }
    }
    http.open('GET', xmldoc, true);
    http.send(null);
    return xmldata;
}

/** Popup Funktion**/
function openPopup(url, width, height, winname) {
	
   //Check if this is an old lexikon link 
   // try {
   var ordner = "/schadorganismen/";
   if (url!=null)	{
    var part1 = url.substr(0,ordner.length);
	if(part1 == ordner) //Old link	{
        var pos_last = url.lastIndexOf("/");
		if (pos_last > 0 && (pos_last+1)< (url.length-1))	{
            var file_name = url.substr(pos_last+1);
			if (file_name.length>=4)	{
                if (file_name.substr(file_name.lastIndexOf(".")+1)=="htm")	{
                    //get id
					var id = file_name.substr(0,file_name.length-4);
					//get folder
					var part2 = url.substr(part1.length);
					var imgFolder = part2.substr(0,part2.indexOf("/"));
					openLexikonPopup1(id,imgFolder);	
					return;
					}
                }
            }
        }
    ///  END CHECK ////////////////////////////
   var old = self;
   var trails="width=" + width + ",height=" + height + ",toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no";
   newWindow1=window.open(url,winname,trails);
   newWindow1.focus();
}

/*
* Ext JS Library 2.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
* 
* http://extjs.com/license
*/
CurrentNavigator = {
	ua			: navigator.userAgent.toLowerCase ()
	,isStrict	: document.compatMode == "CSS1Compat"
}

with (CurrentNavigator)
{
	isOpera		=	ua.indexOf("opera") >- 1;
	isSafari	=	(/webkit|khtml/).test(ua);
	isSafari3	=	isSafari && ua.indexOf("webkit/5")!=-1;
	isIE		=	!isOpera && ua.indexOf("msie")>-1;
	isIE7		=	!isOpera && ua.indexOf("msie 7")>-1;
	isGecko	=	!isSafari && ua.indexOf("gecko")>-1;
	isGecko3	=	!isSafari	&&	ua.indexOf("rv:1.9")>-1;
	isBorderBox=	isIE && !isStrict;
	isWindows	=	(ua.indexOf("windows")!=-1 || ua.indexOf("win32")!=-1);
	isMac		=	(ua.indexOf("macintosh")!=-1 || ua.indexOf("mac os x")!=-1);
	isAir		=	(ua.indexOf("adobeair")!=-1);
	isLinux	=	(ua.indexOf("linux")!=-1);
	isSecure	=	window.location.href.toLowerCase().indexOf("https")===0;
}