function disableTabs()
{
	$('#container-1').disableTab(2);
	$('#container-1').disableTab(3);
}


function fch_orderstage(strStage, strSubStage)
{

	var strCheck = "";
	var strExtraCopy = "";
	var objCurrentStep = document.forms['confirm'].CurrentStep;

	switch(strStage)
	{
	
	case 'COLOUR'	:
	
		inpCheck = document.forms['confirm'].rdo_arrangement;
		inpMoveTo = document.forms['confirm'].Attribute3;
		intFieldsNo = inpCheck.length;
		
		strDestURL = 2;
		objShowButton = document.forms['confirm'].but_selectsize;
		objHideButton = document.forms['confirm'].but_selectcolour;
		
		strAlertMessage = 'You have not chosen an arrangement type for the bouquet.';
		
	break;
	
	case 'SIZE'	:
	
		inpCheck = document.forms['confirm'].rdo_colour;
		inpMoveTo = document.forms['confirm'].Attribute1;
		intFieldsNo = inpCheck.length;
		
		strDestURL = 3;
		objShowButton = document.forms['confirm'].addtobasket;
		objHideButton = document.forms['confirm'].but_selectsize;
		
		strAlertMessage = 'You have not chosen a colour for the bouquet.';
	
	break;
	
	case 'COMPLETE'	:
	
		inpCheck = document.forms['confirm'].rdo_size;
		inpMoveTo = document.forms['confirm'].Attribute2;
		intFieldsNo = inpCheck.length;
		
		strDestURL = 'FINISH';
		objShowButton = 'NONE';
		objHideButton = 'NONE';
		
		strAlertMessage = 'You have not chosen a size for the bouquet.';
	
	break;
	
	}
	
	/*------------- switch statement to decide the course of action -----------------
		
		Read the substage variable, 
		
		if not blank do liveprice event, ELSE do the order stage process
		
	--------------------------------------------------------------------------------*/
	
	switch (strSubStage)
	{
	
	case '' :
	
	
				for (i=0;i<intFieldsNo;i++)
				{	
					if (inpCheck[i].checked == true || inpCheck[i].selected == true)
					{
						inpMoveTo.value = inpCheck[i].value;		
					}
				}
			
			
		
			
			//do check for value existing
			if (inpMoveTo.value == '')
			{
				alert(strAlertMessage);	
				return false;
			}
			else
			{	
			
				//increment the step Number
				objCurrentStep.value = parseInt(objCurrentStep.value) + 1;
			
				if (objShowButton !== 'NONE')
				{
					objShowButton.style.display = 'inline';
					
				}
					
				
				if (objHideButton !== 'NONE')
				{
					objHideButton.style.display = 'none';
				}
				
				$('#container-1').enableTab(strDestURL);
				$('#container-1').triggerTab(strDestURL);
				return true;
				
			}
	
	break;
	
	
	default :
	
		intArrangementCost = parseFloat(document.forms['confirm'].Attribute1_cost.value)
		intSizeCost = parseFloat(document.forms['confirm'].Attribute3_cost.value)
		
		int_tmpArrangementCost 			= 		parseFloat(0.00);
		int_tmpSizeCost 				= 		parseFloat(0.00);
		intNewCost 						= 		parseFloat(0.00);
		
		strArrangement_tn				=		document.forms['confirm'].Attribute3.value;
		strSash_tn						=		document.forms['confirm'].Attribute1.value;
		
		switch (strSubStage)
		{
		
			/* ---- ARRANGEMENT SELECTIONS ----*/
			
			case 'TD' :
			
			int_tmpArrangementCost 		= 		parseFloat(25.00);
			strArrangement_tn 			=		'TD';
			
			strExtraCopy 				=		'<strong>Traditional Bouquet</strong><br/>'
										+		'A Bouquet of fresh cut flowers and foliage simply are arranged in cellophane, '
										+		'ideal for those people who like to arrange their own flowers';
			
			break;
			
			case 'HT' :
			
			int_tmpArrangementCost 		= 		parseFloat(27.00);
			strArrangement_tn 			=		'HT';
			
			strExtraCopy 				=		'<strong>Handtied Bouquet</strong><br/>'
										+		'A handtied bouquet is arranged in the hand with spiralling stems, '
										+		'it is designed to be put straight into a vase without the need to rearrange.'
										+		'  handtied bouquets are delivered in water to ensure freshness.';
			
			break;
			
			case 'PA' :
			
			int_tmpArrangementCost 		= 		parseFloat(27.00);
			strArrangement_tn 			=		'PA';
			
			strExtraCopy				=		'<strong>Posy Arrangement</strong><br/>'
										+		'A posy arrangement is a small round domed arrangement of selected cut fresh flowers '
										+		'and foliage, skilfully arranged in floral foam or oasis.';
			
			break;
			
			case 'BA' :
			
			int_tmpArrangementCost 		= 		parseFloat(28.00);
			strArrangement_tn 			=		'BA';
			
			strExtraCopy				=		'<strong>Basket Arrangement</strong><br/>'
										+		'A basket arrangement is more traditional arrangement of fresh cut flowers '
										+		'and foliage, skilfully arranged in floral foam or oasis in a wicker basket.';
			
			break;
			
			/* ---- SIZE SELECTIONS ----*/
			
			case 'S'	:
			
			int_tmpSizeCost 		= 		parseFloat(0.00);
			break;
			
			
			case 'M'	:
			
			int_tmpSizeCost 		= 		parseFloat(5.00);
			break;
			
			
			case 'L'	:
			
			int_tmpSizeCost 		= 		parseFloat(10.00);
			break;
			
			
			/* ---- COLOUR SELECTIONS ----*/
			
			case 'pink' :
			
			strSash_tn 				=		'pink';
			break;
			
			
			case 'purple' :
			
			strSash_tn 				=		'purple';
			break;
			
			
			case 'red' :
			
			strSash_tn 				=		'red';
			break;
			
			
			case 'white' :
			
			strSash_tn 				=		'white';
			break;
			
			
			case 'orange' :
			
			strSash_tn 				=		'orange';
			break;
			
			
			case 'yellow' :
			
			strSash_tn 				=		'yellow';
			break;
			
			case 'mixed' :
			
			strSash_tn 				=		'mixed';
			break;
			
			
		}
		
		
		/* ---------------Add Arrangement cost to total ----------------------*/
		if (int_tmpArrangementCost !== intArrangementCost && strStage == 'COLOUR') 
		{
			intNewCost = parseFloat(intNewCost + int_tmpArrangementCost);
			document.forms['confirm'].Attribute1_cost.value = int_tmpArrangementCost;
			
			//document.write(document.forms['confirm'].Attribute1_cost.value);
		}
		else
		{
			intNewCost = parseFloat(intNewCost + intArrangementCost);
		}
		
		/* ---------------Add Size cost to total ----------------------*/
		if (int_tmpSizeCost !== intSizeCost && strStage == 'COMPLETE') 
		{
			intNewCost = parseFloat(intNewCost + int_tmpSizeCost);
			document.forms['confirm'].Attribute3_cost.value = int_tmpSizeCost;
			
			//document.write(document.forms['confirm'].Attribute3_cost.value);
		}
		else
		{
			intNewCost = parseFloat(intNewCost + intSizeCost);
		}
		
		
		/*-------------IF STAGE IS COLOUR, CHANGE COPY TEXT------------*/
		
		 if (strStage == 'COLOUR')
		 {
		 	document.getElementById('flc_copyBox').innerHTML = '<p>' + strExtraCopy + '</p>';
		 }		
		
		
		
		/* -------------------- APPLY COST TO HTML --------------------*/
		
		document.getElementById('livePrice_cost').innerHTML = "";
		document.getElementById('livePrice_cost').innerHTML = "&pound;" + parseInt(intNewCost) + ".00";
	
			for (i=0;i<intFieldsNo;i++)
			{	
					if (inpCheck[i].checked == true || inpCheck[i].selected == true)
					{
						inpMoveTo.value = inpCheck[i].value;		
					}
			}
		
		
		
			document.getElementById('imgArrangement_1').src = 'http://www.flowersdirect.co.uk/images/buy-page/floristschoice-' + strArrangement_tn + '-' + strSash_tn + '.jpg'; 
			document.getElementById('imgArrangement_2').src = 'http://www.flowersdirect.co.uk/images/buy-page/floristschoice-' + strArrangement_tn + '-' + strSash_tn + '.jpg'; 
			document.getElementById('imgArrangement_3').src = 'http://www.flowersdirect.co.uk/images/buy-page/floristschoice-' + strArrangement_tn + '-' + strSash_tn + '.jpg'; 
		
		
		//document.write(intNewCost);
	
	break;
	
	}

}


function showButton(strButtonCode)
{


objSizeButton 			=	document.forms['confirm'].but_selectsize;
objColourButton 		=	document.forms['confirm'].but_selectcolour;
objBasketButton			=	document.forms['confirm'].addtobasket;
objCurrentStep			=	document.forms['confirm'].CurrentStep;

	switch (strButtonCode)
	{
	
		case 'COLOUR' 	:
			
			if (parseInt(objCurrentStep.value) > 1)
			{
			
			objColourButton.style.display 		= 'inline';
			objSizeButton.style.display 		= 'none';
			objBasketButton.style.display 		= 'none';
		
			}
			
			break;
	
		case 'SIZE' 	:
		
			if (parseInt(objCurrentStep.value) > 2)
			{
			
			objColourButton.style.display 		= 'none';
			objSizeButton.style.display 		= 'inline';
			objBasketButton.style.display 		= 'none';
		
			}
			
			break;
		
		case 'COMPLETE'	:
		
			if (parseInt(objCurrentStep) > 3)
			{
			
			objColourButton.style.display 		= 'none';
			objSizeButton.style.display 		= 'none';
			objBasketButton.style.display 		= 'inline';
		
			}
			
			break;
	}

}

function resetForm()
{
	//---------------------Function to Reset all selections to default and move user back to first tab
	
	
	//---------------------Take the step count back to one
	objCurrentStep = document.forms['confirm'].CurrentStep;
	objCurrentStep.Value = 1;
	
	
	//---------------------Reset the drop downs
	objArrangement = document.forms['confirm'].rdo_arrangement;
	objArrangement_attribute = document.forms['confirm'].Attribute3;
	
	objColour = document.forms['confirm'].rdo_colour;
	objColour_attribute = document.forms['confirm'].Attribute1;
	
	objSize = document.forms['confirm'].rdo_size;
	objSize_attribute = document.forms['confirm'].Attribute2;
	
	//---------------------Assign the default values to the boxes
	objArrangement[0].selected = true;
	objArrangement_attribute.value = "HT";
	
	objColour[0].checked = true;
	objColour_attribute.value = "mixed";
	
	objSize[0].checked = true;
	objSize_attribute.value = "S";
	
	//---------------------Disable the tabs again
	$('#container-1').disableTab(2);
	$('#container-1').disableTab(3);

	//---------------------Return the preview image to its orginal setting
	document.getElementById('imgArrangement_1').src = 'http://www.flowersdirect.co.uk/images/buy-page/floristschoice-HT-mixed.jpg'; 
	document.getElementById('imgArrangement_2').src = 'http://www.flowersdirect.co.uk/images/buy-page/floristschoice-HT-mixed.jpg'; 
	document.getElementById('imgArrangement_3').src = 'http://www.flowersdirect.co.uk/images/buy-page/floristschoice-HT-mixed.jpg';
	
	
	//---------------------Go to the Default Tab
	$('#container-1').triggerTab(1);
	
	
	//---------------------Reset the price control
	document.getElementById('livePrice_cost').innerHTML = "&pound;25.00";
	
	
}