function mail(u, s, d, img)
{
var l="ilto";
	if (img == "txt")
		{document.write("<a"+" href="+"ma"+l+":"+u+"&#64;"+s+ "." +d+">"+u+"&#64;"+s+ "." +d+"</a>");}
	else
		{document.write("<a id=\"ico_m\" "+" href="+"ma"+l+":"+u+"&#64;"+s+ "." +d+"><img src=\"/img/spacer.gif\" alt=\"E-mail\" /></a>");}
}


function show(arg, amount)
{
if (document.getElementById(arg).style.display == "none")
	{
	if (amount != 0)
	{
		for (i=1; i<=amount; i++)
			{
			document.getElementById('tab'+i).style.display = "none";
			}
	}
	document.getElementById(arg).style.display = "block";
	}
else
	{
	document.getElementById(arg).style.display = "none";
	}
}

function zoom(url, w, h, alt)
{
if (document.getElementById("zoom_screen").style.display == "none")
	{
	document.getElementById("zoom_screen").style.display = "block";
	document.getElementById("zoomed_photo").src = url;
	document.getElementById("zoomed_photo").width = w;
	document.getElementById("zoomed_photo").height = h;
	document.getElementById("zoomed_photo").alt = alt;
	document.getElementById("zoomed_div").style.marginTop = -((Math.round (h/2))+(8+1))+"px";
	document.getElementById("zoomed_div").style.marginLeft = -((Math.round (w/2))+(8+1))+"px";
	document.getElementById("zoomed_div").style.height = (h+(8*2))+"px";
	document.getElementById("zoomed_div").style.width = (w+(8*2))+"px";
	document.getElementById("closezoomed").style.display = "none";
	}
else
	{
	document.getElementById("zoom_screen").style.display = "none";
	document.getElementById("zoomed_photo").src = "/img/spacer.gif";
	document.getElementById("zoomed_photo").width = "1";
	document.getElementById("zoomed_photo").height = "1";
	document.getElementById("zoomed_photo").alt = "";
	document.getElementById("zoomed_div").style.marginTop = "0";
	document.getElementById("zoomed_div").style.marginLeft = "0"
	document.getElementById("closezoomed").style.display = "none";
	}
}

function closezoomed()
{
if (document.getElementById("closezoomed").style.display == "none")
	{document.getElementById("closezoomed").style.display = "block";}
else
	{document.getElementById("closezoomed").style.display = "none";}
}

//from Vit

function eget(id)
{
	if (document.all)
	{
		var el = document.getElementById(id) ? document.getElementById(id) : document.all[id];
	}
	else
	{
		var el = document.getElementById(id);
	}

	if (el)
	{
		return el;
	}
	else
	{
		return null;
	}
}

var xmlHttp = getHTTPObject();
function getHTTPObject()
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch(e)
	{
		var XmlHttpVersions = new Array("MSXML2.XMLHTTP.7.0", "MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP");

		for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++)
		{
			try
			{
				xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
			} catch (e) {}
		}
	}

	if (!xmlHttp) alert("Error creating the XMLHttpRequest object.");
	else return xmlHttp;
}

function process(gourl, eid, win)
{
	var r = getHTTPObject();
	r.open("GET", gourl);
	r.onreadystatechange =
	function()
	{
		if (r.readyState == 4)
		{
			eget(eid).innerHTML = r.responseText;
		}
	}

	r.send(null);
}


function feedback()
{
	process('/ajax/feedback.php?name=' + escape(eget('name').value) + '&email=' + escape(eget('email').value) + '&question=' + escape(eget('question').value) + '&lang=rus' + '&send=1','contactForm');
}

function guestbook()
{
	process('/ajax/guestbook.php?name=' + escape(eget('name').value) + '&email=' + escape(eget('email').value) + '&question=' + escape(eget('question').value) + '&lang=rus' + '&send=1','consultationForm');
}
