//---------------------------------------------------------------------------------------------------------
//	DHTML JavaScript (ver 2.3)
//---------------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------
//	Image swap
//-------------------------------------------------------------------------------------------------------
function swapImg(id,img)
{
	if( document.getElementById)
	{
		obj	= document.getElementById(id);
		obj.setAttribute( 'src', img );
	}
}



//---------------------------------------------------------------------------------------------------------
//	Show map (on click shows div layer)
//---------------------------------------------------------------------------------------------------------
var selectedID = 0;

function showproduct(what)
{
	//	Hide existing one
	if (selectedID)
	{
		hideproduct();	
	}
	
	productobject							= document.getElementById('product' + what);
	productobject.style.display				= 'block'; 
	selectedID							= what;
}

function hideproduct()
{
	if (selectedID)
	{
		selectedobject					= document.getElementById('product' + selectedID);
		productobject.style.display			= 'none'; 
		selectedID						= 0;
	}
}

function setdisplay(id,value)
{
	if( document.getElementById)
	{
		obj	= document.getElementById(id);
		obj.style.display	= value;
	}
}

function copyallfields(ovtot) {

	from_fname = document.getElementById('ShippingFirstName').value;
	from_lname = document.getElementById('ShippingLastName').value;
	from_addr = document.getElementById('ShippingAddress').value;
	from_addr2 = document.getElementById('ShippingAddress2').value;
	from_city = document.getElementById('ShippingCity').value;
	from_zip = document.getElementById('ShippingZipCode').value;
	from_phone = document.getElementById('ShippingPhone').value;
	var dropdownIndex1 = document.getElementById('ShippingState').selectedIndex;
	var dropdownIndex2 = document.getElementById('ShippingCountry').selectedIndex;
	
	document.getElementById('bill_FirstName').value = from_fname;
	document.getElementById('bill_LastName').value = from_lname;
	document.getElementById('bill_Address').value = from_addr;
	document.getElementById('bill_Address2').value = from_addr2;
	document.getElementById('bill_City').value = from_city;
	document.getElementById('bill_ZipCode').value = from_zip;
	document.getElementById('bill_Phone').value = from_phone;
	document.getElementById('bill_State').selectedIndex = dropdownIndex1;
	document.getElementById('bill_Country').selectedIndex = dropdownIndex2;
	
	xajax_setShipping(ovtot, document.getElementById('tot_cart_qty').value, document.getElementById('ri_amt').innerHTML);
	xajax_calcRITax(ovtot, document.getElementById('ship_amt').innerHTML, document.getElementById('bill_State').options[dropdownIndex1].value);
	
}

