function Webcalc () {}

Webcalc.togglePanel = function (refPanel)
{
	$("ul[id^='ulWebcalc']").each (function ()
	{
		if ($(this).attr ("id") == "ulWebcalc_" + refPanel)
		{
			$(this).show (200);
		}
		else
		{
			$(this).hide (200);
		}
	});
}

Webcalc.recalc = function ()
{
	var postData = "&currency=" + escape ($("#slctWebcalcCurrency").val ().replace (/%/g, '%u0025'));

	$("#divWebcalc ul li select").each (function ()
	{
		postData += "&" + $(this).attr ("id") + "=" + escape ($(this).val ().replace (/%/g, '%u0025'));
	});
	$("#divWebcalc ul li input[type=text]").each (function ()
	{
		postData += "&" + $(this).attr ("id") + "=" + escape ($(this).val ().replace (/%/g, '%u0025'));
	});
	$("#divWebcalc ul li input[type=checkbox]").each (function ()
	{
		postData += "&" + $(this).attr ("id") + "=" + $(this).is (":checked");
	});

	$.ajax (
	{
		type: "POST",
		url: mainUrl + "mods/webcalc/receiver.php",
		data: "req=recalc" + postData,
		success: function (data)
		{
			$("#txtWebcalcTotal").val (data);
		}
	});
}

Webcalc.sendQuote = function ()
{
	if ($("#txtWebcalcEmail").val ().match (/^[^@]+@[^@]+.[a-z]{2,}$/i) != null)
	{
		var postData = "&currency=" + escape ($("#slctWebcalcCurrency").val ().replace (/%/g, '%u0025'));
		postData += "&email=" + escape ($("#txtWebcalcEmail").val ().replace (/%/g, '%u0025'));
		postData += "&extra=" + escape ($("#areaWebcalcExtra").val ().replace (/%/g, '%u0025'));

		$("#divWebcalc ul li select").each (function ()
		{
			postData += "&" + $(this).attr ("id") + "=" + escape ($(this).val ().replace (/%/g, '%u0025'));
		});
		$("#divWebcalc ul li input[type=text]").each (function ()
		{
			postData += "&" + $(this).attr ("id") + "=" + escape ($(this).val ().replace (/%/g, '%u0025'));
		});
		$("#divWebcalc ul li input[type=checkbox]").each (function ()
		{
			postData += "&" + $(this).attr ("id") + "=" + $(this).is (":checked");
		});

		$.ajax (
		{
			type: "POST",
			url: mainUrl + "mods/webcalc/receiver.php",
			data: "req=quote" + postData,
			success: function (data)
			{
				alert (data);
			}
		});
	}
	else
	{
		alert ("!");
	}
}
