function add_cart(id_item)
{
	loading_form = document.forms["item_" + id_item];
	
	id_item = loading_form.id_item.value;
	id_option = loading_form.id_option.value;
	qty = loading_form.qty.value;
	
	if(id_option == "")
	{
		alert(no_option_alert);
		return;
	}
	
	var cartForm = document.forms["cartForm"];
	
/*
	if(qty == 0)
	{
		return;
	}
*/

	cartForm.qty.value = qty;
	cartForm.id_item.value = id_item;
	cartForm.id_option.value = id_option;
	
	cartForm.submit();
}

function setForm(id_item, id_option, qty)
{
	var outForm = document.forms["outForm"];
	
	if(qty == 0)
	{
		outForm.drop_item.value = 1;
	}
	else
	{
		outForm.set_qty.value = 1;
		outForm.qty.value = qty;
	}
	
	outForm.id_item.value = id_item;
	outForm.id_option.value = id_option;
	
	outForm.submit();
}

function drop_cart()
{
	var outForm = document.forms["outForm"];
	
	outForm.drop_cart.value = 1;
	
	outForm.submit();
}

function launch(newURL, newName, newFeatures, orgName)
{
	self.name = orgName;
	
	remote = open(newURL, newName, newFeatures);
	
	return remote;
}

function pic_detail(img_path)
{
	URL = "popup.htm?" + img_path;
	
	launch(URL, "popup", "resizable,width=50,height=50,left=50,top=50", "opener");
	
}

function preload(args)
{
	arg_len = arguments.length;

	im_arr = new Array(arguments.length)
	
	for(i = 0; i < arg_len; i++)
	{
		im = new Image();
		im.src = arguments[i];
		im_arr[i] = im;
	}
}

function signup()
{
	URL = "signup.php";
	
	launch(URL, "popup", "resizable,width=580,height=400,left=50,top=50,scrollbars", "opener");
}