function Update()
{
	obj.action='update_cart.php?opt=update';
	obj.submit();
}
function Customize()
{
	if(strTrim(obj1.custom_qty.value) == "")
	{
		alert("Please enter customize shirt value.");
		obj1.custom_qty.focus();
		return false;
	}
	if(!IsInteger(obj1.custom_qty.value))
	{
		alert("Please enter a valid customize shirt value.");
		obj1.custom_qty.focus();
		return false;
	}
	var strCustom, strCustomBtn;
	strCustom = '<table border="0" width="100%" cellspacing="1" cellpadding="2">';
	strCustom+= '    <tr>';
	strCustom+= '      <td width="20%" class="smlBlackBold">Size</td>';
	strCustom+= '      <td width="60%" class="smlBlackBold">Name</td>';
	strCustom+= '      <td width="20%" class="smlBlackBold">No</td>';
	strCustom+= '    </tr>';
	for(i=1; i<=obj1.custom_qty.value; i++)
	{
		strCustom+= '    <tr><input type="hidden" name="arrNumCustom[]" value="'+i+'">';
		strCustom+= '      <td width="20%"><input type="text" name="Size_'+i+'" size="20" class="clsTextBox" style="width:100%"></td>';
		strCustom+= '      <td width="60%"><input type="text" name="Name_'+i+'" size="20" class="clsTextBox" style="width:100%"></td>';
		strCustom+= '      <td width="20%"><input type="text" name="No_'+i+'" size="20" class="clsTextBox" style="width:100%"></td>';
		strCustom+= '    </tr>';
	}
	strCustom+= '  </table>';
	obj1.hdnNumCust.value = obj1.custom_qty.value;
	csForm.innerHTML = (obj1.custom_qty.value == 0)?"":strCustom;
	//return true;
}

function CheckOut()
{
	if(obj1.isCustomize[0].checked == true)	//Customization Yes Choosed
	{
		//If Logo is choosed by the customer then he has to upload only custom logo.
		//Code for Front END Start
		if(obj1.Position[0].checked == false && obj1.Position[1].checked == false && obj1.Position[2].checked == false)
		{
			alert("Please select the position");
			obj1.Position[0].focus();
			return false;
		}
		if(obj1.Position[0].checked == true) //Front is choosed by the customer
		{
			if(!ValidateFrontEND())
				return false;
		}
		if(obj1.Position[1].checked == true || obj1.BackCustomize.checked == true) //Back is choosed by the customer
		{
			if(!ValidateBackEND())
				return false;
		}
		if(obj1.Position[2].checked == true) //Both is choosed by the customer
		{
			if(!ValidateFrontEND())
			{
				return false;
			}
			if(!ValidateBackEND())
			{
				return false;
			}
		}
		if(obj1.hdnNumCust.value < 1)
		{
			alert("Please enter details of custom data.");
			obj1.custom_qty.focus();
			return false;
		}
//------------------------------------------------------------------------------------
	}
	obj1.action='process_order.php?opt=process';
	obj1.submit();
}

function DisableAll()
{
	arrOptDIV = new Array('BackFont', 'FrontOptType', 'FrontOptType1', 'FontColorType', 'FrontFont', 'ScriptsDiv', 'BlocksDiv', 'FrontLayout', 'BackFont', 'NameDiv', 'NumbersDiv');
	for(i=0; i<arrOptDIV.length; i++)
	{
		document.all[arrOptDIV[i]].style.visibility = "hidden";
		document.all[arrOptDIV[i]].style.display = "none";
	}
	for(i=0; i<obj1.elements.length; i++)
	{
		if(obj1.elements[i].type == "radio")
			obj1.elements[i].checked = false;
	}
}
function ShowOption()
{
	document.all["OptionBox"].style.visibility = "visible";
	document.all["OptionBox"].style.display = "inline";
}
function HideOption()
{
	document.all["OptionBox"].style.visibility = "hidden";
	document.all["OptionBox"].style.display = "none";
}
function ShowFront()
{
	DisableAll();
	document.all["FrontOptType"].style.visibility = "visible";
	document.all["FrontOptType"].style.display = "inline";
	obj1.Position[0].checked = true;
	obj1.isCustomize[0].checked = true;
}
function ShowBack()
{
	DisableAll();
	document.all["BackFont"].style.visibility = "visible";
	document.all["BackFont"].style.display = "inline";
	obj1.Position[1].checked = true;
	obj1.isCustomize[0].checked = true;
}
function ShowBoth()
{
	DisableAll();
	document.all["FrontOptType"].style.visibility = "visible";
	document.all["FrontOptType"].style.display = "inline";
	document.all["BackFont"].style.visibility = "visible";
	document.all["BackFont"].style.display = "inline";
	obj1.Position[2].checked = true;
	obj1.isCustomize[0].checked = true;
}


function ShowTextOption()
{
	document.all["FontColorType"].style.visibility = "visible";
	document.all["FontColorType"].style.display = "inline";
	document.all["FrontOptType1"].style.visibility = "hidden";
	document.all["FrontOptType1"].style.display = "none";
	document.all["FrontFont"].style.visibility = "visible";
	document.all["FrontFont"].style.display = "inline";
	document.all["FrontLayout"].style.visibility = "visible";
	document.all["FrontLayout"].style.display = "inline";
}
function ShowLogoOption()
{
	document.all["FrontOptType1"].style.visibility = "visible";
	document.all["FrontOptType1"].style.display = "inline";
	document.all["FontColorType"].style.visibility = "hidden";
	document.all["FontColorType"].style.display = "none";
	document.all["FrontFont"].style.visibility = "hidden";
	document.all["FrontFont"].style.display = "none";
	document.all["FrontLayout"].style.visibility = "hidden";
	document.all["FrontLayout"].style.display = "none";
}



/*function HideTextOption()
{
	document.all["FrontOptType1"].style.visibility = "visible";
	document.all["FrontOptType1"].style.display = "inline";
	document.all["FontColorType"].style.visibility = "hidden";
	document.all["FontColorType"].style.display = "none";
	document.all["BackFont"].style.visibility = "hidden";
	document.all["BackFont"].style.display = "none";
	document.all["FrontLayout"].style.visibility = "hidden";
	document.all["FrontLayout"].style.display = "none";
	document.all["artwork_logo"].disabled = false;
}
function ShowFront()
{
	document.all["FrontOptType"].style.visibility = "visible";
	document.all["FrontOptType"].style.display = "inline";
	document.all["FrontOptType1"].style.visibility = "hidden";
	document.all["FrontOptType1"].style.display = "none";
	document.all["FontColorType"].style.visibility = "visible";
	document.all["FontColorType"].style.display = "inline";
	document.all["FrontFont"].style.visibility = "visible";
	document.all["FrontFont"].style.display = "inline";
	document.all["BackFont"].style.visibility = "hidden";
	document.all["BackFont"].style.display = "none";
	document.all["FrontLayout"].style.visibility = "visible";
	document.all["FrontLayout"].style.display = "inline";
	obj1.BackCustomize.checked = false;
}
function ShowBack()
{
	if(obj1.PrintType[1].checked == false)
	{
		document.all["BackFont"].style.visibility = "visible";
		document.all["BackFont"].style.display = "inline";
		document.all["FrontFont"].style.visibility = "hidden";
		document.all["FrontFont"].style.display = "none";
		document.all["FontColorType"].style.visibility = "hidden";
		document.all["FontColorType"].style.display = "none";
		document.all["FrontLayout"].style.visibility = "hidden";
		document.all["FrontLayout"].style.display = "none";
		obj1.BackCustomize.checked = true;
	}
}
function ShowBoth()
{
	if(obj1.PrintType[1].checked == false)
	{
		document.all["FontColorType"].style.visibility = "visible";
		document.all["FontColorType"].style.display = "inline";
		document.all["FrontFont"].style.visibility = "visible";
		document.all["FrontFont"].style.display = "inline";
		document.all["BackFont"].style.visibility = "visible";
		document.all["BackFont"].style.display = "inline";
		document.all["FrontLayout"].style.visibility = "visible";
		document.all["FrontLayout"].style.display = "inline";
		obj1.BackCustomize.checked = true;
	}
}*/
function ShowFrontOptions(divName)
{
	arrOptDIV = new Array('Scripts', 'Blocks');
	for(i=0; i<arrOptDIV.length; i++)
	{
		document.all[arrOptDIV[i]+"Div"].style.visibility = "hidden";
		document.all[arrOptDIV[i]+"Div"].style.display = "none";
	}
	if(divName == "ScriptBlocks")
	{
		document.all["ScriptsDiv"].style.visibility = "visible";
		document.all["ScriptsDiv"].style.display = "inline";
		document.all["BlocksDiv"].style.visibility = "visible";
		document.all["BlocksDiv"].style.display = "inline";
	}
	else
	{
		document.all[divName+"Div"].style.visibility = "visible";
		document.all[divName+"Div"].style.display = "inline";
	}

}
function ShowBackOptions(divName)
{
	arrOptBackDIV = new Array('Name', 'Numbers');
	if(divName == "BOTH")
	{
		for(i=0; i<arrOptBackDIV.length; i++)
		{
			document.all[arrOptBackDIV[i]+"Div"].style.visibility = "visible";
			document.all[arrOptBackDIV[i]+"Div"].style.display = "inline";
		}
	}
	else
	{
		for(i=0; i<arrOptBackDIV.length; i++)
		{
			document.all[arrOptBackDIV[i]+"Div"].style.visibility = "hidden";
			document.all[arrOptBackDIV[i]+"Div"].style.display = "none";
		}
		document.all[divName+"Div"].style.visibility = "visible";
		document.all[divName+"Div"].style.display = "inline";
	}
}

function ValidateFrontEND()
{
	chkOption = false;
	if(obj1.PrintType[0].checked == false && obj1.PrintType[1].checked == false)
	{
		alert("Please select the front printing type.");
		obj1.PrintType[0].focus();
		return false;
	}
	if(obj1.PrintType[1].checked == true)
	{
		if(strTrim(obj1.artwork_logo.value) == "")
		{
			alert("Please select the logo.");
			obj1.artwork_logo.focus();
			return false;
		}
		return true;
	}
	if(obj1.PrintType[0].checked == true)
	{
		if(strTrim(obj1.TeamName.value) == "")
		{
			alert("Please enter the team name.");
			obj1.TeamName.focus();
			return false;
		}
		for(i=0; i< obj1.ColorType.length; i++)
		{
			if(obj1.ColorType[i].checked == true)
			{
				chkOption = true;
			}
		}
		if(chkOption == false)
		{
			alert('Please select a color.');
			obj1.ColorType[0].focus();
			return false;
		}
		if(obj1.FrontSOption[0].checked == false && obj1.FrontSOption[1].checked == false)
		{
			alert("Please select front font.");
			obj1.FrontSOption[0].focus();
			return false;
		}
		else
		{
			if(obj1.FrontSOption[0].checked == true)//Script is choosed
			{
				chkOption = false;
				for(i=0; i< obj1.FrontScriptName.length; i++)
				{
					if(obj1.FrontScriptName[i].checked == true)
					{
						chkOption = true;
					}
				}
				if(chkOption == false)
				{
					alert('Please select atleast one front printing font style.');
					obj1.FrontScriptName[0].focus();
					return false;
				}
			}
			if(obj1.FrontSOption[1].checked == true)//Blocks is choosed
			{
				chkOption = false;
				for(i=0; i< obj1.FrontBlockName.length; i++)
				{
					if(obj1.FrontBlockName[i].checked == true)
					{
						chkOption = true;
					}
				}
				if(chkOption == false)
				{
					alert('Please select atleast one front script style.');
					obj1.FrontBlockName[0].focus();
					return false;
				}
			}
		}

		chkOption = false;
		for(i=0; i< obj1.rdFrontLayout.length; i++)
		{
			if(obj1.rdFrontLayout[i].checked == true)
			{
				chkOption = true;
			}
		}
		if(chkOption == false)
		{
			alert('Please select atleast one layout.');
			obj1.rdFrontLayout[0].focus();
			return false;
		}
		return true;
	}
}
function ValidateBackEND()
{
	if(obj1.BackSOption[0].checked == false && obj1.BackSOption[1].checked == false && obj1.BackSOption[2].checked == false)
	{
		alert("Please select back printing type.");
		obj1.BackSOption[0].focus();
		return false;
	}
	else
	{
		if(obj1.BackSOption[0].checked == true)	//Only name is choosed
		{
			chkOption = false;
			for(i=0; i< obj1.BackFontName.length; i++)
			{
				if(obj1.BackFontName[i].checked == true)
				{
					chkOption = true;
				}
			}
			if(chkOption == false)
			{
				alert('Please select atleast one back name font style.');
				obj1.BackFontName[0].focus();
				return false;
			}
			if(obj1.NameStyle[0].checked == false && obj1.NameStyle[1].checked == false)
			{
				alert('Please select atleast one name style.');
				obj1.NameStyle[0].focus();
				return false;
			}
			if(obj1.NameColors.selectedIndex == 0)
			{
				alert('Please select the color of name..');
				obj1.NameColors.focus();
				return false;
			}
			/*if(obj1.NameBGColors.selectedIndex == 0)
			{
				alert('Please select the background color of name..');
				obj1.NameBGColors.focus();
				return false;
			}*/
		}
		if(obj1.BackSOption[1].checked == true)	//Only number is choosed
		{
			chkOption = false;
			for(i=0; i< obj1.BackFontNumber.length; i++)
			{
				if(obj1.BackFontNumber[i].checked == true)
				{
					chkOption = true;
				}
			}
			if(chkOption == false)
			{
				alert('Please select atleast one back number style.');
				obj1.BackFontNumber[0].focus();
				return false;
			}
			if(obj1.NumberSize.selectedIndex == 0)
			{
				alert('Please select the size of the letter.');
				obj1.NumberSize.focus();
				return false;
			}
			if(obj1.NumberColors.selectedIndex == 0)
			{
				alert('Please select the color of number..');
				obj1.NumberColors.focus();
				return false;
			}
			/*if(obj1.NumberBGColors.selectedIndex == 0)
			{
				alert('Please select the background color of number..');
				obj1.NumberBGColors.focus();
				return false;
			}*/
		}
		if(obj1.BackSOption[2].checked == true)	//Both are choosed
		{
			chkOption = false;
			for(i=0; i< obj1.BackFontName.length; i++)
			{
				if(obj1.BackFontName[i].checked == true)
				{
					chkOption = true;
				}
			}
			if(chkOption == false)
			{
				alert('Please select atleast one back printing font style.');
				obj1.BackFontName[0].focus();
				return false;
			}
			chkOption = false;
			for(i=0; i< obj1.BackFontNumber.length; i++)
			{
				if(obj1.BackFontNumber[i].checked == true)
				{
					chkOption = true;
				}
			}
			if(chkOption == false)
			{
				alert('Please select atleast one back printing number style.');
				obj1.BackFontNumber[0].focus();
				return false;
			}
//-------------------------------------------------------------------------
			if(obj1.NameStyle[0].checked == false && obj1.NameStyle[1].checked == false)
			{
				alert('Please select atleast one name style.');
				obj1.NameStyle[0].focus();
				return false;
			}
			if(obj1.NameColors.selectedIndex == 0)
			{
				alert('Please select the color of name..');
				obj1.NameColors.focus();
				return false;
			}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
			if(obj1.NumberSize.selectedIndex == 0)
			{
				alert('Please select the size of the letter.');
				obj1.NumberSize.focus();
				return false;
			}
			if(obj1.NumberColors.selectedIndex == 0)
			{
				alert('Please select the color of number..');
				obj1.NumberColors.focus();
				return false;
			}
//-------------------------------------------------------------------------
		}
	}
	return true;
}
function BackCustom(chkVal)
{
	if(chkVal)
	{
		document.all["BackFont"].style.visibility = "visible";
		document.all["BackFont"].style.display = "inline";
		obj1.Position[2].checked = true;
		//ShowBoth();
	}
	else
	{
		document.all["BackFont"].style.visibility = "hidden";
		document.all["BackFont"].style.display = "none";
		obj1.Position[0].checked = true;
		//ShowFront();
	}

}
