function SetupViewProduct()
{
	SetupTechInfo();
	if($('frmProduct_productoption'))
	{
		$('frmProduct_productoption').onchange=function() {
			RemovePrices();
			$('productsubmit').hide();
			if($('optionprice_'+$('frmProduct_productoption').value))
			{
				$('optionprice_'+$('frmProduct_productoption').value).show();
				$('productsubmit').show();
			}
		}
		$('frmProduct_productoption').onchange();
	}
	if($('proddetail'))
	{
		$('prodcloser').onclick=function()
		{
			$('proddetail').show();
			$('prodmain').hide();
			$('prodthumb').show();
			$('prodcloser').hide();
		}
		$('prodthumb').onclick=function() 
		{
			$('proddetail').hide();
			$('prodmain').show();
			$('prodthumb').hide();
			$('prodcloser').show();
		}
		$('prodthumb').onclick();
	}
}
function RemovePrices()
{
	$$('p.optionprice').each(	
		function(price) {
			price.hide();	
		}
	);
}

function SetupDelivery()
{
	if($('frmBuy_delivery'))
	{
		$('frmBuy_delivery').onchange=function() {
			RemoveDeliveryText();
			if($('delopt_'+$('frmBuy_delivery').value))
			{
				$('delopt_'+$('frmBuy_delivery').value).show();
			}
		}
		$('frmBuy_delivery').onchange();
	}
}
function RemoveDeliveryText()
{
	$$('div.deliverytext p').each(
		function(opt) {
			opt.hide();
		}
	);
}

function SetupUpdateButton()
{
	if($('frmBuy_update'))
	{
		$('frmBuy_update').hide();
		$$('#frmBuy input').each(
			function (input) {
				input.onchange=function()
				{	
					$('frmBuy_update').show();
				}
				input.onkeyup=input.onchange;
			}
		);
	}
}

function ShowExtraVoucherWidgets()
{
	var s='frmBuy_Redeem_';
	for(i=2;i<=5;i++)
	{
		if($(s+i) && $(s+(i-1)))
		{
			$(s+(i-1)).setAttribute('next',i);	
		
		if(!$F(s+(i-1)))
		{
			TryToHide(s+i);			

			$(s+(i-1)).onkeyup=function()
			{
				TryToShow(this.getAttribute('next'));
			}
		}
		}
	}
}
function TryToShow(i)
{
	$('frmBuy_Redeem_'+i).up('tr').show();
}

function TryToHide(input)
{
	if(!$F(input))
	{
		$(input).up('tr').hide(i);
	}
}




function SetupTechInfo()
{
	if($('techcontrol') && $('techhidden'))
	{
		$('techcontrol').onclick=function(){
			if(this.hasAttribute('status'))
			{
				if(this.getAttribute('status')=='on')
				{
					Effect.SlideUp('techhidden');
					this.setAttribute('status','off');
					this.innerHTML='+ '+this.getAttribute('text');

				}
				else
				{
					Effect.SlideDown('techhidden');
					this.setAttribute('status','on');
					this.innerHTML='- '+this.getAttribute('text');
				}
			}
			else
			{
				this.setAttribute('status','off');
				this.setAttribute('text',$('techcontrol').down('span').innerHTML);
				$('techcontrol').down('span').hide();
				this.innerHTML='+ '+this.getAttribute('text');

					Effect.SlideUp('techhidden', { duration: 0.01 });
			}
		}
		$('techcontrol').onclick();
		$('techclose').onclick=function() {
			Effect.SlideUp('techhidden');
			$('techcontrol').setAttribute('status','off');
			$('techcontrol').innerHTML='+ '+$('techcontrol').getAttribute('text');

		}
	}
}
