
$(function() {

$("#delivery").hide();

$("#nodelivery").click(function() {
						 		$("#delivery").animate({ height : 'toggle', opacity : 'toggle' }, "slow");
							});

$("#contact_submit").click(function() {
									
									var from_ep = $("#from");
									var from_name = $("#name");
									
									if(from_ep.val().length > 0 && from_name.val().length > 0)
									{
										document.forms[0].submit();
									}
									else
									{
										if(!from_ep.val().length > 0)
											from_ep.css("border", "1px solid #a00");
										else if(!from_name.val().length > 0)
											from_name.css("border", "1px solid #a00");
											
										$("#required_fields").css("color", "#a00").css("font-size","16px");
									}
									
									});
});

function addToCart(modelid, productid, quantity)
{	
	var url = "?pop=1&page=cart_detail&modelid="+ modelid +"&productid="+ productid + "&quantity="+ quantity;
	
	$("#cart_details").slideUp("fast", function() {
														$.get("/index.php" + url, function(data){
																								$("#cart_details").html(data);
																								$("#cart_details").slideDown("fast");
																							})
																				})
}

function nullDropdown(theId)
{
	var obj = document.getElementById(theId);
	
	obj.selectedIndex = 0;
}

function emptyCart()
{
	window.location.href='/?page=cart&empty=1';
}

function gotoCheckout()
{
	window.location.href='/?page=checkout';
}

function showHide(id)
{
	var e = document.getElementById(id);
	if(e.style.display == 'none')
		e.style.display = 'block';
	else
		e.style.display = 'none';
}


function ajax(strURL, strRes) {
    /*var xmlHttpReq = false;

    try {
		xmlHttpReq = new XMLHttpRequest();
    }
	catch(e)
	{
        xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
	
    xmlHttpReq.onreadystatechange = function() {
		
 		if (xmlHttpReq.readyState == 4)
		{
			if(xmlHttpReq.status == 200)
			{
				try
				{
			   		document.getElementById(strRes).innerHTML = xmlHttpReq.responseText;
				}
				catch(e)
				{
					document.getElementById(strRes).innerHTML = '';
					var wrapping = document.createElement('div');
					wrapping.innerHTML = xmlHttpReq.responseText;
					document.getElementById(strRes).appendChild(wrapping);
				}
			}
			else
			{
				document.getElementById(strRes).innerHTML = xmlHttpReq.status;
			}
		}
		else if (xmlHttpReq.readyState != 4)
			document.getElementById(strRes).innerHTML = '<img src="/__admin/i/ajax-loader.gif" border="0">';
    };
	
    xmlHttpReq.open('GET', '/index.php' + strURL, true);
	xmlHttpReq.send(null);
	*/
	
	
}

