
	function MyItem()
	{
		this.ProductName;
		this.Quantity;
		this.ColorIndex = "none";
		this.SizeIndex = "none";
	}

	
				
	function ClientValidate()
	{
		var MyItems = new Array();
		var message = "Correct the following errors:\r";
		var IsQuantity = false;
		var IsColor = false;
		var IsSize = false;
		
		for(i=0;i<document.Main.length;i++)
		{
			var index = parseInt(document.Main[i].name.substr(13,1));
			if(MyItems.length-1 != index) MyItems[index] = new MyItem();
			if(document.Main[i].name.indexOf("ProductQuantity") != -1)
			{
				if(isNaN(document.Main[i].value)) document.Main[i].value = "0";
				MyItems[index].Quantity = parseInt(document.Main[i].value);
			}
			if(document.Main[i].name.indexOf("ProductName") != -1)
			{
				MyItems[index].ProductName = document.Main[i].value;
			}
			if(document.Main[i].name.indexOf("dropSize") != -1)
			{
				MyItems[index].SizeIndex = parseInt(document.Main[i].value);
				
			}
			if(document.Main[i].name.indexOf("dropColor") != -1)
			{
				MyItems[index].ColorIndex = parseInt(document.Main[i].value);
			}
			
		}
		for(i=0;i<MyItems.length;i++)
		{	
			if(MyItems[i].Quantity > 0)
			{
				IsQuantity = true;
				if(MyItems[i].ColorIndex == "none" && MyItems[i].SizeIndex == "none")
				{
					IsColor = true;
					IsSize = true;
					continue;
				}
				if(MyItems[i].ColorIndex == "none")
				{
					IsColor = true;
					//continue;
				}
				else
				{
					if(MyItems[i].ColorIndex > 0)
					{
						IsColor = true;
					}
					else
					{
						IsColor = false;
						message = message + " - In order to add the product \"" + MyItems[i].ProductName + "\" to the shopping cart, please choose " + colorString + "\r"
					}
				}
				if(MyItems[i].SizeIndex == "none")
				{
					IsSize = true;
					//continue;
				}
				else
				{
					if(MyItems[i].SizeIndex > 0)
					{
						IsSize = true;
					}
					else
					{
						IsSize = false;
						message = message + " - In order to add the product \"" + MyItems[i].ProductName + "\" to the shopping cart, please choose " + sizeString + "\r"
					}
				}
			}
		}

		if(IsQuantity == false)
		{
			alert(message = message + " - Please specify quantity larger than 0 in the product before the \"add to shopping bag\" button");
			return false;
		}
		
		if(IsColor == false || IsSize == false)
		{
			alert(message);
			return false;
		}
		
		if(IsQuantity == true && IsColor == true && IsSize == true)
		{
			return true;
		}	
		return false;
	}
	
	function popUp(url, width, height, scrolls) 
	{
		winOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + scrolls + ",resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",screenX=20,screenY=20";
		var win = window.open(url, 'Horchow', winOptions);
		win.moveTo(screen.availWidth/2-(width/2),screen.availHeight/2-(height/2));
		if (!win.opener) win.opener = self; 
		if (win.focus) win.focus();
	}
	
	function ShippingInformation()
	{
		popUp("http://www.oneofakind-store.com/contentno.aspx?id=3", 531, 600, "yes");
	}
	
	function ReturnPolicy()
	{
		popUp("http://www.oneofakind-store.com/contentno.aspx?id=35", 531, 350, "yes");
	}
	
	function WhatisCVN()
	{
		popUp("http://www.oneofakind-store.com/cs_cvs_no.aspx", 531, 350, "yes");
	}
	
	function SizeGuides()
	{
		popUp("http://www.oneofakind-store.com/contentno.aspx?id=13", 615, 300, "yes");
	}
	
	function PopContent(cID)
	{
		popUp("http://www.oneofakind-store.com/contentno.aspx?id=" + cID, 531, 400, "yes");
	}
	
	function EmailToFriend(cID)
	{
		popUp("http://www.oneofakind-store.com/emailtofriend.aspx?cID=" + cID, 322, 380, false);
	}
	
	function CurrencyConversion(cID)
	{
		popUp("http://www.oneofakind-store.com/currencyconversion.aspx?cID=" + cID, 322, 380, false);
	}

function WhatisCVN()
	{
		popUp("http://www.oneofakind-store.com/cs_cvs_no.aspx", 561, 350, "yes");
	}
