function setInstantVoucherUrl(id,key,parentid,abscorrect)
{
  document.location.href=abscorrect+'de/instantvoucher_order.html?objects.artlink='+parentid+'&objects.artid='+$F('shop.cart['+key+'][artlink]');
  return false;
}

function getCustomData(id,key)
{
  if('undefined' != typeof(registeredarticlelinks[key]))
  { /*check if listitem is choosed*/
    if(!$F('artlinklist_'+key).length)
	{
      $('artlinklist_'+key).focus();
      if(isFrench())
	  {
        if('undefined' == typeof(artikelwaehlen))
		{
	      alert('Veuillez choisir un article (taille/quantité)')
		}else
		{
          alert(artikelwaehlen);
		}
	  }else
	  {
	    if('undefined' == typeof(artikelwaehlen))
		{
	      alert('Bitte wählen sie ein Artikel aus (Grösse/Anzahl)');
		}else
		{
		  alert(artikelwaehlen);
		}
	  }
	  return false;
	}
  }
  if(window._getCustomData)
  {
	if(true == _getCustomData(id,key))
	{
	  if('' == $('shop.cart['+key+'][artcount]').value)
      {
	    $('shop.cart['+key+'][artcount]').value = 1;
      }
	  return true;
	}else
	{
	  return false;
	}
  }
  if('' == $('shop.cart['+key+'][artcount]').value)
  {
    $('shop.cart['+key+'][artcount]').value = 1;
  }
  return true;
}
function openPreview(id,key)
{
  if(window._openPreview)
  {
    return _openPreview(id,key);
  }
  return true;
}
function openConfigurator(id,key)
{
  if(window._openConfigurator)
  {
    return _openConfigurator(id,key);
  }
  return true;
}
function openMoodPic(url,name,wwidth,wheight,id,key)
{
  if(window._openMoodPic)
  {
    _openMoodPic(id,key);
  }else
  {
    openPicWin(url,name,wwidth,wheight);
  }
}
function setGroupedArticleInfo(selectlist,counter)
{
  /*Display*/
  for(var i=0;i<registeredarticlelinks[counter].length;i++)
  {
    Element.hide('groupedarticledeliveryinfo_'+counter+'_'+registeredarticlelinks[counter][i]);
    Element.hide('groupedarticletopinfo_'+counter+'_'+registeredarticlelinks[counter][i]);
  }
  Element.hide('groupedarticledeliveryinfo_'+counter);
  Element.hide('groupedarticletopinfo_'+counter);

  if('' != selectlist.value)
  {
    Element.show('groupedarticledeliveryinfo_'+counter+'_'+selectlist.value);
    Element.show('groupedarticletopinfo_'+counter+'_'+selectlist.value);
	Element.hide('grouped_listtitle_'+counter);
	Element.show('grouped_listtitle_none_'+counter);
  }else
  {
    Element.show('groupedarticledeliveryinfo_'+counter);
    Element.show('groupedarticletopinfo_'+counter);
	Element.show('grouped_listtitle_'+counter);
	Element.hide('grouped_listtitle_none_'+counter);
  }
  /*Set article link*/
  $('shop.cart['+counter+'][artlink]').value =  $F('artlinklist_'+counter);
  /*set delivery date*/
  $('shop.cart['+counter+'][distributor_date]').value = $F('shop.cart['+$F('artlinklist_'+counter)+'][distributor_date]');
}
var registeredarticlelinks = Array();
function registerArticlelink(counter,articlelink)
{
  if('undefined' == typeof(registeredarticlelinks[counter]))
  {
    registeredarticlelinks[counter] = Array();
  }
  registeredarticlelinks[counter].push(articlelink);

  /*hide the two divs: search engine friendlier -> none display:none at the beginning*/
  Element.hide('groupedarticledeliveryinfo_'+counter+'_'+articlelink);
  Element.hide('groupedarticletopinfo_'+counter+'_'+articlelink);
  Element.hide('grouped_listtitle_none_'+counter);
}
/**
*
* @param  objects obj     object which is watched
* @param  integer max     length of the content
* @param  string  update  update html object id (span / div)
*/
function maxLengthChecker(obj, max, update)
{
	if (obj.value.length > max)
	{
		obj.value = obj.value.slice(0,max);
  }
	document.getElementById(update).innerHTML = max-obj.value.length;
}
