

window.onerror = function () {return true;}


Array.prototype.shuffle = function()
{
	var i, L;
	i = L = this.length;
	while (i--) {
		var r = Math.floor(Math.random()*L);
		var x = this[i];
		this[i] = this[r];
		this[r] = x;
	}
};


var TabFeaturedClass = Class.create();
TabFeaturedClass.prototype =
{
	
	tabs : new Array(),	
	
	initialize : function ()
	{
	},
	
	run : function ()
	{
		
		this.tabs = $$('#featuredSitesTabs a');
		var tabs_length = this.tabs.length;
		
		if (0 < tabs_length)
		{
			for(var i=0; i<tabs_length; i++)
			{
				Event.observe(this.tabs[i], 'click', function(event) {
					TabFeatured.changeTab(Event.element(event));
				});
 
			}
		}
		
		if (document.location.hash)
		{
			var selected = $$('a[href="' + document.location.hash + '"]');
			if (selected[0])
			{
				this.changeTab(selected[0]);
			}
		}
		
			
	},
	
	
	changeTab : function (element)
	{

		if ('SPAN' == element.nodeName)
		{
			element = element.parentNode;
		}
		var blockId = this.getIdFromHref(element);
		
		if (!blockId)
		{
			return;
		}
		
		
		// hide old
		var oldTab = $('selectedTab');
		oldTab.id = null;
		oldBlockId = this.getIdFromHref(oldTab.firstChild);
		if ($(oldBlockId))
		{
			$(oldBlockId).hide();
			$(blockId).removeClassName('show');
		}
		
		// show new
		element.parentNode.id = 'selectedTab';
		if ($(blockId))
		{
			$(blockId).show();
			$(blockId).addClassName('show');
		}
		
		return false;		
	},
	
	
	getIdFromHref : function (element)
	{
		return element.href.substr(element.href.lastIndexOf('#')+1);
	},
    
    featured : new Array(),
    
    data : {
		catalogueUrl : '',
		catalogueTitle : '',
		categoriesCount : 0,		
		categories : new Array(),
		itemsCount : 0
	},
    
    fill : function ()
    {
		var container = new Element('div');

		var link = new Element('div', { id: 'featuredSitesNavi'});
		link.update('<h4 class="boxTitle"><a href="' + this.data.catalogueUrl + '" rel="nofollow">' + this.data.catalogueTitle + '</a> <span><!-- / --></span></h4>');
		container.appendChild(link);
            
		var tabs = new Element('ul', { id: 'featuredSitesTabs' });
		var content = new Element('div', { id : 'featuredSitesContent', 'class' : 'boxCase' });
            
		var contentBoxCaseIn = new Element('div', { 'class' : 'boxCaseIn' });
		var contentBoxCaseHeader = new Element('div', { 'class' : 'boxCaseHeader'});
		var contentText = new Element('div', { id : 'featuredSitesContentText', 'class' : 'boxText' });
		
		for (i = 1; i <= this.data.categoriesCount; i++)
        {
			var tab = new Element('li');
			if (i == 1)
			{
				tab.setAttribute('id', 'selectedTab');
            }
			tab.update('<a href="#featuredSitesBlock' + parseInt(i) + '" onclick="return false;">' + this.data.categories[i] + '<span><!-- / --></span></a>');
			tabs.appendChild(tab);
            
			var block = new Element('div', { id : 'featuredSitesBlock' + parseInt(i), 'class' : 'featuredSitesBlock' });
            
			var groups = TabFeatured.featured[i];
			
            if (groups)
            {
                
	            var group = groups[Math.floor(Math.random()*groups.length)];
            	group.shuffle();
                
				for (j = 0; j < group.length; j++)
				{
                
					var item = new Element('div', { 'class' : 'featuredItem' });
					item.update(
							'<p><a href="' + group[j]['url'] + '" target="_blank" rel="nofollow"><img src="' + group[j]['img'] + '" width="130" height="109" alt="' + group[j]['title'] + '" /></a></p>' +
							'<p><a href="' + group[j]['url'] + '" target="_blank" rel="nofollow">' + group[j]['title'] + '</a></p>'
					);
					
					block.appendChild(item);
            }
        } 
            
            contentText.appendChild(block);
			
		}
         
		var contentBoxCaseTl = new Element('div', { 'class' : 'boxCaseTL' });
		contentBoxCaseHeader.appendChild(contentBoxCaseTl);
		
		contentBoxCaseHeader.appendChild(contentText);
         
		var contentBoxCaseFooter = new Element('div', { 'class' : 'boxCaseFooter' });
		contentBoxCaseFooter.update('<div class="boxCaseFL"></div>');
		contentBoxCaseHeader.appendChild(contentBoxCaseFooter);
         
		contentBoxCaseIn.appendChild(contentBoxCaseHeader);
		content.appendChild(contentBoxCaseIn);
		
		container.appendChild(tabs);
		container.appendChild(content);
		
		$('featuredSites').update(container);
		
    }
		
}
var TabFeatured = new TabFeaturedClass();




var PromoClass = Class.create();
PromoClass.prototype =
{
	
	images: null,
	
	timing: null,
	
	controllerArea: null,
	
	currentKey: 0,
	
	previousKey: 0,
	
	totalItems: 0,
	 
	timer: null, 
	
	
	initialize: function()
	{
	},
	
	
	getItems: function()
	{
		this.items = $$('.demoTextBlock');
		this.totalItems = this.items.length; 
	},

	
	setTiming: function (timing)
	{
		if (0 < timing)
		{
			this.timing = parseInt((timing*1000), 10);
		}
		
	},
	
	
	run: function ()
	{
		
		this.controllerArea = $('demoTextController');
		this.getItems();
		
		if (null == this.items || null == this.timing || null == this.controllerArea)
		{
			return;
		}
		
		this.createController();
		
		this._next();
		
	},
	
	
	createController: function()
	{
		
		var controllerHandler = new Element('div', {id: 'controllerHandler'});		
		
		for(var i=0; i<this.totalItems; i++)
		{
			var anchorControl = new Element('span', {id: 'control'+(i+1)});
				anchorControl.onmouseover = this.go.bind(this);
				anchorControl.onmouseout = this.play.bind(this);
				anchorControl.setOpacity(0.25);
			controllerHandler.appendChild(anchorControl);
		}
		
		if (1 < this.totalItems)
		{
			this.controllerArea.appendChild(controllerHandler);
		}
		
	},
	
	
	play: function()
	{
		this.timer = setTimeout(this._next.bind(this), this.timing);
		//$('controlSP').className = '';
		//$('controlSP').onclick = this.pause.bind(this);
	},
	
	
	pause: function()
	{
		clearTimeout(this.timer);
		//$('controlSP').className = 'play';
		//$('controlSP').onclick = this.play.bind(this);
	},
	
	
	_next: function()
	{
		
		if (0 == this.currentKey || this.totalItems == this.currentKey)
		{
			if (this.totalItems == this.currentKey)
			{
				this.previousKey = this.currentKey;
			}
			
			this.currentKey = 1;
			
		}
		else
		{
			this.previousKey = this.currentKey;
			this.currentKey++;
		}
		
		if (0 < this.previousKey)
		{
			$('demoTextBlock' + this.previousKey).hide();
			$('demoTextBlock' + this.previousKey).removeClassName('show');
			
			if (1 < this.totalItems)
			{
				$('control' + this.previousKey).setOpacity(0.25);
			}
			
			$('demoTextBlock' + this.currentKey).show();
			$('demoTextBlock' + this.currentKey).addClassName('show');
			
		}
		
		
		if (1 < this.totalItems)
		{
			$('control' + this.currentKey).setOpacity(0.9999);
		}
								
		this.previousKey = this.currentKey;
		
		if (1 < this.totalItems)
		{
			this.timer = setTimeout(this._next.bind(this), this.timing);
		}
				
	},
	
	
	go: function(event)
	{
		
		this.pause();
		
		if (!event)
		{
			event = window.event;
		}
		
		var element = Event.element(event);
		// lol chrome2 ?
		element.setOpacity(0.9999);
		var elID = parseInt(element.id.replace(/control/, ''), 10);
		
		if (this.currentKey == elID)
		{
			return;
		}
		
		this.currentKey = elID;
		
		$('demoTextBlock' + this.previousKey).hide();
		$('demoTextBlock' + this.previousKey).removeClassName('show');

		$('control' + this.previousKey).setOpacity(0.25);
		
		$('demoTextBlock' + this.currentKey).show();
		$('demoTextBlock' + this.currentKey).addClassName('show');
		this.previousKey = this.currentKey;
		
	},
	
	data : {
		items : [],
		title : '',
		titleUrl : '',
		linkTitle : ''
	},
	
	mediaRandView : function (total)
	{
		
		var container = new Element('div');
		
		var title = new Element('h4', { 'class' : 'boxTitle' });
		title.update('<a href="' + this.data.titleUrl + '">' + this.data.title + '</a>');
		container.appendChild(title);
		
		if (this.data.items.length > 0)
		{
					
			var item = this.data.items[Math.floor(Math.random()*this.data.items.length)];
			
			var item_el = new Element('div', { id : 'mediaInfoItem0', 'class' : 'mediaInfoItem' });
			
			var image = '';
			if (item.image)
			{
				image = '<a href="' + item['url'] + '" rel="nofollow"><img src="' + item['image'] + '" alt="" title="' + item['title'] + '" /></a>';
			}
			var item_image = new Element('div', { 'class' : 'mediaImage' });
			item_image.update('<table><tr><td>' + image + '</td></tr></table>');
			item_el.appendChild(item_image)
			
			var item_text = new Element('div', { 'class' : 'mediaText' });
			
			var item_perex = new Element('p');
			item_perex.update(item.perex);
			item_text.appendChild(item_perex);
			
			var item_link = new Element('a', { 'class' : 'moreLink', 'href' : item['url'], 'title' : this.data.linkTitle + ': ' + item['title'], 'rel' : 'nofollow' });
			item_link.update(this.data.linkTitle);
			item_text.appendChild(item_link);
			
			item_el.appendChild(item_text);
	
			container.appendChild(item_el);
			
		}
		
		$('mediaInfoText').update(container);
		
	} 
	
}
var Promo = new PromoClass();




var FormClass = Class.create();
FormClass.prototype =
{
	
	texts : new Array(),
	
	hints : new Array(),
	
	showedHints : null,
	
	projectsData : new Object(),
	
	elementsWithValue : new Array(),
	
	maxChars : new Array(),
	
	initialize : function ()
	{
		Event.observe(window, 'load', function(){
			setTimeout('Forms.checkAutocomplete()', 100);
		});
	},
	
	setElementsValue : function(elements)
	{
		if (typeof(elements) == 'object' && elements.constructor == Array)
		{
			for(var i=0; i<elements.length; i++)
			{
				
				var element_id = elements[i].id;
				
				if (element_id && elements[i].value)
				{
					
					this.texts[element_id] = elements[i].value;
					
					var inputValue = new Element('b', {id: element_id+'Value'}).update(elements[i].value);
					
					var inputEl = $(element_id);
					inputEl.parentNode.appendChild(inputValue);
					
					Event.observe($(element_id+'Value'), 'click', function(event) {
						var inputEl = $(Event.element(event).id.replace(/Value/, ''));
						Forms.hideValue(inputEl);
						inputEl.focus();
						
					});
					
					Event.observe(inputEl, 'focus', function(event) {
						Forms.hideValue(Event.element(event));
					});
					
					Event.observe(inputEl, 'blur', function(event) {
						Forms.showValue(Event.element(event));
					});
					
					this.elementsWithValue.push(inputEl);
					
				}
				 
			}
			
		}
		
	},
	
	
	checkAutocomplete : function ()
	{
		var c = this.elementsWithValue.length;
		for(var i=0; i<c; i++)
		{
			if ('' != this.elementsWithValue[i].value)
			{
				$(this.elementsWithValue[i].id + 'Value').hide();				
			}
		}
	},

	
	showValue : function(element)
	{
		if (!element)
		{
			return;
		}
		
		if ('' == element.value)
		{
			$(element.id + 'Value').show();
		}
	},
	
	hideValue : function(element)
	{
			
		if (!element)
		{
			return;
		}
		
		if ('' == element.value)
		{
			$(element.id + 'Value').hide();
		}
		
	},
	
	setHints : function ()
	{
		
		var hints = $$('div.formHint');
		var hintsLength = hints.length;
		for(var i=0; i<hintsLength; i++)
		{
			var hintId = hints[i].id;
			var inputId = hintId.replace(/Hint/, '');
			var input = $(inputId);
			
			if (!input)
			{
				continue;
			}  
			
			this.hints[inputId] = hints[i];
			
			Event.observe(input, 'focus', function(event)
			{
				var el = Event.element(event);
				Forms.showHint(el.id);
				Event.stop(event);
			});
			
			Event.observe(input, 'click', function(event)
			{
				var el = Event.element(event);
				Forms.showHint(el.id);
				Event.stop(event);
			});

		}
		
		Event.observe(document.body, 'click', function(event)
		{
			Forms.hideHint();
		});
		
		Event.observe(document.body, 'keydown', function(k)
		{
			// tab
			if (9 == k.keyCode)
			{
				Forms.hideHint();
			}
		});
	},

	showHint : function (hintKey)
	{
		
		if (this.hints[hintKey])
		{
			
			if (this.showedHint == this.hints[hintKey])
			{
				return;
			}
			
			this.hideHint();
			
			// contentPos = Element.cumulativeOffset($('leftContentText'));
			
			var elInput = $(hintKey);
			var inputPos = Element.cumulativeOffset(elInput);
			
			var formEl = elInput;
			while (formEl)
			{
				if ('FORM' == formEl.nodeName) {break;}
				formEl = formEl.parentNode;
			}
			
			var formPos = Element.cumulativeOffset(formEl);
			
			var hintTop = parseInt((inputPos.top - formPos.top - 4), 10);
			var hintLeft = parseInt((inputPos.left - formPos.left + elInput.parentNode.offsetWidth), 10);
			
			/*
			if (Prototype.Browser.IE)
			{
				var discussEl = $('discussion');
				if (discussEl)
				{
					// var discussElPos = Element.cumulativeOffset(discussEl);
					// hintLeft -= parseInt((discussElPos.left - formPos.left), 10);
					// parseInt((inputPos.left - discussElPos.left + elInput.parentNode.offsetWidth), 10);
					
					hintLeft -= parseInt((formEl.parentNode.parentNode.style.paddingLeft), 10);
					
				}
			}
			*/
			

			this.hints[hintKey].style.display = 'block';
			this.hints[hintKey].style.top = hintTop + 'px';
			this.hints[hintKey].style.left = hintLeft + 'px';
			
			this.showedHint = this.hints[hintKey];
			 
		}
		
	},
	
	hideHint : function ()
	{
		if (this.showedHint)
		{
			this.showedHint.style.display = 'none';
		}		
	},
	
	
	setProjectInfo : function(itemKey)
	{
		if (this.projectsData['item' + itemKey])
		{
			$('name').value = this.projectsData['item' + itemKey].title; 
			$('desc').value = this.projectsData['item' + itemKey].desc; 
			$('tags').value = this.projectsData['item' + itemKey].tags; 
		}
	},
	
	setBoxFooter : function()
	{
		try
		{
			var footers = $$('.boxCaseFooter');
			for(var i=0; i<footers.length; i++)
			{
				// footers[i].style.bottom = '0px';
			}
		}
		catch (e) {}
	},
	
	setMaxChars : function(el, maxCharForEl)
	{
		if (el && 0 < maxCharForEl)
		{
			this.maxChars[el] = maxCharForEl;
			Event.observe(el, 'keyup', function(event) {
				Forms._checkMaxChar($(Event.element(event)));
			});
		}
	},
	
	_checkMaxChar : function(el)
	{
		if (this.maxChars[el] < el.value.length)
		{
			el.value = el.value.substr(0, this.maxChars[el]); 
		}
	}
	
}
var Forms = new FormClass();		






var SimpleMenuClass = Class.create();
SimpleMenuClass.prototype =
{
	
	menus : new Array(),
	
	menuIds : new Array(),
	
	elements : new Array(),
		
	buttons : new Array(),
	
	options : new Array(),
	
	buttonClassName : 'selected',
		
	count : 0,	
	
	initialize : function ()
	{
		Event.observe(document, 'click', function(event) {
			SimpleMenu.hideAllMenu(event);
		});
	},
	
	addMenuControl : function(options)
	{
		
		if (options.button && (buttonEl = $(options.button)) && options.id && (menuEl = $(options.id)))
		{
			
			this.options[options.button]	= options;
			this.buttons[options.id]		= options.button;
			this.elements[options.button]	= menuEl;
			this.menus[options.button]		= options.id;
			this.menuIds.push(options.button);
			
			Event.observe(buttonEl, 'click', function(event) {
				var button = $(Event.element(event));
				SimpleMenu.showMenu(event, button.id);
			});
		
			this.count++;
			
		}
		
	},
	
	showMenu : function(e, buttonId)
	{
		
		Event.stop(e);
		this.hideAllMenu();
		
		if (this.elements[buttonId])
		{
			
			Forms.hideHint();
			
			//var pos = Element.cumulativeOffset($(buttonId));
			var pos = Element.positionedOffset($(buttonId));
			var dim = $(buttonId).getDimensions();
			
			$(buttonId).addClassName(this.buttonClassName);
			this.elements[buttonId].style.display = 'block';
			
			var x = parseInt((pos.left + dim.width + this.options[buttonId].right - this.elements[buttonId].offsetWidth), 10);
			if (0 < x)
			{
				this.elements[buttonId].style.left = x + 'px';
			}
			
			var y = parseInt(dim.height, 10);
			if (parseInt(this.options[buttonId].top, 10))
			{
				y += parseInt(this.options[buttonId].top, 10);
			}
			
			
			if ('up' == this.options[buttonId].dir && 0 < dim.height)
			{
				this.elements[buttonId].style.top = y + 'px';
			}
			
			if ('bottom' == this.options[buttonId].dir && 0 < dim.height)
			{
				y -= parseInt(this.elements[buttonId].offsetHeight + dim.height, 10);
				this.elements[buttonId].style.top = y + 'px';
			}
			
		}
	},
	
	
	hideMenu : function(buttonId)
	{
		if (this.elements[buttonId])
		{
			$(buttonId).removeClassName(this.buttonClassName);
			this.elements[buttonId].style.display = 'none';
		}
	},
	
	
	hideAllMenu : function()
	{
		for(var i=0; i<this.count; i++)
		{
			this.hideMenu(this.menuIds[i]);
		}
	},
	
	_mousemove : function()
	{
		var button = $(Event.element(event));
	}
	
	

	
}
var SimpleMenu = new SimpleMenuClass();


Event.observe(window, 'load', function (){
	
	var video_img = $$('img.videoImg');
	for(var i=0; i<video_img.length; i++)
	{
		Event.observe(video_img[i], 'mouseover', function(event) {
						var img = Event.element(event);
						img.src = img.src.replace(/.jpg/, '-hover.jpg');
					});
		Event.observe(video_img[i], 'mouseout', function(event) {
						var img = Event.element(event);
						img.src = img.src.replace(/-hover.jpg/, '.jpg');
					});
	}
	
	if (Prototype.Browser.Gecko)
	{
		var ffcss = 'button b, #searchBox button b {top: 7px; right: 25px;}' +
					'#searchBox button span {right: 13px; top: -5px;}' +
					'button span {right: 3px; top: -8px;}' +
					'.divPages #divBigBox button span {top: -6px !important;}' +
					'#loginInfo button span {left: -3px; top: -2px;}' +
					'.commentHead b {top: 4px;}';
		
		var styleEl = new Element('style', {type : 'text/css'}).update(ffcss);
		
		document.body.appendChild(styleEl);
	}
	
	if (Prototype.Browser.Opera)
	{
		var ffcss = 'button {padding-top: 5px;}' +
					'.signupFormError {padding-left: 12.6em;}';
		
		var styleEl = new Element('style', {type : 'text/css'}).update(ffcss);
		
		document.body.appendChild(styleEl);
	}
	
});





var DeleteProjectClass = Class.create();
DeleteProjectClass.prototype =
{
	
	loadingImage : null,
	
	initialize : function ()
	{
		this.loadingImage = new Image();
		this.loadingImage.src = './img/layout/loading.gif';
	},
	
	run : function ()
	{
		$('deleteProjectForm').hide();
		
		$('deleteProjectInfo').style.display = 'block';
		$('deleteProjectInfo').innerHTML = '<img src="' + this.loadingImage.src + '" width="32" height="32" alt="" />';
		
		return false;
	}
	
}
var DeleteProject = new DeleteProjectClass();



function gethex(decimal) 
{
    var hexchars = "0123456789ABCDEFabcdef";
    return "%" + hexchars.charAt(decimal >> 4) + hexchars.charAt(decimal & 0xF);
}


// public method for url encoding
function urlencode(decoded) 
{
    var encoded = "";
    
    var unreserved = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.~";
    var reserved = "!*'();:@&=+$,/?%#[]";
    var allowed = unreserved + reserved;

    for (var i = 0; i < decoded.length; i++ ) 
    {
        var ch = decoded.charAt(i);
        // Check if character is an unreserved character:
        if (unreserved.indexOf(ch) != -1) 
        {
            encoded = encoded + ch;
        } 
        else 
        {
    
            // The position in the Unicode table tells us how many bytes are needed.
            // Note that if we talk about first, second, etc. in the following, we are
            // counting from left to right:
            //
            //   Position in   |  Bytes needed   | Binary representation
            //  Unicode table  |   for UTF-8     |       of UTF-8
            // ----------------------------------------------------------
            //     0 -     127 |    1 byte       | 0XXX.XXXX
            //   128 -    2047 |    2 bytes      | 110X.XXXX 10XX.XXXX
            //  2048 -   65535 |    3 bytes      | 1110.XXXX 10XX.XXXX 10XX.XXXX
            // 65536 - 2097151 |    4 bytes      | 1111.0XXX 10XX.XXXX 10XX.XXXX 10XX.XXXX
        
            var charcode = decoded.charCodeAt(i);
    
            // Position 0 - 127 is equal to percent-encoding with an ASCII character encoding:
            if (charcode < 128) 
            {
                encoded = encoded + gethex(charcode);
            }
    
            // Position 128 - 2047: two bytes for UTF-8 character encoding.
            if (charcode > 127 && charcode < 2048) 
            {
                // First UTF byte: Mask the first five bits of charcode with binary 110X.XXXX:
                encoded = encoded + gethex((charcode >> 6) | 0xC0);
                // Second UTF byte: Get last six bits of charcode and mask them with binary 10XX.XXXX:
                encoded = encoded + gethex((charcode & 0x3F) | 0x80);
            }

            // Position 2048 - 65535: three bytes for UTF-8 character encoding.
            if (charcode > 2047 && charcode < 65536) 
            {
                // First UTF byte: Mask the first four bits of charcode with binary 1110.XXXX:
                encoded = encoded + gethex((charcode >> 12) | 0xE0);
                // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
                encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
                // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
                encoded = encoded + gethex((charcode & 0x3F) | 0x80);
            }

            // Position 65536 - : four bytes for UTF-8 character encoding.
            if (charcode > 65535) 
            {
                // First UTF byte: Mask the first three bits of charcode with binary 1111.0XXX:
                encoded = encoded + gethex((charcode >> 18) | 0xF0);
                // Second UTF byte: Get the next six bits of charcode and mask them binary 10XX.XXXX:
                encoded = encoded + gethex(((charcode >> 12) & 0x3F) | 0x80);
                // Third UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
                encoded = encoded + gethex(((charcode >> 6) & 0x3F) | 0x80);
                // Fourth UTF byte: Get the last six bits of charcode and mask them binary 10XX.XXXX:
                encoded = encoded + gethex((charcode & 0x3F) | 0x80);
            }
        }
    }
    
    return encoded;
}


function rand(n)
{
	return (Math.floor(Math.random()*n+1));
}

function showCMLink()
{
	var urls = new Array();
	var titles = new Array();
	
	urls['de'] = 'http://www.webnode.com/de/webnode-auch-in-ihrem-land/';
	urls['en'] = 'http://www.webnode.com/bring-webnode-to-your-country/';
	urls['fr'] = 'http://www.webnode.fr/introdiuisez-webnode-dans-votre-pays/';

	titles['de'] = 'Webnode - auch in Ihrem Land';
	titles['en'] = 'Bring Webnode To Your Country';
	titles['fr'] = 'Introdiuisez webnode dans votre pays';
			
	// pre tieto jazyky zobrazovat odkaz nebudeme
	var languages = [ 'en-us', 'es', 'sk', 'cs' ];
	var language = navigator.browserLanguage || navigator.language || navigator.userLanguage;
		
	if( language.substring( 0, 2 ) != 'en' )
	{
		language = language.substring( 0, 2 );
	}
	
	if( languages.indexOf( language ) < 0 )
	{	
		if( typeof( urls[language] ) == 'undefined' )
		{
			language = 'en';
		}
		
		var div = new Element( 'h4', { id:'cm-page' } );
		div.update('<a target="_blank" href="'+urls[language]+'">'+titles[language]+'</a>');
		$('cmContainer').appendChild( div );
	}
}