
function types(type){
	/*
	new Ajax.Updater('custStep3', '/customise/type.php', {
		method: 'get',
		parameters: "?t="+type
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "customise/type.php",
	   data: "t="+type,
	   success: function(html){
	     $("#custStep3").html(html);
	   }
	 });
}

function change_size(pd_id, type){
	/*
	new Ajax.Updater('custStep3', '/customise/type.php', {
		method: 'get',
		parameters: "?t="+type
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "/customise/change_size.php",
	   data: "pd_id="+pd_id+'&type='+type,
	   success: function(html){
	     $("#sizes").html(html);
	   }
	 });
}

function previewImg(type,name){
	/*
	new Ajax.Updater('preview', './customise/preview.php', {
		method: 'get',
		parameters: "?t="+type+"&n="+name
	});
	*/
		$('#wait').show();
		
	$.ajax({
	   type: "GET",
	   url: "customise/preview.php",
	   data: "t="+type+"&n="+name,
	   success: function(html){
	     $("#preview").html(html);
	$('#wait').show();
	//$('#flashElement').css({ width: '0px', height : '0px', overflow: 'hidden' });
		setTimeout(function(){ $('#wait').hide();	},1000);
	   }
	 });
	
}

function previewImgReset(){
	/*
	new Ajax.Updater('preview', './customise/preview.php', {
		method: 'get',
		parameters: "?t="+type+"&n="+name
	});
	*/
		$('#wait').show();
		
	$.ajax({
	   type: "GET",
	   url: "customise/preview.php",
	   success: function(html){
	     $("#preview").html(html);
	$('#wait').show();
	//$('#flashElement').css({ width: '0px', height : '0px', overflow: 'hidden' });
		setTimeout(function(){ $('#wait').hide();	},1000);
	   }
	 });
	
}

function previewImgStep2(type,name){
	/*
	new Ajax.Updater('preview', 'customise/previewStep2.php', {
		method: 'get',
		parameters: "?t="+type+"&n="+name
	});
	
	if (name == 'tailtype'){
		new Ajax.Updater('tailcolours', 'customise/tailcolours.php', {
			method: 'get',
			parameters: "?t="+type+"&n="+name
		});
	}
	*/
	$('#wait').show();
	$.ajax({
	   type: "GET",
	   url: "customise/previewStep2.php",
	   data: "t="+type+"&n="+name,
	   success: function(html){
	     $("#preview").html(html);
		$('#wait').show();
			setTimeout(function(){$('#wait').hide();},1000);
	   }
	 });
	
	if (name == 'tailtype'){
		$.ajax({
		   type: "GET",
		   url: "customise/tailcolours.php",
		   data: "t="+type+"&n="+name,
		   success: function(html){
		     $("#tailcolours").html(html);
		   }
		 });
	}
	
}

function previewImgStep3(type,name){
	new Ajax.Updater('preview', '/customise/previewStep3.php', {
		method: 'get',
		parameters: "?t="+type+"&n="+name
	});
}

function fabrics(type){
	/*
	new Ajax.Updater('fabrics', '/customise/fabrics.php', {
		method: 'get',
		parameters: "?t="+type
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "customise/fabrics.php",
	   data: "t="+type,
	   success: function(html){
	     $("#fabrics").html(html);
	   }
	 });
	
	previewImgReset();
}

function sizesFeet(type){
	/*
	new Ajax.Updater('feetSize', '/customiseAcc/feetSize.php', {
		method: 'get',
		parameters: "?t="+type
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "customiseAcc/feetSize.php",
	   data: "t="+type,
	   success: function(html){
	     $("#feetSize").html(html);
	   }
	 });
}

function fabricsFeet(type){
	/*
	new Ajax.Updater('fabrics', '/customiseAcc/fabricsFeet.php', {
		method: 'get',
		parameters: "?t="+type
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "customiseAcc/fabricsFeet.php",
	   data: "t="+type,
	   success: function(html){
	     $("#fabrics").html(html);
	   }
	 });
}

function sizesMitten(type){
	/*
	new Ajax.Updater('mittenSize', '/customiseAcc/mittenSize.php', {
		method: 'get',
		parameters: "?t="+type
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "customiseAcc/mittenSize.php",
	   data: "t="+type,
	   success: function(html){
	     $("#mittenSize").html(html);
	   }
	 });
}

function fabricsMitten(type){
	/*
	new Ajax.Updater('fabrics', '/customiseAcc/fabricsMitten.php', {
		method: 'get',
		parameters: "?t="+type
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "customiseAcc/fabricsMitten.php",
	   data: "t="+type,
	   success: function(html){
	     $("#fabrics").html(html);
	   }
	 });
}

function fabricsTail(type){
	
	var typeC = document.forms["custStep1"].elements["fabric"];
	var type = typeC.options[typeC.selectedIndex].value;
	
	var tailC = document.forms["custStep1"].elements["tailtype"];
	var tailtype = tailC.options[tailC.selectedIndex].value;
	/*
	new Ajax.Updater('fabrics', '/customiseAcc/fabricsTail.php', {
		method: 'get',
		parameters: "?t="+type+"&tailtype="+tailtype
	});
	*/
	$.ajax({
	   type: "GET",
	   url: "customiseAcc/fabricsTail.php",
	   data: "t="+type+"&tailtype="+tailtype,
	   success: function(html){
	     $("#fabrics").html(html);
	   }
	 });
}

function setall()
{
	var frontLeftValue = document.getElementById("frontLeftColour").value;
	theForm = window.document.custStep1;
	
	if (theForm.frontRightColour != 'undefined' && theForm.frontRightColour){
		document.getElementById("frontRightColour").value = frontLeftValue;
	}
	if (theForm.backLeftColour != 'undefined' && theForm.backLeftColour){
		document.getElementById("backLeftColour").value = frontLeftValue;
	}
	if (theForm.backRightColour != 'undefined' && theForm.backRightColour){
		document.getElementById("backRightColour").value = frontLeftValue;
	}
	if (theForm.armsLeftColour != 'undefined' && theForm.armsLeftColour){
		document.getElementById("armsLeftColour").value = frontLeftValue;
	}
	if (theForm.armsRightColour != 'undefined' && theForm.armsRightColour){
		document.getElementById("armsRightColour").value = frontLeftValue;
	}
	if (theForm.cuffsLeft != 'undefined' && theForm.cuffsLeft){
		document.getElementById("cuffsLeft").value = frontLeftValue;
	}
	if (theForm.cuffsRight != 'undefined' && theForm.cuffsRight){
		document.getElementById("cuffsRight").value = frontLeftValue;
	}
	if (theForm.panelRight != 'undefined' && theForm.panelRight){
		document.getElementById("panelRight").value = frontLeftValue;
	}
	if (theForm.panelLeft != 'undefined' && theForm.panelLeft){
		document.getElementById("panelLeft").value = frontLeftValue;
	}
	if (theForm.bottomsFrontLeft != 'undefined' && theForm.bottomsFrontLeft){
		document.getElementById("bottomsFrontLeft").value = frontLeftValue;
	}
	if (theForm.bottomsFrontRight != 'undefined' && theForm.bottomsFrontRight){
		document.getElementById("bottomsFrontRight").value = frontLeftValue;
	}
	if (theForm.bottomsBackLeft != 'undefined' && theForm.bottomsBackLeft){
		document.getElementById("bottomsBackLeft").value = frontLeftValue;
	}
	if (theForm.bottomsBackRight != 'undefined' && theForm.bottomsBackRight){
		document.getElementById("bottomsBackRight").value = frontLeftValue;
	}
	
	previewImg(frontLeftValue,'colour');
}

function setallbottoms()
{
	var frontLeftValue = document.getElementById("bottomsFrontLeft").value;
	theForm = window.document.custStep1;
	

	if (theForm.bottomsFrontLeft != 'undefined' && theForm.bottomsFrontLeft){
		document.getElementById("bottomsFrontLeft").value = frontLeftValue;
	}
	if (theForm.bottomsFrontRight != 'undefined' && theForm.bottomsFrontRight){
		document.getElementById("bottomsFrontRight").value = frontLeftValue;
	}
	if (theForm.bottomsBackLeft != 'undefined' && theForm.bottomsBackLeft){
		document.getElementById("bottomsBackLeft").value = frontLeftValue;
	}
	if (theForm.bottomsBackRight != 'undefined' && theForm.bottomsBackRight){
		document.getElementById("bottomsBackRight").value = frontLeftValue;
	}
	
	previewImg(frontLeftValue,'colour');
}

function Select_Value_Set(SelectName, Value) {
  eval('SelectObject = document.' + 
    SelectName + ';');
  for(index = 0; 
    index < SelectObject.length; 
    index++) {
   if(SelectObject[index].value == Value)
     SelectObject.selectedIndex = index;
   }
}
