var clicked1;
var clicked2;

function loc(id)
{
	window.location = id;	
}

function menus(id)
{
	document.getElementById(id).style.backgroundColor = "#0099FF";
}

function chmenu(id)
{	
	var temp;
	temp = id + '_desc';
	document.getElementById(temp).style.display = "block";
}

function chmenu1(id)
{	
	if (id == 'floormounted')
	{
		document.getElementById(id).style.backgroundImage="url(../i/site/top_r1.jpg)";
		document.getElementById(id).style.backgroundRepeat="no-repeat";
		document.getElementById(id).style.color = "#0099FF";
		document.getElementById(id).style.cursor = "pointer";
		
	}
	else if (id == 'lubrication')
	{
		document.getElementById(id).style.backgroundImage="url(../i/site/top_r2.jpg)";
		document.getElementById(id).style.backgroundRepeat="no-repeat";
		document.getElementById(id).style.color = "#0099FF";
		document.getElementById(id).style.cursor = "pointer";
	}
	else if (id == 'polimer')
	{
		document.getElementById(id).style.backgroundImage="url(../i/site/top_r3.jpg)";
		document.getElementById(id).style.backgroundRepeat="no-repeat";
		document.getElementById(id).style.color = "#0099FF";
		document.getElementById(id).style.cursor = "pointer";
		
	}
	else if (id == 'furniture')
	{
		document.getElementById(id).style.backgroundImage="url(../i/site/top_r4.jpg)";
		document.getElementById(id).style.backgroundRepeat="no-repeat";
		document.getElementById(id).style.color = "#0099FF";
		document.getElementById(id).style.cursor = "pointer";
	}
}

function chmenu2(id)
{	
	if (id == 'floormounted')
	{
		document.getElementById(id).style.backgroundImage="url(../i/site/top_r1w.jpg)";
		document.getElementById(id).style.backgroundRepeat="no-repeat";
		document.getElementById(id).style.color = "#0099FF";
		document.getElementById(id).style.cursor = "pointer";
		
	}
}

function chmenu3(id)
{	
	if (id == 'floormounted')
	{
		document.getElementById(id).style.backgroundImage="url(../i/site/top_r1oil.jpg)";
		document.getElementById(id).style.backgroundRepeat="no-repeat";
		document.getElementById(id).style.color = "#0099FF";
		document.getElementById(id).style.cursor = "pointer";
		
	}
}

function chmenu_back1(id)
{	
	document.getElementById(id).style.backgroundImage="url()";
	//document.getElementById(id).style.backgroundRepeat="no-repeat";
	document.getElementById(id).style.color = "#FFFFFF";
}

function showmenus(id)
{	
	if (clicked1 == id)
	{
		var temp;
		temp = id + '_';
		document.getElementById(temp).style.display = "none";
		document.getElementById(id).style.color = "#ffffff";
		clicked1 = '';
		if (clicked2 == undefined || clicked2 == '')
		{
		}
		else
		{
			document.getElementById(clicked2).style.color = "#ffffff";
			clicked2 = '';		
		}
	}
	else
	{	
		var temp;
		temp = id + '_';
		document.getElementById(temp).style.display = "block";
		document.getElementById(id).style.backgroundColor = "#65A834";
		document.getElementById(id).style.color = "#02923F";
		clicked1 = id;
	}
}

function showmenus_(id)
{	

	if (clicked2 == undefined || clicked2 == '')
	{
		document.getElementById(id).style.backgroundColor = "#65A834";
		document.getElementById(id).style.color = "#02923F";
		clicked2 = id;
	}
	
	else
	{
		if (clicked2 == id)
		{
			if (document.getElementById(clicked2).style.color == "#ffffff")
			{
				document.getElementById(clicked2).style.color == "#02923F";
			}
			else
			{
				document.getElementById(clicked2).style.color = "#ffffff";			
			}
			
		}
		else
		{	
			document.getElementById(id).style.backgroundColor = "#65A834";
			document.getElementById(id).style.color = "#02923F";
			document.getElementById(clicked2).style.color = "#ffffff";
			clicked2 = id;
		}
	}
}

function chmenuback()
{
	document.getElementById('floormounted_desc').style.display = "none";
	document.getElementById('lubrication_desc').style.display = "none";
	document.getElementById('polimer_desc').style.display = "none";
	document.getElementById('furniture_desc').style.display = "none";
}

function chbackrmenus(id)
{
	document.getElementById(id).style.backgroundColor = "#0099FF";
}

function chbackrmenuz(id)
{
	document.getElementById(id).style.backgroundColor = "#65A834";
}

function chbackrmenusback(id)
{
	document.getElementById(id).style.backgroundColor = "#76c5f0";
}

function chbackrmenusbagg(id)
{
	if (clicked1 != undefined)
	{
	document.getElementById(clicked1).style.backgroundColor = "#65A834";
	document.getElementById(id).style.backgroundColor = "#85c226";
	}	
	
}

function chbackrmenusbag(id)
{

	document.getElementById(id).style.backgroundColor = "#85c226";

}

function detailed(obj)
{

var str;
str = obj.split('_', 4);
var url;
url = 'detailed.php?id='+str[0]+'&razdel='+str[1]+'&podrazdel='+str[2];

  if(window.XMLHttpRequest)
  	{
    	request = new XMLHttpRequest();
  	} 
  else if (window.ActiveXObject) 
	{
    	request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
if (request) 
{
	request.onreadystatechange = function processStateChange()
	{
 		if (request.readyState == 4)
		{
    		contentDiv = document.getElementById(obj);
    		if (request.status == 200)
			{
			response = request.responseText;
			contentDiv.innerHTML = response; 
			}
			else 
			{
				contentDiv.innerHTML = "Error: Status " + request.status;
    		}

  		}
	}

request.open("GET", url, true);
request.send();

}
}

function detailed_back(obj)
{

var str;
str = obj.split('_', 4);
var url;
url = 'detailed_back.php?id='+str[0]+'&razdel='+str[1]+'&podrazdel='+str[2];

  if(window.XMLHttpRequest)
  	{
    	request = new XMLHttpRequest();
  	} 
  else if (window.ActiveXObject) 
	{
    	request = new ActiveXObject("Microsoft.XMLHTTP");
	}

if (request) 
{
	request.onreadystatechange = function processStateChange()
	{
 		if (request.readyState == 4)
		{
    		contentDiv = document.getElementById(obj);
    		if (request.status == 200)
			{
			response = request.responseText;
			contentDiv.innerHTML = response; 
			}
			else 
			{
				contentDiv.innerHTML = "Error: Status " + request.status;
    		}

  		}
	}

request.open("GET", url, true);
request.send();

}
}


function go_full_newz(id,page)
{
	window.location.href('full_newz.php?id=2&newzid='+id+'&page='+page);
}

function go_full_newz_arc(id,page)
{
	window.location.href('full_newz_arc.php?id=2&newzid='+id+'&page='+page);
}

function back_newz(page)
{
	window.location.href('newz.php?id=2&page='+page);
}

function back_newz_arc(page)
{
	window.location.href('newz_arc.php?id=2&page='+page);
}

function show_arc()
{
	window.location.href('newz_arc.php?id=2&page=1');
}

function showprice(id)
{	
	document.getElementById(id).style.color = "#b5dd7a";	
}

function unshowprice(id)
{	
	document.getElementById(id).style.color = "#ffffff";	
}
