function redirectPage(url, msg, time){
   var TARG_ID = "REDIRECT_ID";
   var DEF_MSG = "Lade Folgeseite...";
   var TIME    = 1000;

   if( ! msg ){
      msg = DEF_MSG;
   }

   if( ! url ){
      throw new Error('Keine URL gefunden');
   }
   
   if ( ! time ){
    time = TIME;
   }


   var e = document.getElementById(TARG_ID);

   if( ! e ){
      throw new Error('REDIRECT_ID nicht gefunden');
   }

   var cTicks = parseInt(e.innerHTML);

   var timer = setInterval(function(){
      if( cTicks ){
         e.innerHTML = --cTicks;
      }else{
         clearInterval(timer);
         //document.body.innerHTML = msg;
         location = url;	  
      }

   }, time);
}

function setCookie(_cookieName,_cookieValue,_x) {
  var today = new Date();
  var expire = new Date();
  if (_x==null || _x==0) _x=1;
  /*
  Cookie wird gesetzt für x Tage
  Für x Stunden * 24 löschen
  Für x Minuten * 60 * 24 löschen
  (_x * 1000 * 60 * 60 * 24)
  */
  expire.setTime(today.getTime() + (_x * 1000 * 60 * 60));
  document.cookie = _cookieName+"="+escape(_cookieValue)+ ";expires="+expire.toGMTString()+ ";path=/";
  if(_x>0) return getCookie(_cookieName);
}

function getCookie(_cookieName){
  thisCookie = document.cookie.split("; ")
  for (i=0; i<thisCookie.length; i++) {
    if (_cookieName == thisCookie[i].split("=")[0]) {
      _cookieValue=thisCookie[i].split("=")[1];
      return unescape(_cookieValue);
    }
  }
  return;
}

function switchImage(_we_objectID, imgSrc, imgTitle){
  imgName='add_'+_we_objectID;
  if (document.images){
    if (imgSrc != "none"){
      document.images[imgName].src = imgSrc;
      if (imgTitle != ""){
        document.images[imgName].title = imgTitle;
      }
    }
  }
}

function call_xAddItemToBasket(_we_objectID){
  startAnim();
  // IE braucht eine Verzögerung
  window.setTimeout(function(){ xajax_xAddItemToBasket(_we_objectID, xajax.getFormValues('form_product_ids')); }, 60); 
  return false;
}

function addObj(_we_objectID, _mode, _showDetail){

  if(!_mode || _mode=='') _mode='de';
  
  if(_showDetail && _showDetail!=''){
    return document.write('<a href="javascript:void(0);" onclick="return call_xAddItemToBasket(' + _we_objectID + ');"><img id="add_' + _we_objectID + '" src="/2011/images/in-den-warenkorb.png" border="0" title=" In den Warenkorb "></a>');
    
  }else{
    return document.write('<a href="javascript:void(0);" onclick="xajax_xAddItemToBasket('+_we_objectID+', xajax.getFormValues(\'form_product_ids\')); return false;"><img id="add_' + _we_objectID + '" src="/2011/images/add.png" border="0" title=" In den Warenkorb "></a>');  
  }
}

function showList(_we_objectID, _weC_objectID, _mode, _print){
  // console.log('showList(' + _we_objectID +','+ _weC_objectID +','+ _mode +','+ _print + ')');
  return true;
}
