function pudl_AjaxCall(url,parameters,handler){
	var xmlHttp=new XMLHttpRequest();
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState===4){
			if(xmlHttp.status===0){
				return;
			}
			else if(xmlHttp.status===200){
				try{
					if(typeof(handler)==='function'&&handler(xmlHttp)){
						alert('Internal system error.');
					}
				}
				catch(e){
					alert('Ajax handler failed. '+e);
				}
			}
			else if(xmlHttp.status===404){
				alert('Ajax call failed. Page not found. Http status: '+xmlHttp.status+'.');
			}
			else{
				alert('Ajax call failed. Undefined error. Http status: '+xmlHttp.status+'.');
			}
		}
	}
	xmlHttp.open('post',url);
	xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlHttp.setRequestHeader('Content-length',parameters.length);
	xmlHttp.setRequestHeader('Connection','close');
	xmlHttp.send(parameters);
	window.setTimeout(
			function(){
				if(xmlHttp&&xmlHttp.readyState!==4){
					xmlHttp.abort();
					xmlHttp.timeout=true;
					console.log(handler(xmlHttp));
					if(typeof(handler)==='function'&&!handler(xmlHttp)){
						alert('Ajax call timeout.');
					}
				}
			},
			10000
	);
}

function pudl_DynamicScript(src){
	var script=document.createElement('script');
	script.type='text/javascript';
	script.src=src;
	document.getElementsByTagName('head')[0].appendChild(script);
}

function pudl_AddEventListener(object,type,handler,capture){
	if(typeof(type)==='string'){
		type=[type];
	}
	if(typeof(capture)==='undefined'){
		capture=true;
	}
	for(var i=type.length-1;i>=0;--i){
		if(object.addEventListener){
			object.addEventListener(type[i],handler,capture);
		}
		else if(object.attachEvent){
			object.attachEvent('on'+type[i],handler);
		}
	}
}

function onmouseoutButton(caller){
	if(caller.tagName==='INPUT'||caller.tagName==='A'){
		caller.style.backgroundPosition='center 0';
	}
	else if(caller.tagName==='SPAN'){
		var spans = caller.getElementsByTagName('span');
		if(spans[0]){
			spans[0].style.backgroundPosition='left 0';
			spans[1].style.backgroundPosition='center 0';
			spans[2].style.backgroundPosition='right 0';
		}
		else{
			caller.style.backgroundPosition='left 0';
		}
	}
}

function onmouseoverButton(caller){
	if(caller.tagName==='INPUT'||caller.tagName==='A'){
		var delta=caller.offsetHeight;
		caller.style.backgroundPosition='center -'+delta+'px';
	}
	else if(caller.tagName==='SPAN'){
		var spans=caller.getElementsByTagName('span');
		if(spans[0]){
			var delta=spans[0].offsetHeight;
			spans[0].style.backgroundPosition='left -'+delta+'px';
			spans[1].style.backgroundPosition='center -'+delta+'px';
			spans[2].style.backgroundPosition='right -'+delta+'px';
		}
		else{
			var delta=caller.offsetHeight;
			caller.style.backgroundPosition='left -'+delta+'px';
		}
	}
}

function onmousedownButton(caller){
	if(caller.tagName==='INPUT'||caller.tagName==='A'){
		var delta=caller.offsetHeight;
		caller.style.backgroundPosition='center -'+2*delta+'px';
	}
	else if(caller.tagName==='SPAN'){
		var spans=caller.getElementsByTagName('span');
		if(spans[0]){
			var delta=spans[0].offsetHeight;
			spans[0].style.backgroundPosition='left -'+2*delta+'px';
			spans[1].style.backgroundPosition='center -'+2*delta+'px';
			spans[2].style.backgroundPosition='right -'+2*delta+'px';
		}
		else{
			var delta=caller.offsetHeight;
			caller.style.backgroundPosition='left -'+2*delta+'px';
		}
	}
}

function switchToTabNonpopup(caller,index){
	var childs=caller.parentNode.parentNode.children;
	for(var i=childs.length-1;i>=0;--i){
		if(index===i){
			childs[index].firstChild.className='active';
		}
		else if(childs[i].firstChild.className!==''){
			childs[i].firstChild.className='';
		}
	}
	var childs=caller.parentNode.parentNode.nextSibling.firstChild.firstChild.children;
	for(var i=childs.length-1;i>=0;--i){
		if(childs[i].style.display===''){
			childs[i].style.display='none'
		}
	}
	childs[index].style.display='';
}

function switchToNews(caller,index){
	var childs=caller.parentNode.children;
	for(var i=childs.length-1;i>=0;--i){
		if(index===i){
			childs[index].className='active';
		}
		else if(childs[i].className!==''){
			childs[i].className='';
		}
	}
	var childs=caller.parentNode.previousSibling.children;
	for(var i=childs.length-1;i>=0;--i){
		if(childs[i].style.display===''){
			childs[i].style.display='none'
		}
	}
	childs[index].style.display='';
}

function narrowDocument(){
	document.getElementById('menu_product').className=1350>(typeof(document.width)!=='undefined'?document.width:document.body.offsetWidth)?'narrow':'';
}

function spreadOut(){
	document.getElementById('wrapper').id='wrapper2';
	document.getElementById('header_2').id='header2';
	document.getElementById('header_3').id='header3';
	pudl_AddEventListener(window,'load',function(){document.getElementById('tail').id=''});
}

function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+'='+escape(value)+((expiredays==null)?'':';expires='+exdate.toGMTString());
}

function getCookie(c_name){
	if(document.cookie.length>0){
		c_start=document.cookie.indexOf(c_name + '=');
		if(c_start!=-1){
			c_start=c_start+c_name.length+1;
			c_end=document.cookie.indexOf(';',c_start);
			if(c_end==-1)c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return '';
}

pudl_AddEventListener(window,'load',function(){
	if(typeof(ISLProntoInfo)!=='undefined'){
		if (ISLProntoInfo.supporters > 0) {
			var e = document.getElementById('menu_contact_live_chat');
			if (e) {
				e.href = 'javascript:void(0)';
				e.onclick = ISLProntoInfo.onchat;
				e = e.firstChild;
				if (e) {
					e.style.display='none';
					e.nextSibling.style.display='';
				}
			}
		}
	}
	$('#social div').each(function(){
		var a=$(this)[0].firstChild.offsetWidth;
		var b=$(this)[0].offsetWidth;
		$(this).hover(
				function(){$(this).stop(true,false).animate({width:a})},
				function(){$(this).stop(true,false).animate({width:b})}
		)
	});
});