
function changeLang(name,value)
{	var today=new Date(); expires=new Date(today.getTime() + 1*24*60*60*1000);
	document.cookie=name+"="+escape(value)+";expires="+expires.toGMTString()+";path=/";
	self.location.reload(true)
}

function showSub(obj)
{
	if(obj.firstChild.className == 'smnu') 
	{
		obj.firstChild.style.display = 'block'
		if(obj.firstChild.clientWidth < obj.clientWidth) obj.firstChild.style.width=obj.clientWidth+'px';
	}
}

function hideSub(obj)
{
	if(obj.firstChild.className == 'smnu') obj.firstChild.style.display = 'none';
}

function showChildren(obj)
{
	closeChildren(obj)
	obj.innerHTML = obj.innerHTML.replace('+','-')
	var currNode = obj.nextSibling;
		while(currNode.className != 'dummy')
		{
			currNode.style.display='block';
			currNode = currNode.nextSibling;
			if(currNode == null) return
		}
}

function closeChildren(obj)
{
	var nodes = obj.parentNode.getElementsByTagName('A');	
	for(var i=0;i<nodes.length;i++)
	{
		if(nodes[i].className != 'dummy') nodes[i].style.display='none';
			nodes[i].innerHTML = nodes[i].innerHTML.replace('-','+')
	}
}

function onSubmit()
{
	var fault = false;
	var inputs = document.getElementById('query').elements;
	for(var i=0;i<inputs.length;i++)
	{	
		var attr = inputs[i].attributes
		for(var j=0;j<attr.length;j++)
		{
			if(attr[j].nodeName=="required" && inputs[i].value=='')
			{
				fault=true;
				inputs[i].style.backgroundColor="B00000";
				inputs[i].onfocus = function(){this.style.backgroundColor=""}
				inputs[i].onblur = function(){if(this.value=='') this.style.backgroundColor="B00000"}
			}
		}
	}
	if(fault)
		{
		document.getElementById('empty').style.display="none";
		document.getElementById('required').style.display="block";
		} else
		{
			document.getElementById('query').submit()
		}
}

function offersShowRooms(oElm){
	if(oElm.style.cursor != 'pointer') return;
	offersHideRooms(oElm.parentNode.parentNode.parentNode);
	oElm.innerHTML = oElm.innerHTML.replace('+','-');
	oElm.style.cursor = 'default';
	oElm.parentNode.nextSibling.style.display='block'

}

function offersHideRooms(oElm){
	var casesHTML = oElm.getElementsByTagName('p');
	for(var i=0;i<casesHTML.length;i++)
	{
		var b = casesHTML[i].firstChild.firstChild;
		b.innerHTML = b.innerHTML.replace('-','+');
		b.style.cursor="pointer";
		casesHTML[i].firstChild.nextSibling.style.display='none';
		
	}
}

function priceShowRooms(oElm){
	if(oElm.style.cursor != 'pointer') return;
	priceHideRooms(oElm.parentNode.parentNode.parentNode)
	oElm.innerHTML = oElm.innerHTML.replace('+','-');
	oElm.style.cursor = 'default';
	oElm.parentNode.parentNode.nextSibling.style.display = '';

}

function priceHideRooms(oElm){
	tbodies = oElm.getElementsByTagName('TBODY')
	for(var i=0;i<tbodies.length;i++){
		if(tbodies[i].getAttribute('name') == 'rooms'){
			tbodies[i].style.display='none';
			}
		if(tbodies[i].getAttribute('name') == 'case'){
			var td = tbodies[i].firstChild.firstChild
				td.innerHTML = td.innerHTML.replace('-','+')
				td.style.cursor = 'pointer';

			}
		
	}
}

function initIcons(){
	var icons = document.getElementById('imageIcons').getElementsByTagName('img')
		icons[0].className='ilistitem_on';
		icons[0].parentNode.style.cursor='default';
		for(var i=0;i<icons.length;i++)
		{
			icons[i].onmouseover=function(){if(this.className == 'ilistitem') this.className = 'ilistitem_over'}
			icons[i].onmouseout=function(){if(this.className == 'ilistitem_over') this.className = 'ilistitem'}
			icons[i].onclick=function(){
				if(this.className == 'ilistitem_over')
					{
						var icons = document.getElementById('imageIcons').getElementsByTagName('img')
						for(var i=0;i<icons.length;i++)
							if(icons[i].className == 'ilistitem_on'){
								icons[i].className = 'ilistitem';
								icons[i].parentNode.style.cursor='pointer';
								}
						this.className = 'ilistitem_on';
						this.parentNode.style.cursor='default';
						document.getElementById('imageContainer').innerHTML='<img border="0" alt="0" src='+this.src.replace('_s','')+'>'
					}
				}
			
		}
	
}

//				document.getElementById('out').innerHTML = this.className

