try {
	$('product_count').show().previous('label').show()
		.next('input').disabled			= true;
	document.basket.fnc.value 			= 'tobasket';
	$('product_colour').disabled		= false;
	$('product_size').show().disabled	= false;
	$('product_size').selectedIndex		= 0;
	$('product_size').previous('label').show();
} catch (e) { }

/**
 * Class used for changing articles values with the help of an ajax request.
 *
 * @author Bjoern Simon Lange
 * @package carlo-colucci
 * @version $id$
 */
var DetailVariantHelper = Class.create({
	/**
	 * This method is changing the basic values of the changed article
	 *
	 * @param object oJson
	 * @param string sMoreLink
	 * @return bool
	 */
	changeBasics: function(oJson)
	{
		removeLayers('message');

		this.oChangesContainer.down('.warenkorb').disabled        = false;

		//change art num
		this.oChangesContainer.down('.ajaxArtNum').update(oJson['sArtNum']);

		//change stock state
		this.oChangesContainer.down('.ajaxStockState').replace(
			new Element(
				'p',
				{'class' : 'ajaxStockState'}
			).update(oJson['sStockText']).addClassName(oJson['sStockClass']).hide()
		);
		//change article count field
		this.oChangesContainer.down('.ajaxArticleCount').disabled = oJson['blNotBuyable'] ? true : false;

		// Checking if the size was selected.
		if ($(this.sSizeSelectId).selectedIndex)
		{
			this.oChangesContainer.down('.ajaxStockState').show();
		} // if

		//change price
		var oPriceContainer = this.oChangesContainer.down('.preisangabe-detailseite');
		oPriceContainer.update('');
		if (oJson['dTprice'])
		{
			oPriceContainer.update('<del>' + oJson['fTprice'] + ' &euro;</del><ins>' + oJson['fPrice'] + ' &euro;</ins>');
		}//end - if
		else
		{
			oPriceContainer.update('<span>' + oJson['fPrice'] + ' &euro;</span>');
		}//end - else
	},//end - function
	/*
	 * Diese Methode refresht primaer die Select - Felder in Einkaufsinformationen,
	 * damit sich der Kunde mit JavaScript direkt ohne Reload in den Varianten bewegen
	 * kann.
	 *
	 * @param object oSelect
	 * @param object sOtherSelect -> optional parameter to change another select menu and this is the menu
	 * @return void
	 */
	changeDetails: function(oSelect)
	{
		//basic vars
		oSelect				= $(oSelect);
		var oButton			= this.oChangesContainer.down('.warenkorb');
		var oChangesContain	= this.oChangesContainer;
		//save the select for the sizes or an invisible dummy
		var oSizeSelect		= typeof arguments[1] != 'undefined' ? $(arguments[1]) : new Element('div').update('dummy');
		var oThis			= this;
		var sArticleId		= this.sArticleId;
		var sBaseUrl		= this.sBaseUrl;
		var sFirstParentId 	= this.sFirstParentId;
		var sImageBaseDir	= this.sImageBaseDir;
		var sVariantId		= oSelect.options[oSelect.selectedIndex].value;

		/*
		 * cancel the refresh and disable the buying possibilities if the choose
		 * string, index 0, was selected in the size select
		 */
		if ((oSelect.identify() == oThis.sSizeSelectId) && (oSelect.selectedIndex == 0))
		{
			this.oChangesContainer.down('.ajaxArticleCount').disabled = true;
			this.oChangesContainer.down('.ajaxStockState').hide();

			return true;
		}

		new Ajax.Request(
			sBaseUrl + 'cl=articlejsonselect&anid=' + sVariantId,
			{
				method: 'get',
				onCreate: function()
				{
					oButton.disabled = true;
					//location.href = sBaseUrl + 'cl=articlejsonselect&anid=' + sVariantId;
				},
				onFailure: function(transport)
				{
					oButton.disabled = false;
					alert(oThis.sLoadError);
				},
				onSuccess: function(transport)
				{
					//basic vars for the refresh
					oButton.disabled		= false;
					var oJson   			= transport.responseText.evalJSON();
					var sJParent			= oJson['sParentId'];
					var aVariants			= oJson['aVariants'];
					var iRoundForValues		= null;//counter which indicates the value which is used to refresh
					var iVariantCount		= aVariants.length;
					var sMarker				= '';//selected - marker
					var sPossSelectedSize	= '';//used in the iteration for the selectable sizes
					var string				= '<option value=" ' + sJParent + '">' + oThis.sChooseString + '</option>';//string for the select refresh
					var sPrevSelectedSize	= oSizeSelect.innerHTML == 'dummy' ?
						'' :
						oSizeSelect.options[oSizeSelect.selectedIndex].text;

					//checking if the second select should not be updated or if there are no multidimensions
					if ((sJParent != sArticleId && sJParent != sFirstParentId) || (!iVariantCount))
					{
						return oThis.changeBasics(oJson);
					}

					//change the image if the first variant level was changes
					if (oJson['sParentId'] == oThis.sFirstParentId)
					{
						oThis.changeImageContainer(oJson);
					}

					//loop for every variant
					for (i = 0; i < iVariantCount; i++)
					{
						//init basic vas
						sMarker				= '';
						sPossSelectedSize	= aVariants[i]['sVarSelect'];

						//if there is a size in the ajax array, use it
						if (sPossSelectedSize == sPrevSelectedSize)
						{
							iRoundForValues = i;
							oJson			= aVariants[i]
							sMarker			= ' selected="selected"';
						}

						string += '<option' + sMarker + ' value="' +
							aVariants[i]['sOxId'] + '">' + sPossSelectedSize + '</option>';
					}//end - for

					//update the dom
					oSizeSelect.update(string);
					oThis.changeBasics(oJson);
				}//end - function
			}//end - options
		)//end - Ajax.Request
	},//end - function
	/**
	 * This method is used to change the image container and the zoom link.
	 *
	 * @param object oJson -> json string with the changings
	 * @return bool
	 */
	changeImageContainer: function(oJson)
	{
		//change main pic
		this.oChangesContainer.down('img.ajaxMainThumb').src =
			this.sImageBaseDir + this.stripslashes(oJson['sPic1']);

		//change image container
		var aPics 		= oJson['aPics'];
		var iPicCount	= aPics.length;
		var oContainer	= this.oChangesContainer.down('div.product_thumb_gallery').down('span').update('');

		for (i = 0; i < iPicCount; i++)
		{
			//pure working with the DOM is not working well in ie, so use "dirty" strings
			var sIcoName	= this.stripslashes(aPics[i]['sIco']);
			var sLink 		= '<a class="img" href="#" onclick="return changeDetailPicture($$(\'.ajaxMainThumb\')[0], \'' +
				this.sImageBaseDir + this.stripslashes(aPics[i]['sImage']) + '\')"><img alt="' + sIcoName +
				'" border="0" src="' + this.sImageBaseDir + sIcoName + '" />';

			Element.insert(oContainer, {'bottom': sLink});
		}

		//change zoom link
		sMoreLink = oJson['sMoreLink'];
		if (sMoreLink != '')
		{
			this.oChangesContainer.down('.ajaxZoomLink').show().href = sMoreLink;
		}//end - if
		else
		{
			this.oChangesContainer.down('.ajaxZoomLink').hide();
		}//end - else

		return true;
	},//end - function
	/**
	 * This is the construct of the helper to change the details of an article using an ajax request.
	 *
	 * @param object oChangesContainer -> the container with the selects,price-, images-, stockstate - fields etc.
	 * @param string sArticleId -> the top most parent id of the given article
	 * @param string sBaseUrl
	 * @param string sChooseString
	 * @param string sFirstParentId
	 * @param string sImageBaseDir
	 * @param string sWaitString
	 * @return void
	 */
	initialize: function(oChangesContainer, sArticleId, sBaseUrl, sChooseString, sFirstParentId, sImageBaseDir, sLoadError)
	{
		this.oChangesContainer	= $(oChangesContainer);
		this.sArticleId			= sArticleId;
		this.sBaseUrl			= sBaseUrl;
		this.sChooseString		= sChooseString;
		this.sFirstParentId		= sFirstParentId;
		this.sImageBaseDir		= sImageBaseDir;
		this.sLoadError			= sLoadError;
		this.sSizeSelectId      = 'product_size';
	},//end - function
	/**
	 * This method imitates the stripslashes function von php and helps to remove
	 * some chars
	 *
	 * @param string string
	 */
	stripslashes: function(string)
	{
		string = string.replace(/\\'/g,'\'');
		string = string.replace(/\\"/g,'"');
		string = string.replace(/\\\\/g,'\\');
		string = string.replace(/\\0/g,'\0');

		return string;
	}//end - function
});//end - class
