function SetSize()
{
	if (navigator.appName == 'Opera') {clWidth=document.body.clientWidth;} else {clWidth=document.documentElement.clientWidth;}
	if (navigator.appName == 'Opera') {clHeight=document.body.clientHeight;} else {clHeight=document.documentElement.clientHeight;}
	polo = document.getElementById('Polo');
	bt = document.getElementById('Bottom');
	sh = document.getElementById('SiteHeader');	
	if (clWidth<1050) {polo.style.width = '25px'; bt.style.paddingLeft ='40px'; sh.style.left = '40px';}
	if (clWidth>1049 && clWidth<1300) {polo.style.width = '60px'; bt.style.paddingLeft ='75px'; sh.style.left = '75px';}
	if (clWidth>1299) {polo.style.width = '130px'; bt.style.paddingLeft ='145px'; sh.style.left = '145px';}
	mc = document.getElementById('MainContent');
	vl = document.getElementById('Vertical');
	mcs = mc.scrollHeight;
	if (mcs<500) mcs=500;
	vl.style.height = clHeight-mcs-132 + 'px';
}

function SetSizeI()
{
	if (navigator.appName == 'Opera') {clWidth=document.body.clientWidth;} else {clWidth=document.documentElement.clientWidth;}
	if (navigator.appName == 'Opera') {clHeight=document.body.clientHeight;} else {clHeight=document.documentElement.clientHeight;}
	polo = document.getElementById('Polo');
	bt = document.getElementById('Bottom');
	sh = document.getElementById('SiteHeader');	
	if (clWidth<1050) {polo.style.width = '25px'; bt.style.paddingLeft ='40px'; sh.style.left = '40px';}
	if (clWidth>1049 && clWidth<1300) {polo.style.width = '60px'; bt.style.paddingLeft ='75px'; sh.style.left = '75px';}
	if (clWidth>1299) {polo.style.width = '130px'; bt.style.paddingLeft ='145px'; sh.style.left = '145px';}
	mc = document.getElementById('MainContent');
	vl = document.getElementById('Polo');
	vl.style.height = clHeight - 150 + 'px';
}

function hover(line,state)
{
	m = document.getElementById('menu'+line);
	mr = document.getElementById('menur'+line);
	if (state==1)
	{
		if (m.className == 'MenuTD')
		{
			m.className = 'MenuTDactive';
		} else
			{
				m.className = 'MenuTDsmallactive';
			}
		mr.className = 'MenuRactive';
	} else
	{
		if (m.className == 'MenuTDactive')
		{
			m.className = 'MenuTD';
		} else
			{
				m.className = 'MenuTDsmall';
			}
		mr.className = 'MenuR';
	}
}

function ShowPhoto(path,width,height)
{
	view = document.getElementById('ViewPhoto');
	foto = document.getElementById('Fotka');
	foto.innerHTML = '<img src="'+path+'" onClick="HidePhoto()">';
	view.style.width = width + 42 + 'px';
	view.style.height = height + 58 + 'px';
	view.style.marginLeft = -Math.round((width+42)/2) + 'px';
	view.style.marginTop = -Math.round((height+58)/2) + document.documentElement.scrollTop + 'px';
	view.style.display = 'block';
}

function HidePhoto()
{
	view = document.getElementById('ViewPhoto');
	view.style.display = 'none';
}

function ChangePrice(state)
{
	ps = document.getElementById('PriceSelector');
	p1 = document.getElementById('Price1');
	p2 = document.getElementById('Price2');
	if (state==1)
	{
		p1.style.display = 'block';
		p2.style.display = 'none';
		ps.innerHTML = '<strong>Öåíû íà òîâàðû</strong> / <a href="javascript: void(0);" onClick="ChangePrice(2);">öåíû íà óñëóãè</a>';
	} else
		{
		p1.style.display = 'none';
		p2.style.display = 'block';
		ps.innerHTML = '<strong>Öåíû íà óñëóãè</strong> / <a href="javascript: void(0);" onClick="ChangePrice(1);">öåíû íà òîâàðû</a>';
		}
}


function checkEmpty (val){
	if (val=="" || val.search(/[^\s]+/)==-1) {
		return false;
	}
	return true;
}

function RestoreColor()
	{
	document.MessageForm.name.style.background="#ffffff";	
	document.MessageForm.contacts.style.background="#ffffff";	
	document.MessageForm.content.style.background="#ffffff";	
	}

function SubmitMessage()
{
	sm=true;
	if (!checkEmpty(document.MessageForm.name.value)) 
		{
	document.MessageForm.name.style.background="#CBE1EF";
	sm=false;	
		}
	if (!checkEmpty(document.MessageForm.contacts.value)) 
		{
	document.MessageForm.contacts.style.background="#CBE1EF";
	sm=false;	
		}
	if (!checkEmpty(document.MessageForm.content.value)) 
		{
	document.MessageForm.content.style.background="#CBE1EF";
	sm=false;	
		}
	if (sm==true) {document.MessageForm.submit();}		
}