//document.write("<script src='Shop/Aktions_Artikel.js' type='text/javascript'></script>");

var version = "1.0";

var idLaenge = 8; //Länge der ProductIds

var tmpGroesse = "";
var tmpProdGesehen = "";
var stopAction = false; // Variable um Actionsartikel löschen zu können

var blnActionArticleWanted = true;

var StartParam=newString;

// Rückansicht auf Übersichten an/aus
//var backview = (location.search.indexOf('backtest') != -1) ? true : false;
var backview = true;

var OnBesucherSurvey=true;//Abfragen
OnBesucherSurvey=false;

var OnSpeedSurvey=true;//Abfragen
OnSpeedSurvey=false;

var _Dedug_=false;

var OnAction=true;// Aktion
var ActionBound=24.00;

var SetNaviPath=false;
var OnLine=true;
// Basket
var BasketProfil="";
var BasketTime=new Date();
var ArrBasket = new Array();
ArrBasket.length=0;
// END Basket 
var UserMode="Sofort";

var SetTitelImg=true;
var SetPromotionImage=true;

var RootDir="";

/* AB WICHTG ÄNDERN Shop_neu ==> Shop */
if(window.location.protocol=="http:")
  RootDir=window.location.protocol+"//"+window.location.host+"/Shop/";
  

if(window.location.protocol=="file:")
{
	var ShopPos = window.location.href.indexOf("-taifun.de");
	var ShopPosNew = window.location.href.indexOf("ryweber.de");
  if(ShopPos != -1 || ShopPosNew != -1) 
  	RootDir=window.location.href.substr(0,ShopPos+10)+"/Shop/"; // --AB ändern in Shop
}

var GWorT = "";
var GWorTC = "";
GWorT = window.location.pathname;
GWorTC = window.location.pathname;

if(GWorT.indexOf('_GW') > 0)
	GWorT = "GW";

if(GWorT.indexOf('_TC') > 0)
	GWorT = "TC";

if(GWorTC.indexOf('_GW') > 0)
	GWorTC = "GW";

if(GWorTC.indexOf('_TC') > 0)
	GWorTC = "TC";
	
/* SAMOON-Zusatz */

if(GWorTC.indexOf('_SC') > 0)
	GWorTC = "SC";

if(GWorT.indexOf('_SC') > 0)
	GWorT = "SC";
	
 
var ImgMainPath  =RootDir+"Img/Main/"+Lng+"/";
var ImgFooterPath=RootDir+"Img/Footer/"+Lng+"/";
var PicSrcDivImg =RootDir+"PicSrcDivImg/"+Lng+"/";
var PicSrcDivText=RootDir+"PicSrcDivText/"+Lng+"/";

var User_ID="";
var ServerUser_ID="";
var User_Herkunft="";
var Tracker="";
var User_Aufenthalt="";

var DetailGesichtet=false;
var DetailGesichtetMal=0;
var NavigationGeklickt=false;

var Param="";
var Minimum=0; // Min Bestand 

var ZX_PartnerID="";


// Gun: Einblendung im AT-Shop, wenn jemand vom DE-Shop kam
var hinweisDEAT = "aus";
if (document.referrer.indexOf(".de") != -1)
{
	hinweisDEAT = "an";
}

// Gun: Test oder nicht Test, das ist hier die Frage.
var TestFlag = (top.location.href.indexOf("onemoretest") != -1) ? true : false;





/////////////////////////////////////////////////////

function ToCurr(value) {
  var pPrice=eval(String(value).replace(",","."));
  if(pPrice<=0.0099 && pPrice>=-0.0099) {newPounds='0';newPence='00'} 
  else{
    newPounds=parseInt(pPrice);
    var dec=eval('100');
    newPence=Math.round((pPrice-newPounds+0.000008 )*dec);
    compstring='9';
    for (var i=1; i <2;i++) {
      if (eval(newPence) <= eval(compstring)) 
        newPence='0'+newPence;
      compstring=compstring+'9';
    }
  }

  if(isNaN(newPounds)) newPounds='0';
  if(isNaN( newPence)) newPence='00';
  
  newStr=' ' + newPounds + '.' + newPence + ' '; 
  return (newStr);
}

//-----------------------------------

function WartenSec(Pause){// Bei -1 ->Stop
  if(isNaN(Pause)) 
    Pause=1;
  
  var ExitFlag=0;
  if(Pause<0)
    ExitFlag=1;
  window.setTimeout("WartenSec(-1)", 1000*Pause);
  for(;;)
    if(ExitFlag==1)
      break;
}

function Window_Open(Link, ZielFrame){
	
  for(var w=0;w<30;w++)
  {
    var ZF_obj=eval(""+ZielFrame);
    if(!ZF_obj)
      WartenSec(1);
    else if(!ZF_obj.document)
      WartenSec(1);
    else 
      break;
  }
  if(ZF_obj)
  {
    window.open(Link,ZielFrame);
  }
    
}

//-----------------------------------

var CurrentDetail="-";
var CurrentList="-";
var CurrentIndex="0";

function SetCurrentDetailList(vIndex, vCurrentDetail, vCurrentList){
  CurrentIndex=vIndex;
  CurrentDetail=vCurrentDetail;
  CurrentList=vCurrentList;
}

function LoadCurrentDetail(){
  var AntiCache=Date.parse(Date())/1000;
  var Link="../HtmlProduct"+"/"+Lng+"/"+CurrentDetail+"?"+AntiCache;
  Window_Open(Link,"FrameMainMainMain");
}

function LoadCurrentList(){
  var Link="../HtmlList/"+Lng+"/"+CurrentList+"#A"+CurrentIndex;
  Window_Open(Link,"FrameMainMainList");
}

function LoadProductFrameSet(){
  var Link="HtmlProductFrameSet/HtmlProductFrameSet.html";
  Window_Open(Link,"FrameMainMain");
}

// ------------------------------------------------------------
//function PushBasket(addQty, addStyleNumber, addBest, addDivision, addCategory, addStyleName, addColorName, addColorNumber, addSize, addSizeNo, addPrice, addTax, addLng, addEAN, addNewSale, addAltStyleNr, addSizeThumb, addStyleThumb, addID, addEuroFlag, add2){
function PushBasket(addQty, addStyleNumber, addBest, addDivision, addCategory, addStyleName, addColorName, addColorNumber, addSize, addSizeNo, addPrice, addTax, addLng, addEAN, addNewSale, addAltStyleNr, addSizeThumb, addStyleThumb, addID, addEuroFlag, addPID){
//euroflag==tracker??? schabascheffe

  //addEuroFlag=ZX_PartnerID;
//  addAltStyleNr=Tracker;
  addAltStyleNr=Tracker;  
//  addEuroFlag=Tracker; 
// START 09.08.05
  addPID=ZX_PartnerID;
// END 09.08.05 
  
  if(UserMode=="Surf")
    UserMode="AddBasket";

  var TempArr=new Array();
  var Vor="Vor:"+ArrBasket;
   for(var b=0;b<ArrBasket.length;b++){
    TempArr.length=0;
    TempArr=ArrBasket[b].split("|");
  }
if(TempArr[1] == addStyleNumber)
	if(TempArr[7] == addColorNumber)
		if(TempArr[8] == addSize){ //Del Dupp
			addQty = Number(addQty)+Number(TempArr[0]);
			for(var d = b;d<ArrBasket.length-1;d++)
				ArrBasket[d] = ArrBasket[d+1];
				ArrBasket.length--;
			}
var jetzt=new Date();
  var BasketItem=(jetzt.getTime()-BasketTime.getTime() )/1000;
//  var Item=addQty+"|"+addStyleNumber+"|"+addBest+"|"+addDivision+"|"+addCategory+"|"+addStyleName+"|"+addColorName+"|"+addColorNumber+"|"+addSize+"|"+addSizeNo+"|"+addPrice+"|"+addTax+"|"+addLng+"|"+addEAN+"|"+addNewSale+"|"+BasketProfil+"|"+BasketItem+"|"+addAltStyleNr+"|"+addSizeThumb+"|"+addStyleThumb+"|"+addID+"|"+addEuroFlag+"|"+add2+" ";
  var Item=addQty+"|"+addStyleNumber+"|"+addBest+"|"+addDivision+"|"+addCategory+"|"+addStyleName+"|"+addColorName+"|"+addColorNumber+"|"+addSize+"|"+addSizeNo+"|"+addPrice+"|"+addTax+"|"+addLng+"|"+addEAN+"|"+addNewSale+"|"+BasketProfil+"|"+BasketItem+"|"+addAltStyleNr+"|"+addSizeThumb+"|"+addStyleThumb+"|"+addID+"|"+addEuroFlag+"|"+addPID+" ";
  ArrBasket[ArrBasket.length] = Item;
  BasketProfil="";
  BasketTime=new Date();
}

function showArrBasket(vArrBasket)
{
var tet="";	
for(i=0;i<=vArrBasket.length;i++)
{
 tet+=vArrBasket[i];
}
 //alert(tet);
}		

function ReloadBasket(){
  if(frames['FrameHeader'])
    FrameHeader.location.reload();
}

function CheckPromotionBasket2(){
  var TotalBasket=0;
  var TempArr=new Array();
  var HatRabatt=false;
  for(var b=0;b<ArrBasket.length;b++){
    TempArr.length=0;
    TempArr=ArrBasket[b].split("|");
    if(TempArr[1]=="X99999"){
      HatRabatt=true;
      TempArr[0]="1";
    }
    if(TempArr[0])
     if(TempArr[10])
      TotalBasket=TotalBasket+TempArr[0]*TempArr[10];
  }

  if(TotalBasket>=ActionBound)
   if(!HatRabatt)
    if(OnAction)
     //PushBasket("1","X99999", "9999","toys","teddy aktion","osterteddy aktion","one color","0","1","0","0","15.29","de", "4999999999999", "aktion", "", "one_size.gif", "74807.gif", "02026", "", "");
  return TotalBasket;
}

// ------------------------------------------------------------
var ActArtNr="";
var ActArtGIF="";
var ActColorNr="";
var ActColorNm="";
var ActSizeNr="";
var ActSizeNm="";
var ActArtEAN="";
var ActArtText="";
var ActArtPreis="";
var ActArtID="";


function CheckPromotionBasket(){
  if(ArrBasket.length==0)
    return;

  var TotalBasket=0;
  var TempArr=new Array();

  var HatAction=false;
  
  
  var Zaelen=true;

  for(var b=0;b<ArrBasket.length;b++){
    Zaelen=true;
    TempArr.length=0;
    TempArr=ArrBasket[b].split("|");
    if(TempArr[1]==ActArtNr){
      Zaelen=false;
      HatAction=true;
    }
    if(Zaelen)
     if(TempArr[0])
      if(TempArr[10])
       TotalBasket=TotalBasket+TempArr[0]*TempArr[10];
  }
  

  var AddAction=false;
  var DeleteAction=false;
  
  if(OnAction){
    
   if(TotalBasket<ActionBound)
    if(HatAction)
     DeleteAction=true;
  }

  if(AddAction)   PushBasket("0",ActArtNr, "1000","Aktion","Aktion",ActArtText,ActColorNm,ActColorNr,ActSizeNm,ActSizeNr,ActArtPreis,ActArtPreis,"de", ActArtEAN, "sale", ActArtNr, ActSizeNm+".gif", ActArtGIF+".gif", ActArtID, "", "");
  if(DeleteAction)  DeleteArtikel(ActArtNr);

  return TotalBasket;
}

// ------------------------------------------------------------
function DeleteArtikel(Art){
  var TempArr=new Array();
  for(var d=0;d<ArrBasket.length;d++){
    TempArr.length=0;
    TempArr=ArrBasket[d].split("|");
    if(TempArr[1]==Art){
      RemoveBasketItem(d);
      break;
    }
  }
}

// ------------------------------------------------------------
function RemoveBasketItem(DelID){
  if(DelID>ArrBasket.length-1)
    return;
  for(d=DelID;d<=ArrBasket.length-1;d++)
    ArrBasket[d]=ArrBasket[d+1];
  ArrBasket.length=ArrBasket.length-1; 

}


var itemzaehler = 0;
function buyItemPl(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng, newEAN,newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2, newATBText1, newATBText2, newATBText3){
 	//for(var i=1;i<=3;i++){
  //if(eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i))
	
	if(itemzaehler < 3)
	{
		//if(eval('FrameMainMain.Framemainover.FrameOutfitStyles.FrameOutfit'+itemzaehler+'.AddItem()'))
		try
		{
   		if(eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+itemzaehler+'.AddItem()'))
   		{
   			throw "ok";
   		}
   		else
   		{
   			throw "falsch";
   		}
   	}
   	catch (e)
   	{
   		if(e == "falsch")
   		{
   			return;
   		}
   	}
   	//eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+itemzaehler+'.AddItem()');
  }

 //}
}

// 2 ------------------------------------------------------------
function buyItem(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng, newEAN,newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2, newATBText1, newATBText2, newATBText3){
  if(newQty<=0){
    alert('Die Stückzahl ('+newQty+') ist nicht korrekt!');
    return;
  }

  //if(ArrBasket.length>10 && (actionArticleArr[0].StyleNumber!=newStyleNumber) ){// Max 12 Positionen
  if(ArrBasket.length>11){// Max 12 Positionen
    if(Lng=="uk")
      alert("The basket is has reached the limit. Please complete your order by clicking the checkout-button.");
    else 
      alert("Ihr Warenkorb ist voll, bitte lösen Sie zunächst eine Bestellung aus.\n\nAnschließend können Sie Ihren Einkauf mit neuem Warenkorb fortsetzen.");
    return;
  };

  var AddBasketText1="Dem Warenkorb ";
  var AddBasketText2=" hinzufügen?";
  if(Lng=="uk"){
    AddBasketText1="add to shopping bag ";
    AddBasketText2=" ?";
  }
  
  var ConfirmText=AddBasketText1+newQty+" x '"+newStyleName+", "+newStyleNumber+", "+newColorName;
  if(newSize > '' && newSize != 0) ConfirmText=ConfirmText+", "+newSize;
  ConfirmText=ConfirmText+"'  EUR "+  newPrice+AddBasketText2;
    LoadBasket();
    PushBasket(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng,newEAN, newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2);
    SaveBasket();
    ReloadBasket();
    return true;
}


//---------- Funktion für Outfit(Farbthemen) -----------------//
function buyOutfitTop(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng, newEAN,newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2){
  if(newQty<=0){
    alert('Die Stückzahl ('+newQty+') ist nicht korrekt!');
    return;
  }

  if(ArrBasket.length>=8){// Max 15 Positionen
    if(Lng=="uk")
      alert("The basket is has reached the limit. Please complete your order by clicking the checkout-button.");
    else 
      alert("Ihr Warenkorb ist voll, bitte lösen Sie zunächst eine Bestellung aus.\n\nAnschließend können Sie Ihren Einkauf mit neuem Warenkorb fortsetzen.");
    return;
  };

  var AddBasketText1="Dem Warenkorb ";
  var AddBasketText2=" hinzufügen?";
  if(Lng=="uk"){
    AddBasketText1="add to shopping bag ";
    AddBasketText2=" ?";
  }
  
  var ConfirmText=AddBasketText1+newQty+" x '"+newStyleName+", "+newStyleNumber+", "+newColorName;
  if(newSize > '' && newSize != 0) ConfirmText=ConfirmText+", "+newSize;
  ConfirmText=ConfirmText+"'  EUR "+  newPrice+AddBasketText2;
  newStyleNumber = '00000';
    LoadBasket();
    PushBasket(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng,newEAN, newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2);
    SaveBasket();
    ReloadBasket();
}


function buyItem2(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng, newEAN,newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2, newATBText1, newATBText2, newATBText3){
  if(newQty<=0){
    alert('Die Stückzahl ('+newQty+') ist nicht korrekt!');
    return;
  }

  if(ArrBasket.length>=8){// Max 15 Positionen
    if(Lng=="uk")
      alert("The basket is has reached the limit. Please complete your order by clicking the checkout-button.");
    else 
      alert("Ihr Warenkorb ist voll, bitte lösen Sie zunächst eine Bestellung aus.\n\nAnschließend können Sie Ihren Einkauf mit neuem Warenkorb fortsetzen.");
    return;
  };

  var AddBasketText1="Dem Warenkorb ";
  var AddBasketText2=" hinzufügen?";
  if(Lng=="uk"){
    AddBasketText1="add to shopping bag ";
    AddBasketText2=" ?";
  }
  
  var ConfirmText=AddBasketText1+newQty+" x "+newStyleName;
  
  if(newSize > '' && newSize != 0) ConfirmText=ConfirmText+", "+newSize;
  ConfirmText=ConfirmText+" bestehend aus:\n\n\t"+ newATBText1 + "\n\t" + newATBText2 + "\n\t" + newATBText3 + "\n\n" + AddBasketText2;
  
  for(var i=1;i<=3;i++) {
  	if(eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i))
    	eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i+'.AddItem()');
  }
  LoadBasket();
  SaveBasket();
  ReloadBasket();
}

// zum kaufen von Outfits 

function buyOutfit(){
 
	var tmpCounter = 0;
	var tmpCounter2 = 0;
	
  for(var i=1;i<=3;i++) // 3 Teile 
  {
  	if(eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i))  // wenn sie existieren
  	{
  		if(eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i).document.forms[0].outfitStyle) // Wenn es kein dummy-Frame ist
  		{
  			tmpCounter2++;
  			var tmpCheck = eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i).document.forms[0].outfitStyle.checked;
  			if(tmpCheck)  // die die Checkbox aktiviert ist
  			{
    			eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i+'.AddItem()'); // führe AddItem() in dem jeweiligen produkt aus
    		}
    		else tmpCounter++;
    	}
    }
  }
  
  if(tmpCounter2==tmpCounter) // falls kein Artikel ausgewählt wurde
   	alert("Bitte wählen Sie mindestens einen Artikel aus!")
}

// zum kaufen von MenOutfits 

function buyMenOutfit(){
 
	var tmpCounter = 0;
	var tmpCounter2 = 0;
	
  for(var i=1;i<=3;i++) // 3 Teile 
  {
  	if(eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i))  // wenn sie existieren
  	{
  		if(eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i).document.forms[0].outfitStyle) // Wenn es kein dummy-Frame ist
  		{
  			tmpCounter2++;
  			var tmpCheck = eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i).document.forms[0].outfitStyle.checked;
  			if(tmpCheck)  // die die Checkbox aktiviert ist
  			{
    			eval('FrameMainMain.FrameMainOver.FrameOutfitStyles.FrameOutfit'+i+'.AddItem()'); // führe AddItem() in dem jeweiligen produkt aus
    		}
    		else tmpCounter++;
    	}
    }
  }
  
  if(tmpCounter2==tmpCounter) // falls kein Artikel ausgewählt wurde
   	alert("Bitte wählen Sie mindestens einen Artikel aus!")
}


// Für Hosenanzüge
function buyHosenAnzug(){
 
	var tmpCounter = 0;
	
  for(var i=1;i<=2;i++) // 3 Teile 
  {
  	if(eval('FrameMainMain.FrameMainOver.FrameHosenAnzugStyles.FrameHosenAnzug'+i))  // wenn sie existieren
  	{
  		var tmpCheck = eval('FrameMainMain.FrameMainOver.FrameHosenAnzugStyles.FrameHosenAnzug'+i).document.forms[0].outfitStyle.checked;
  		if(tmpCheck)  // die die Checkbox aktiviert ist
  		{
    		eval('FrameMainMain.FrameMainOver.FrameHosenAnzugStyles.FrameHosenAnzug'+i+'.AddItem()'); // führe AddItem() in dem jeweiligen produkt aus
    	}
    	else tmpCounter++;
    }
  }
  
  if(tmpCounter>=2) // falls kein Artikel ausgewählt wurde
   	alert("Bitte wählen Sie mindestens einen Artikel aus!")
}

//---
function buyItem3(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng, newEAN,newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2, newATBText1, newATBText2, newATBText3){
  if(newQty<=0){
    alert('Die Stückzahl ('+newQty+') ist nicht korrekt!');
    return;
  }

  if(ArrBasket.length>=8){// Max 15 Positionen
    if(Lng=="uk")
      alert("The basket is has reached the limit. Please complete your order by clicking the checkout-button.");
    else 
      alert("Ihr Warenkorb ist voll, bitte lösen Sie zunächst eine Bestellung aus.\n\nAnschließend können Sie Ihren Einkauf mit neuem Warenkorb fortsetzen.");
    return;
  }
  
  var AddBasketText1="Dem Warenkorb ";
  var AddBasketText2=" hinzufügen?";
  
  var ConfirmText=AddBasketText1+newQty+" x "+newStyleName;
  
  if(newSize > '' && newSize != 0) ConfirmText=ConfirmText+", "+newSize;
  ConfirmText=ConfirmText+" bestehend aus:\n\n\t"+ newATBText1 + "\n\t" + newATBText2 + "\n\t" + newATBText3 + "\n\n" + AddBasketText2;
  
  for(var i=1;i<=2;i++) {
  	//if(eval('FrameMainMain.FrameMainOver.FrameStylesHosenAnzug.FrameHosenAnzug'+i))
  	if(eval('FrameMainMain.FrameMainOver.FrameHosenAnzugStyles.FrameHosenAnzug'+i))
		//eval('FrameMainMain.FrameMainOver.FrameStylesHosenAnzug.FrameHosenAnzug'+i+'.AddItem()');
		eval('FrameMainMain.FrameMainOver.FrameHosenAnzugStyles.FrameHosenAnzug'+i+'.AddItem()');
  }
  LoadBasket();
  SaveBasket();
  ReloadBasket();
}
//--

function buyItemOutfit(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng, newEAN,newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2){

  if(newQty<=0){
    alert('Die Stückzahl ('+newQty+') ist nicht korrekt!');
    return;
  }

  if(8 - ArrBasket.length < 3){// Max 15 Positionen
    if(Lng=="uk")
      alert("The basket is has reached the limit. Please complete your order by clicking the checkout-button.");
    else 
      alert("Ihr Warenkorb ist voll, bitte lösen Sie zunächst eine Bestellung aus.\n\nAnschließend können Sie Ihren Einkauf mit neuem Warenkorb fortsetzen.");
    return;
  };

  var AddBasketText1="Dem Warenkorb ";
  var AddBasketText2=" hinzufügen?";
  if(Lng=="uk"){
    AddBasketText1="add to shopping bag ";
    AddBasketText2=" ?";
  }
  
  var ConfirmText=AddBasketText1+newQty+" x '"+newStyleName+", "+newStyleNumber+", "+newColorName;
  if(newSize > '' && newSize != 0) ConfirmText=ConfirmText+", "+newSize;
  ConfirmText=ConfirmText+"'  EUR "+  newPrice+AddBasketText2;
    LoadBasket();
    PushBasket(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng,newEAN, newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2);
    SaveBasket();
    ReloadBasket();
}


//------------------------------------ ff
function buyItemOutfit2(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng, newEAN,newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2){
  if(newQty<=0){
    alert('Die Stückzahl ('+newQty+') ist nicht korrekt!');
    return;
  }

  if(8 - ArrBasket.length < 3){// Max 15 Positionen
    if(Lng=="uk")
      alert("The basket is has reached the limit. Please complete your order by clicking the checkout-button.");
    else 
      alert("Ihr Warenkorb ist voll, bitte lösen Sie zunächst eine Bestellung aus.\n\nAnschließend können Sie Ihren Einkauf mit neuem Warenkorb fortsetzen.");
    return;
  };

  var AddBasketText1="Dem Warenkorb ";
  var AddBasketText2=" hinzufügen?";
  if(Lng=="uk"){
    AddBasketText1="add to shopping bag ";
    AddBasketText2=" ?";
  }
  
  newStyleName = unescape(newStyleName);
  
  var ConfirmText=AddBasketText1+newQty+" x '"+newStyleName+", "+newStyleNumber+", "+newColorName;
  if(newSize > '' && newSize != 0) ConfirmText=ConfirmText+", "+newSize;
  ConfirmText=ConfirmText+"'  EUR "+  newPrice+AddBasketText2;
    LoadBasket();
    PushBasket(newQty,newStyleNumber, newBest,newDivision,newCategory,newStyleName,newColorName,newColorNumber,newSize,newSizeNo, newPrice,newTax,newLng,newEAN, newNewSale, newAltStyleNr, newSizeThumb, newStyleThumb, newID, newEuroFlag, new2);
    SaveBasket();
    ReloadBasket();
}


// 3 ------------------------------------------------------------
function SaveBasket(){
  CheckPromotionBasket();
  var TheBasket="";  
  for(t=0;t<ArrBasket.length;t++)
    if(ArrBasket[t])
      TheBasket=TheBasket+ArrBasket[t]+'~';
  TheBasket=TheBasket.substring(0,TheBasket.length-1);//Lösche letzte '~', sonst ArrBasket hat ein leeren Eintrag
  var Zeit = new Date();
  var Jetzt = Zeit.getTime();
  Zeit.setTime(Jetzt + 1*24*60*60*500);// 0.5 Tage
  if(Lng == "at")
  {
  	SetCookie('BasketAT',TheBasket,Zeit);
  	if(GetCookie('BasketAT')!=TheBasket)
    	alert("Ihre Sicherheitseinstellungen erlauben nicht das Schreiben von Cookies auf Ihrem PC. \n\nDies ist jedoch Voraussetzung, um im GERRY WEBER Online Shop bestellen zu können. \n\nSie können Ihre Sicherheitseinstellungen jederzeit ändern. \nMehr hierzu finden Sie auf unseren Hilfe-Seiten unter Datensicherheit , \nUnterpunkt Cookie-Einstellungen. \n\nIhr GERRY WEBER eshop Team");
  }
  if(Lng == "de")
  {
  	SetCookie('BasketDE',TheBasket,Zeit);
  	if(GetCookie('BasketDE')!=TheBasket)
    	alert("Ihre Sicherheitseinstellungen erlauben nicht das Schreiben von Cookies auf Ihrem PC. \n\nDies ist jedoch Voraussetzung, um im GERRY WEBER Online Shop bestellen zu können. \n\nSie können Ihre Sicherheitseinstellungen jederzeit ändern. \nMehr hierzu finden Sie auf unseren Hilfe-Seiten unter Datensicherheit , \nUnterpunkt Cookie-Einstellungen. \n\nIhr GERRY WEBER eshop Team");
  }
  if(Lng == "nl")
  {
  	SetCookie('BasketNL',TheBasket,Zeit);
  	if(GetCookie('BasketNL')!=TheBasket)
    	alert("Ihre Sicherheitseinstellungen erlauben nicht das Schreiben von Cookies auf Ihrem PC. \n\nDies ist jedoch Voraussetzung, um im GERRY WEBER Online Shop bestellen zu können. \n\nSie können Ihre Sicherheitseinstellungen jederzeit ändern. \nMehr hierzu finden Sie auf unseren Hilfe-Seiten unter Datensicherheit , \nUnterpunkt Cookie-Einstellungen. \n\nIhr GERRY WEBER eshop Team");
  }
}

// 4 ------------------------------------------------------------
function LoadBasket(){
	
	if(Lng=="at") var TheBasket=GetCookie('BasketAT');
  else if(Lng=="de") var TheBasket=GetCookie('BasketDE');
  else if(Lng=="nl") var TheBasket=GetCookie('BasketNL');
  
  ArrBasket.length=0;
  if(TheBasket!="") ArrBasket=TheBasket.split("~");
  var W_Updated=false;
  var TempArr=new Array();
  var Total_Basket=CheckPromotionBasket();//Bär-Aktion
  
  for(var b=0;b<ArrBasket.length;b++)
  {
    TempArr.length=0;
    TempArr=ArrBasket[b].split("|");
  }
  if(W_Updated) SaveBasket();
}

// 5 ------------------------------------------------------------
function SortBasket(Idx){
  var t=0;
  for(;;){
    if(t>=ArrBasket.length) break;
    if(t<0) break;
    if(ArrBasket[t] && !ArrBasket[t+1]) break;
    if(!ArrBasket[t] || !ArrBasket[t+1]) {alert("Error in SortBasket:" + t); break;};
    var TempItem0=new Array();
    var TempItem1=new Array();
    TempItem0=ArrBasket[t].split("|");
    TempItem1=ArrBasket[t+1].split("|");
    if(TempItem0[Idx]>TempItem1[Idx]) {
      var tBa=ArrBasket[t];
      ArrBasket[t]=ArrBasket[t+1];
      ArrBasket[t+1]=tBa;
      t=t-1;
      continue;
    }
    t++;
  }
}

// 6 ------------------------------------------------------------
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)            
  endstr = document.cookie.length;	               
  return unescape(document.cookie.substring(offset, endstr));
}
	                
// 7 ------------------------------------------------------------
function GetCookie(name){
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var tCookie=document.cookie;
  var i = 0;
  while (i < clen) 
  {
    var j = i + alen;
    if(tCookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = tCookie.indexOf(" ", i) + 1;
    if (i == 0) 
      break; 
  }
  return "";
}

// 8 ------------------------------------------------------------

function SetCookie(name,value,expires){
  var AddStr="; path=/";// Schränkt ein
   AddStr="";

  if(expires!=null)
    AddStr=AddStr+"; expires=" + expires.toGMTString();
  document.cookie = name + "=" + escape(value) + AddStr;
}

// 12 ------------------------------------------------------------

function PushProfil(Val){
  BasketProfil=BasketProfil+""+Val;
  BasketProfil="";
  return BasketProfil;
}

//-----------------------------------
function changeSpaces(theString) {
  var chString='';
  for (var i=0; i <= theString.length; i++)
    if (theString.charAt(i)==' ') 
      chString=chString+'^';
    else
      chString=chString+theString.charAt(i);
  return chString;
}

//-----------------------------------
function replaceSpaces(theString) {
  var chString='';
  for(var i=0;i<=theString.length;i++)
    if (theString.charAt(i)=='^')
       chString=chString+' ';
    else if(theString.substring(i,i+3)=='%5E'){
       chString=chString+' ';
       i=i+2;
    }

    else if(theString.substring(i,i+3)=='%3E'){
       chString=chString+'>';
       i=i+2;
    }

    else
      chString=chString+theString.charAt(i);
  return chString;
}

function DrawNewSale(PreisNew, PreisSale, NewSale, DescStyleFitTip){

  PreisNew=Number(PreisNew);
  PreisSale=Number(PreisSale);

  if(PreisNew==0)
    return "";

  var EuroSymbol="EUR";
  var SieSparen=Number(PreisNew-PreisSale);
  var SieSparenProz=-100*(SieSparen/PreisNew);
  SieSparenProz=Math.round(SieSparenProz+0.000008);
  
  if(NewSale=="sale"){

    return  "<font color='#FF0000'><B>sale</B></font><BR>"+SieSparenProz+"% | "+ToCurr(PreisSale)+" "+EuroSymbol+"<BR><BR>";
  }
  else if(NewSale=="new"){
    return  "<font color='#FF0000'><B>new</B></font><BR>"+ToCurr(PreisNew)+" "+EuroSymbol+"<BR><BR>";
  }
  else{
    return "<BR>"+ToCurr(PreisNew)+" "+EuroSymbol+"<BR><BR>";
  }
}


function CaptionToFileName(CaptionVal){
  var RetVal="";
  var TempVal=""
  for(var c=0;c<CaptionVal.length;c++){
    TempVal=CaptionVal.charAt(c);
    if(TempVal<"0") 
      TempVal="_";
    RetVal=RetVal+TempVal;
  }
  return RetVal;
}

//-----------------------------------

function OnLoadNavi(Welt, Division, Category){

  if(!SetPromotionImage){
    SetTitelImg=false;// Deaktiviert WeltTitel, wenn Auruf vom Basket
    SetNaviPath=true;// Deaktiviert DivisionTitel
   }

  if(Division=="" && Category==""){// Welt
    var Link=RootDir+"HtmlWeltDir/dummy.html";
    if(FrameTop)
     if(FrameTop.SetImage)
      FrameTop.SetImage(Welt);

    if(SetTitelImg){
      Link=RootDir+"HtmlWeltTitle/"+Lng+"/"+Welt+".htm";
      Window_Open(Link,"FrameMainMain");
    }
    SetTitelImg=true;
  }

  if(Division!="")
    if(UserMode=="Sofort")
      UserMode="Surf";
}


function ResetNavi(CurMode){
  UserMode=CurMode;
  Link=RootDir+"HtmlWeltDir/DummyMain.html";
  SetPromotionImage=false;
}

function LoadNaviWelt(Welt){
  SetPromotionImage=true;
  SetNaviPath=false;// Aktiviert DivisionTitel
  LoadNavi(Welt, '', '', '', '', '');	
}

function LoadNavi(strWelt, strDivision, strCategory, strSize, strTarget, strHref, strZusatz, strWin) {
	
  //alert("welt: " + strWelt+ "\ndivision: " + strDivision + "\ncategory: " + strCategory + "\nsize: " + strSize + "\ntarget: " + strTarget + "\nhref: " + strHref + "\nzusatz: " + strZusatz);

	var marke = "";
	if(GWorTC == "GW") marke = "gerryweber";
	if(GWorTC == "TC") marke = "taifun";
	if(GWorTC == "SC") marke = "samoon";

  var NaviLink="";
  var MainLink="";
  
  if(strWelt != "")
		MainLink = LoadServiceSeiten(strWelt);
	
	if(strWin != "")
		MainLink = LoadWin(strWin);
		
  strWelt = strWelt.toLowerCase();
  	
  // Singular --> Plural - Ingo 16.09.05
  
  if(strDivision == "Hose")
  	strDivision = "Hosen";
  if(strDivision == "Rock")
  	strDivision = "Roecke";
  if(strDivision == "Bluse")
  	strDivision = "Blusen";
  if(strDivision == "Shirt")
  	strDivision = "Shirts";
  if(strCategory == "Hose")
  	strCategory = "Hosen";
  if(strCategory == "Rock")
  	strCategory = "Roecke";
  if(strCategory == "Bluse")
  	strCategory = "Blusen";
  if(strCategory == "Shirt")
  	strCategory = "Shirts";
  
  
  // alt 

	if(strWelt == "outfits" && GWorT == "GW")
  	strWelt ="farbthemen";
  	
  if(strWelt == "outfits" && GWorTC == "TC")
  	strWelt ="farbthemen";
  
  if(strWelt == "outfits" && GWorT == "SC")
  	strWelt ="farbthemen";
  
  // neu 
  if(strWelt == "outfits" && GWorT == "GW")
  	strWelt ="farbthemen";
  
  if(strWelt == "outfits" && GWorT == "TC")
  	strWelt ="farbthemen";
  	
  if(strWelt == "outfits" && GWorT == "SC")
  	strWelt ="farbthemen";
  	
/*  if((strWelt == "impressum" || strWelt == "agb" || strWelt == "kontakt") && (GWorT == "T" || GWorT == "GW"))
  	{strWelt = ""+strWelt;} */
  

  if (strWelt != 'vorteile' &&
   		strWelt != 'hotline' && 
   		strWelt != 'basket' && 
   		strWelt != 'london' && 
   		strWelt != 'anmelden' && 
   		strWelt != 'abbestellen' && 
   		strWelt != 'weiter' && 
   		strWelt != 'bestaetigen' &&
   		strWelt != 'basket' &&
   		strWelt != 'kontakt' &&
   		strWelt != 'impressum' &&
   		strWelt != 'agb' &&
   		strWelt != 'hilfe' &&
   		strWelt != 'marken' &&
   		strWelt != 'sitemap' &&
   		strWelt != 'partner' &&
   		strWelt != 'bezugsquellen' &&
   		strWelt != 'vorteile' &&
   		strWelt != 'hotline' &&
   		strWelt != 'fwf' &&
   		strWelt != 'info-service' &&
   		strWelt != 'geburtstag' &&
   		strWelt != 'gewinnspiel' &&
   		strWelt != 'gewinnspiel2' &&
   		strWelt != 'hosenanzug' &&
   		strWelt != 'shopfinder' &&
   		strWelt != 'filialen' &&
   		strWelt != 'katalog' &&
   		strWelt != 'warenkorb' &&
   		strWelt != 'schlossgewinnspiel' &&
//   		strWelt != 'gerryweber_open' &&
//   		strWelt != 'gwopen' &&
   		strWelt != 'dhl' &&
			strWelt.indexOf('gewinnspiel') == -1 &&
   		strWelt.indexOf('popup') == -1 &&
   		strWelt.indexOf('old') == -1 &&
   		strWelt.indexOf("bannerid") == -1 &&
   		strWelt.indexOf("actionid") == -1 && 
   		strWelt.indexOf("search") == -1) 
  {
		if(MainLink=="")
  		MainLink=RootDir+"HtmlWeltDir/"+marke+"/"+Lng+"/"+GWorTC+"_index_"+strWelt+".html"; //RootDir+"start_main_main_"+Lng+".htm";
  }
   
 
  var TO = 150;
  
  if( strDivision=="" && strCategory=="" && strWelt!="" && strTarget!="FrameMainMain" ) {		//target 'FrameMainMain' tritt nur dann ein, wenn der Einstieg NICHT über einen Deeplink geschieht (Weiterleitung auf hogw)
		window.setTimeout('Window_Open("'+MainLink+'","FrameMainMain")',TO);
  }
  
	if(strDivision!="" && strWelt!=""){
  	strDivision = strDivision.replace(/-/gi,"_");
  		if(strWelt == "men")
  		{
   			if(strDivision.indexOf("farbthemen") != -1)
   			{
   				NaviLink = MainLink+"?pageTh="+strCategory;
   			}
   			else
   			{
   				NaviLink = MainLink+"?page="+strDivision; // Unterscheidung zwischen Farbthemen und Normaler Navi
   			}
   		}	
   		else
   		{
   			NaviLink = MainLink+"?page="+strDivision;
    		//prompt('',NaviLink);
    	}
  }
  
  if(strWin != "") 
  {
  	NaviLink = MainLink;
  }

  if(strCategory != ""){
    strCategory=strCategory.replace(/-/gi,"_");
    if(strWelt == "men")
    {
    	if(strDivision.indexOf("farbthemen") != -1)
    		NaviLink=NaviLink+"&subTh="+strCategory;
    	else
    		NaviLink=NaviLink+"&sub="+strCategory;
    }
    else
    	NaviLink=NaviLink+"&sub="+strCategory;
  }

  if(strZusatz != "")
  {
    strZusatz=strZusatz.replace(/-/gi,"_");
     	NaviLink = NaviLink+"&zusatz="+strZusatz;
  }
  
  if(typeof(Size) != "undefined" ) 
  {
  	//Size=Size.replace(/-/gi,"_");
  	NaviLink=NaviLink+"&"+Size;
  }
  
  if(strDivision!="") {
  	if(!window.frames.FrameMainMain) {
  		window.setTimeout('Window_Open("'+NaviLink+'","FrameMainMain")',TO);
  	}
    else {
    	//alert("Window_Open("+NaviLink+",FrameMainMain);")
    	Window_Open(NaviLink,"FrameMainMain");
    }
  }
  else {
  	if(!window.frames.FrameMainMain) {
  		window.setTimeout('Window_Open("'+NaviLink+'","FrameMainMain")',TO);
  	}
    else {
    	Window_Open(NaviLink,"FrameMainMain");
    }
  }
  
	if(strTarget!="" && strHref!="")
	{
	  landingPageSchalten(strTarget, strHref);
	}
	//alert(NaviLink)
	  
}

function landingPageSchalten(strTarget, strHref){
	//-ff landingpage
	if( strTarget=="_self" ){
		setTimeout("FrameMainMain.FrameMainNavi.location.href ='" + top.location.protocol + "//" + top.location.host + strHref + "'",1200);
	}else{
  	if( strTarget!="_top" ){
  		eval(strTarget + ".location.href='" + top.location.protocol + "//" + top.location.host + strHref + "'");
  	}else{
  		eval("window.location.href='" + top.location.protocol + "//" + top.location.host + strHref + "'");
  	}
  }
}	

function LoadWin(strWin)
{
	var MainLink = "";

	if(GWorT=="SC") marke = "samoon";
  if(GWorT=="T") marke = "taifun";
  if(GWorT=="GW") marke = "gerryweber";

/*	
	if(strWin == 'gerryweber_open' || strWin == 'gwopen') {
		Window_Open(RootDir+"HtmlMain/gerryweber/GW_gewinnspiel_gwopen.html","FrameMainMain");
	}
	if(strWin == 'wm2010' || strWin == 'weltmeister' || strWin == 'wm' || strWin == 'weltmeisterschaft') {
		Window_Open(RootDir+"HtmlMain/gerryweber/GW_gewinnspiel_wm2010.html","FrameMainMain");
	}
*/
	if(strWin == 'berlin') {
		Window_Open(RootDir+"HtmlMain/gerryweber/GW_gewinnspiel_berlin.html","FrameMainMain");
	}
	if(strWin == 'aha' || strWin == 'a-ha' ) {
		Window_Open(RootDir+"HtmlMain/gerryweber/GW_gewinnspiel_aha.html","FrameMainMain");
	}
	if(strWin == 'reamonn') {
		Window_Open(RootDir+"HtmlMain/gerryweber/GW_gewinnspiel_reamonn.html","FrameMainMain");
	}
	if(strWin == 'schweden') {
		WinSchweden();
		Window_Open(RootDir+GWorTC+"_start_main_main_"+Lng+".html","FrameMainMain");
	}

	//if(MainLink != "") Window_Open(MainLink,"FrameMainMain");
 	//return MainLink;
}


function LoadServiceSeiten(strWelt)
{
	var MainLink = "";
	
	var marke = "";
  if(GWorT=="SC") marke = "samoon";
  if(GWorT=="T") marke = "taifun";
  if(GWorTC=="TC") marke = "taifun";
  if(GWorT=="GW") marke = "gerryweber";
	
	if(strWelt.indexOf('shopfinder') != -1 || strWelt.indexOf('filialen') != -1)
  {

  	if(strWelt.indexOf("~") != -1)
  	{
  		var shopId = strWelt.split("~");
	 		//MainLink="http://gerryweber.d-sire.com/filialfinder/detail.php?shopid="+shopId[1];
	 		MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_index_filialen.html?shopid="+shopId[1];
	 	}
	 	else
	 	{
	 		//MainLink="http://gerryweber.d-sire.com/filialfinder";
	 		MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_index_filialen.html";
	 	}
	}
	
	
	if(strWelt.indexOf('newsconfirm') != -1)
  {
  	if(strWelt.indexOf("~") != -1)
  	{
  		var tmpLink = strWelt.split("~");
  		
  		MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter.html?ecircleparam="+tmpLink[1];
  	}
  	else
  		MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter.html";
  }
  
  
	
	if(strWelt.indexOf('bestaetigen') != -1)
  {
  	if(strWelt.indexOf("~") != -1)
  	{
  		var status = strWelt.split("~");
	 		MainLink=MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter_bestaetigen.html?status="+status[1];
	 	}
	}

/*
  if(strWelt == 'onlineshop') {
		MainLink=RootDir+GWorTC+"_start_main_main_"+Lng+".html";
  }
*/

  if(strWelt == 'kontakt') 
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_kontakt.html";
  
  if(strWelt == 'impressum')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_impressum.html";
  	
  if(strWelt == 'agb')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_agb.html";
  
  if(strWelt == 'hilfe')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_hilfe.html";
  	
  if(strWelt == 'marken')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_marken.html";
  	
  if(strWelt == 'sitemap')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_sitemap.html";
  
  if(strWelt == 'partner')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_partner.html";
  
  if(strWelt == 'bezugsquellen')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_bezugsquellen.html";
  	
  if(strWelt == 'vorteile')
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_vorteil.html";
  	  	
  	
  if(strWelt == 'basket')
  	MainLink=RootDir+"HtmlBasket/"+marke+"/"+Lng+"/"+GWorTC+"_basket_data.html";
  
  	
  if(strWelt == 'anmelden') {
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter.html";
  }
  
  if(strWelt == 'newsletter') {
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter.html";
  }
    	
  if(strWelt == 'abbestellen') {
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter_abmelden.html";
  }
  
  if(strWelt == 'weiter') {
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter_weiter.html";
  }
  
  if(strWelt == 'aendern') {
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_newsletter_aendern.html";
  }
  
  if(strWelt == 'fwf') {
  	MainLink=RootDir+"HtmlMain/"+marke+"/"+Lng+"/"+GWorTC+"_fwf.html";
  }
  


  if(strWelt == 'katalog') {
		MainLink=RootDir+GWorTC+"_start_main_main_"+Lng+".html";
  	WinKatalogPopup();
  }

  if(strWelt == 'schlossgewinnspiel') {
		MainLink=RootDir+GWorTC+"_start_main_main_"+Lng+".html";
  	WinSchloesser();
  }

  if(strWelt == 'trend' && GWorTC == "GW") {
  	MainLink=RootDir+"HtmlMain/gerryweber/"+Lng+"/GW_trend.html";
  }

  if(strWelt == 'dhl') {
  	MainLink=RootDir+"HtmlWeltTitle/de/GW_dhl_partner.html";
  }

  
	return MainLink;
}

/*
function NaviLoaded(){
  NaviIsLoaded=true;
}
*/


var ShopIsLoaded = false;
function OnLoadShop(){
  /*CheckCount++;
   alert("shopjs "+CheckCount+"\nNaviLoaded "+NaviIsLoaded+"\n"+ShopIsLoaded)
  */
  //alert(ShopIsLoaded)
  if(!ShopIsLoaded) 
    InitShop();
/*
  else
    window.setTimeout("OnLoadShop()",250);
   

  if(CheckCount>=100 && CheckCount<=103){
    ShopIsLoaded=true;
    NaviIsLoaded=true;
    InitShop();
  }
  */
 
}
var PopupKey=GetCookie('Popup');


var strProduct_id;
var strParamColor; 

function InitShop(){
//alert("lade")

  ShopIsLoaded=true;
  var StartDatum = new Date();
  StartZeit = StartDatum.getTime();
  var TitelNummer=0;
  User_ID="";
  TitelNummer=GetCookie('Titel');
  
  
  CAMP = filterParamValue("camp");
  CAMP = (CAMP=="") ? camp_default : CAMP;
  CAMP = GWorTC + "." + CAMP.toUpperCase();
  //CAMP = CAMP.toUpperCase();
	CAMP = CAMP.replace(/_/g,".");
  User_Aufenthalt=CAMP;

  User_Herkunft=GetCookie('User_Herkunft');
  User_ID=GetCookie('User_ID');
  ServerUser_ID=GetCookie('UserId');

  if(User_ID.length<5) 
    Promi=true;

  if(User_ID.length<5) User_ID=Date.parse(Date())/1000;

  var Trenne=User_Aufenthalt.indexOf("://");
  if(Trenne>0) 
    User_Aufenthalt=User_Aufenthalt.substr(Trenne+3, 32);
  Trenne=User_Aufenthalt.indexOf("/");
  if(Trenne>0) 
    User_Aufenthalt=User_Aufenthalt.substr(0, Trenne);

  var Trenne=User_Herkunft.indexOf("://");
  if(Trenne>0) 
    User_Herkunft=User_Herkunft.substr(Trenne+3, 32);

  Trenne=User_Herkunft.indexOf("/");
  if(Trenne>0) 
    User_Herkunft=User_Herkunft.substr(0, Trenne);
    
  if(User_Aufenthalt=="www.house-of-gerryweber.de")
    User_Aufenthalt="A_"+Lng;

  if(User_Herkunft=="www.house-of-gerryweber.de")
    User_Herkunft="H_"+Lng;

  if(User_Herkunft.length<1) 
    User_Herkunft=User_Aufenthalt;
    
/// START 09.08.05
  var SetNewHerkunft=false;
  if(CAMP.indexOf("TD")>0)  SetNewHerkunft=true;
  if(CAMP.indexOf("ZX")>0)  SetNewHerkunft=true;
  if(CAMP.indexOf("CJ")>0)  SetNewHerkunft=true;
  if(CAMP.indexOf("AF")>0)  SetNewHerkunft=true;
  if(SetNewHerkunft)
    User_Herkunft=User_Aufenthalt
/// END 09.08.05


  Tracker=User_ID+' '+User_Herkunft+'->'+User_Aufenthalt;

  var MaxWidth=screen.availWidth;
  if(MaxWidth<950)
    MaxWidth=800;
  else if(MaxWidth<1024)
    MaxWidth=1024;

  var Jetzt = new Date(); 

  TitelNummer++;
  if(TitelNummer>40) //rollierer am 31.01.05 auf 40 erhöht
    TitelNummer=0;  
  var Zeit = new Date();
  var Jetzt = Zeit.getTime();
  Zeit.setTime(Jetzt + 60*24*60*60*1000);// 60 Tage
  SetCookie ('Titel',TitelNummer,Zeit);
  SetCookie ('User_ID',User_ID,Zeit);
  SetCookie ('User_Herkunft',User_Herkunft,Zeit);
  
 	//alert("User_Aufenthalt: "+User_Aufenthalt +"\nUser_Herkunft: "+User_Herkunft)

  if(GetCookie('User_Herkunft')!=User_Herkunft){
    alert("Ihre Sicherheitseinstellungen erlauben nicht das Schreiben von Cookies auf Ihrem PC. \n\nDies ist jedoch Voraussetzung, um im GERRY WEBER Online Shop bestellen zu können.\n\nSie können Ihre Sicherheitseinstellungen jederzeit ändern. \nMehr hierzu finden Sie auf unseren Hilfe-Seiten unter Datensicherheit , \nUnterpunkt Cookie-Einstellungen. \n\nIhr GERRY WEBER eshop Team");
  }

	// Falls parameter vorhanden
  if(StartParam.length > 0)
  {
  	//Nonstop nsctrid Cookie schreiben und aus StartParam löschen
  	paramClear("nsctrid",Zeit,true);
  	// Exelution bannerid aus StartParam löschen
  	paramClear("bannerid",Zeit,false);
  	paramClear("partnerid",Zeit,false); 
  	
  	//Zanox zanpid in Cookie schreiben
  	paramClear("zanpid",Zeit,true);
  	
  	//eCircle Session-Tracking in Cookie schreiben
  	paramClear("uid",Zeit,true);
  	paramClear("mid",Zeit,true);
  	
  	//wt_xx löschen damit die Webtrekkvariablen druchgelassen werden
  	if(StartParam.indexOf("wt_") >= 0)
  	{
  		paramClear("wt_",Zeit,false);
  	}
  	
	  var ParamArr=new Array();
  	StartParam = StartParam.replace(/&amp;/gi, "&");
  	
    ZX_PartnerID				= filterParamValue("tduid");
		strProduct_id 			= filterParamValue("product_id");
		strParamColor 			= filterParamValue("color");
  	var strWelt 				= filterParamValue("welt");
  	var strDivision 		= filterParamValue("division");
  	var strCategory 		=	filterParamValue("category");
  	var strSize 				= filterParamValue("groesse");
  	var strTarget 			= filterParamValue("target"); 
		var strHref 				= filterParamValue("href").replace(/~~/g,"?");
		var strHref 				= strHref.replace(/-~/g,"=");
		var strHref 				= strHref.replace(/~-/g,"&");
		var strMeta					= filterParamValue("meta");
		var strZusatz				= filterParamValue("zusatz");
		var strWin 					= filterParamValue("gewinnspiel");
		var strSearch 			= filterParamValue("search");

//AB alert(escape("http://news.house-of-gerryweber.de/public/subscribe.jsp;jsessionid=0;apw64?sigreq=24223228"))

		if(strProduct_id.length > 0){
	  	NaviAutoSet=true;
	  	SetNaviPath=true;
	  	if(!isNaN(strProduct_id) && strProduct_id.length<8)
	  		strProduct_id = schreibeErsteNull(strProduct_id,8);
			window.setTimeout("SetProdukt(strProduct_id, strParamColor)",1000);
		}
		else if(strWelt != "" || strDivision != "" || strCategory != "" || strSize != "")
		{
			LoadNavi(strWelt, strDivision, strCategory, strSize, strTarget, strHref, strZusatz, strWin);
		}
		else if(strWin != "")
		{
			LoadWin(strWin);
		}
		else if(strSearch != "")
		{
			//http://search20.fact-finder.de/GerryWeber/Search.ff?query=balue+hose&x=43&y=5&m=de
					
			var strFwelt					= filterParamValue("fwelt");
			var strNewSale				= filterParamValue("fnewsale");
			var strMarke				= filterParamValue("fmarke");
			var strGender				= filterParamValue("fgender");
			
			var searchString = "http://search20.fact-finder.de/GerryWeber/Search.ff?query=" + strSearch + "&m="+Lng;
						
			if(strFwelt != "")
				searchString += "&filterWelt="+strFwelt;
			if(strNewSale != "")
				searchString += "&filterNew_Sale="+strNewSale;
			if(strMarke != "")
				searchString += "&filterMarke="+strMarke;
			if(strGender != "")
				searchString += "&filterFuerWen="+strGender;
			
			FrameMainMain.location.href = searchString;
		}

  }

  if(ZX_PartnerID.length>7)
  {
    SetCookie ('ZX_PartnerID',ZX_PartnerID,Zeit);
  }
  else
  {
    ZX_PartnerID=GetCookie('ZX_PartnerID');
  }

  var TimePoint=Date.parse(Date())/1000;
  
  if(isNaN(PopupKey)) 
    PopupKey=0; 
  if(PopupKey == 0){    	
  }

  SetCookie ('Popup',PopupKey,Zeit);

}

var StartFall=0;
var Promi=false;


function schreibeErsteNull(wert, laenge) {
	var tmpWert=wert;
	if(tmpWert.length < laenge) 
	{
		//alert(laenge-tmpWert.length)
		var anzahl = laenge-tmpWert.length;
		for(var i=0;i<anzahl;i++)
			tmpWert = "0"+tmpWert;
	}
	return tmpWert;
}

function SetProdukt(pid,col){
  if(window.location.href.indexOf('frameset') < 0)
  {
  	if(!pid)  //alte Version ohne product_id
  	{
   		FrameMainMain.location.href = "http://www.house-of-gerryweber."+Lng+"/cgi-bin/search_dbid_n2.pl?terms="+StartParam.substr(0,5)+"&language="+Lng+"&marke="+GWorTC+"&Color="+StartParam.substring(6);
   	}
   	else //neue Version mit product_id
   	{
   		FrameMainMain.location.href = "http://www.house-of-gerryweber."+Lng+"/cgi-bin/search_dbid.pl?terms="+pid+"&language="+Lng+"&marke="+GWorTC+"&Color="+col;
   	}
  }
}

  

function ResetNaviAuto(){
  NaviAutoSet=false;
  SetNaviPath=false;  
}

function NaviCount(){
  var TimePoint=Date.parse(Date())/1000;
}

function SetUserMode(NewUserMode){
  UserMode=NewUserMode;
}


// Andreas 12.11.07: Funktion die einen Parameter aus der Variable StartParam löscht und evtl in einen Cookie schreibt
function paramClear(varName,Zeit,cookieBool) {
	
	arrStartParam = StartParam.split("&");
	tmpStartParam = "";
	tmpName = varName;
	for(var i=0; i<arrStartParam.length; i++)
	{

		keyVal = arrStartParam[i].split("=");

		if(keyVal[0].indexOf(varName) >= 0){
			tmpName = keyVal[0];
		}
		
		if(keyVal[0]==tmpName)
		{
			if(cookieBool)
			{	
				if(GetCookie(tmpName) != tmpName) 
				{
					SetCookie (tmpName,"",Zeit);
					SetCookie (tmpName,keyVal[1],Zeit);
				}
			} 
  		tmpStartParam += "";
		}else{
			tmpStartParam += arrStartParam[i] + "&";
		}

	}
	if(tmpStartParam.substr(tmpStartParam.length-1,tmpStartParam.length)=="&")
	{
		tmpStartParam = tmpStartParam.substr(0,tmpStartParam.length-1);
	}	
	StartParam = tmpStartParam;

}

function filterParamValue(paramName) {
	var arrStartParam = StartParam.split("&");
	var Rueckgabe = "";
	for(var i=0; i<arrStartParam.length; i++)
	{
		keyVal = arrStartParam[i].split("=");
		if(keyVal[0].toLowerCase()==paramName)
		{
			Rueckgabe = keyVal[1];
		}
	}
	return Rueckgabe;
}

// Erzeugt Zufallszahl von 0 - n
function zufallszahl(n) {
     zahl = Math.floor(Math.random() * (n + 1));
     return zahl; 
}

function landingPage(objLink, menuwelt){		//-ff landingpage
	
	var currentCamp = "";
	
	if(top.location.pathname.indexOf("index_SC_"+Lng+".html") >= 0 || top.location.pathname.indexOf("index_TC_"+Lng+".html") >= 0 || top.location.pathname.indexOf("index_GW_"+Lng+".html") >= 0 || top.location.pathname.indexOf("/modenews") >= 0 || top.location.pathname.indexOf("/newsletter") >= 0)
	{
		newObjLink = objLink.href.replace(/\?/g,"~~");
		newObjLink = newObjLink.replace(/\&/g,"~-");
		newObjLink = newObjLink.replace(/\=/g,"-~");
		
		if(menuwelt && menuwelt != "")
		{
			menuwelt = "&welt=" + menuwelt;
		}
		else
		{
			menuwelt = "&welt=collection";
		}
		
		tmpLang = Lng;

		// G: Erste drei Zeichen aus der Camp-Variablen entfernen ("GW." || "TC." || "SC.")
		CAMP = CAMP.slice(3);

		// A&G: Entfernen interner Camp-Variablen aus der Webtrekk.ContentId
		if(CAMP != "" && 
			 CAMP.toLowerCase().indexOf("gwhde") == -1 && 
			 CAMP.toLowerCase().indexOf("tchde") == -1 &&
			 CAMP.toLowerCase().indexOf("schde") == -1 &&
			 CAMP.toLowerCase().indexOf("gwhat") == -1 &&
			 CAMP.toLowerCase().indexOf("tchat") == -1 &&
			 CAMP.toLowerCase().indexOf("schat") == -1 &&
			 CAMP.toLowerCase().indexOf("gwhnl") == -1 &&
			 CAMP.toLowerCase().indexOf("tchnl") == -1 &&
			 CAMP.toLowerCase().indexOf("schnl") == -1)
			currentCamp = "camp="+CAMP+"&";
		
		if(location.protocol=="http:" || location.protocol=="https:")
		{
			var taget = (objLink.href.indexOf("pid=") == -1) ? objLink.target : "FrameMainMain";
			
			// so funktioniert auch gerrywever.com
			if(location.host.indexOf(".com") != -1)
			{
				//alert(objLink.href+"\n\n"+newObjLink)
				var tmpHref = newObjLink.substr(objLink.href.indexOf(".com/")+4);
				tmpLang = "de";
			}
			else
				var tmpHref = newObjLink.substr(objLink.href.indexOf("."+tmpLang+"/")+3);
				
			top.location.href = "http://www.house-of-gerryweber."+tmpLang+"/" + location.pathname.substr(location.pathname.lastIndexOf("/")+1) + "?"+currentCamp+"href=" + tmpHref + "&target=" + taget + menuwelt;
		}
	}
}

// Funktion die den Browser und die Version ausgibt

function erkenneBrowser() {
	
	var browserIdent = navigator.userAgent;
	var browser = "";
	var browserVersion = "";
	
	if(browserIdent.indexOf("Firefox") != -1)
	{
		browser = "Firefox";
		browserVersion = browserIdent.substr(browserIdent.indexOf("Firefox"));
		browserVersion = browserVersion.split("/");
		browserVersion = browserVersion[1];
	}
	else if(browserIdent.indexOf("MSIE") != -1)
	{
		browser = "IE";
		browserVersion = browserIdent.substring(browserIdent.indexOf("MSIE"),browserIdent.indexOf("MSIE")+8);
		browserVersion = browserVersion.replace("MSIE ","");
	}
	else if(browserIdent.indexOf("Safari") != -1)
	{
		browser = "Safari";
		if(browserIdent.indexOf("Version") != -1)
		{
			browserVersion = browserIdent.substring(browserIdent.indexOf("Version"),browserIdent.indexOf("Safari"));
			browserVersion = browserVersion.split("/");
			browserVersion = browserVersion[1];
		}
	}
	else if(browserIdent.indexOf("Opera") != -1)
	{
		browser = "Opera";
		browserVersion = browserIdent.substr(browserIdent.indexOf("/"));
	}
	else 
	{
		browser = "sonstiger";
	}
		
	//Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.17
	//Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
	//Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30) 
	//Opera/9.26 (Windows NT 5.0; U; de)

	return browser + "|" + browserVersion;
}

function xAusY(bis,zufallBis) {
	
	var yxzZahl;
	var idArr = new Array();
	var alleArr = new Array();
	
	for(var i=0; i<zufallBis;i++)
		alleArr[i] = i;
	
	for(var i=0; i<bis;i++)
	{
		yxzZahl = parent.zufallszahl(alleArr.length-1);
		//alert("alle zahlen: "+alleArr+"\n Zufallszahl: "+yxzZahl+"\n Gezogen: "+alleArr[yxzZahl])
		idArr[i] = alleArr[yxzZahl];
		alleArr.splice(yxzZahl, 1);
		//alleArr.sort();
	}
	return idArr;
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}


function WinKatalogPopup(){
		window.open('http://www.salescatalog.de/scs/export/C8uQsZJyTXNc/scv.html?mode=catalog&catalogID=3165&campaignID=3171&width=945&height=670&bgcolor=FFFFFF','','location=0, statusbar=0, menubar=0, width=945, height=670');
}


function WinBlumenPopup(){
		window.open('http://www.house-of-gerryweber.de/Shop/Popups/taifun/TC_Blumenaktion.html','Blumenaktion', 'width=591,height=375,scrollbars=no,toolbar=no,status=no,resizable=no,top=100,screenX=100,screenY=100');
}

function WinHasenjagd(){
window.open('https://gerry-weber.adartists-online.net/gerryweber_ostern_2010/','688487','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=688,height=487');void(0);
//		window.open("https://gerry-weber.adartists-online.net/gluecksrad/?h=1", "688487", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=995,height=585");    

}

function WinSchloesser(){
window.open('https://gerry-weber.adartists-online.net/gerryweber_schloss/','688477','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=688,height=477');void(0);
}

function WinSchweden(){
	var gewinnspiel = window.open('https://gerry-weber.adartists-online.net/gerryweber_schweden/','688477','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=688,height=477');
	gewinnspiel.focus();
}

//H?he und Breite des/der FaderDivs(Hinweislayer + Best?tigungslayer) bestimmen

function getPageSize(obj, blnScroller){

	if(blnScroller == undefined) blnScroller = true;

	

	if(obj == undefined) obj = this;

	var xScroll, yScroll;

	if (obj.innerHeight && obj.scrollMaxY) {

		xScroll = obj.document.body.scrollWidth;

		yScroll = obj.innerHeight + obj.scrollMaxY;

	} else if (obj.document.body.scrollHeight > obj.document.body.offsetHeight){ // all but Explorer Mac

		xScroll = obj.document.body.scrollWidth;

		yScroll = obj.document.body.scrollHeight;

	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari

		xScroll = obj.document.body.offsetWidth;

		yScroll = obj.document.body.offsetHeight;

	}

	var windowWidth, windowHeight;

	if (obj.innerHeight) {	// all except Explorer

		windowWidth = obj.innerWidth;

		windowHeight = obj.innerHeight;

	} else if (obj.document.documentElement && obj.document.documentElement.clientHeight) { // Explorer 6 Strict Mode

		windowWidth = obj.document.documentElement.clientWidth;

		windowHeight = obj.document.documentElement.clientHeight;

	} else if (obj.document.body) { // other Explorers

		windowWidth = obj.document.body.clientWidth;

		windowHeight = obj.document.body.clientHeight;

	}



	// for small pages with total height less then height of the viewport

	if(yScroll < windowHeight){

		pageHeight = windowHeight;

	} else {

		pageHeight = yScroll;

	}



	// for small pages with total width less then width of the viewport

	if(xScroll < windowWidth){

		pageWidth = windowWidth;

	} else {

		pageWidth = xScroll;

	}

	pageWidth = (obj.document.body.clientWidth < 826 && !document.all && blnScroller) ? (pageWidth - 16) : pageWidth;

	

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)

	

	return arrayPageSize;

}

//Zeitschaltuhr
function BannerTimer(JahrVon,MonatVon,TagVon,StundeVon,MinuteVon, JahrBis,MonatBis,TagBis,StundeBis,MinuteBis)
{ //-ff liefert 'true' zu einem bestimmten Zeitpunkt  
	var jetztneu = new Date();  
	var Jetzt = Date.UTC(jetztneu.getUTCFullYear(),jetztneu.getUTCMonth(),jetztneu.getUTCDate(),jetztneu.getUTCHours()+1,jetztneu.getUTCMinutes(),jetztneu.getUTCSeconds());
 	MonatVon--; //Date-Monatszählung beginnt bei 0 = Januar  MonatBis--;  
 	if( Jetzt >= Date.UTC(JahrVon,MonatVon,TagVon,StundeVon,MinuteVon,00) && Jetzt <= Date.UTC(JahrBis,MonatBis,TagBis,StundeBis,MinuteBis,00) )  
 	{ //Zeit eintagen jahr->monat ->Tag->Stunde->Minute->Sekunde
  	return true;
 	}
}
