// tabelle-gen.js

function getSummeTxt (summe)
{
  var summetext;
  if (summe >= 45)
  	   summetext = "Premiumklasse *****"; 
  else if (summe >= 40)
  	   summetext = "Komfortklasse ****"; 
  else if (summe >= 35)
	   summetext = "Luxusklasse ***"; 
  else if (summe >= 30)
	   summetext = "sehr gute Qualität **"; 
  else if (summe >= 25)
	   summetext = "gute Qualität *";
  else if (summe >= 20)
	   summetext = "befriedigende Qualität";
  else if (summe >= 15)
	   summetext = "ausreichende Qualität";
  else if (summe >= 10)
	   summetext = "notfalls noch tragbar";
  else summetext = "unbrauchbar";
  return summetext;
}

function fenster(bild, modell, preis, summe, fazit)
{
  var win=0;
  var posIE5;
  var posIE6;

  win=window.open(bild,"bild","dependent=Yes,width=680,height=660");
  if (navigator.appName == "Microsoft Internet Explorer" || navigator.appName == "Netscape")
  { 
    posIE5 = navigator.appVersion.indexOf("MSIE 5");
  	posIE6 = navigator.appVersion.indexOf("MSIE 6");
 	if (posIE5 > 0 || posIE6 > 0 || navigator.appName == "Netscape")
 		win.window.focus();  
	win.document.open ("text/html");
	win.document.write ('<div align="center"><img src="'+bild+'" border="0" title="'+bild+'"></div><br>');        
	win.document.write ('<table width="660" style="color:darkgoldenrod;font-family:Arial;font-size:11pt;" border="0">');
	win.document.write ('<tr><td width="150"><b>Modell:</b></td><td> '+modell+'</td>');
	win.document.write ('<td rowspan="4" width="100"><div align="center"><input type="BUTTON" value="schließen" onclick="window.close()"></div></td></tr>');        
	win.document.write ('<tr><td width="150"><b>Ausführung-Preis:</b></td><td> '+preis+'</td></tr>');        
  	var summetext = getSummeTxt (summe);
	win.document.write ('<tr><td width="150"><b>Bewertung:</b></td><td> '+summe+' Punkte - '+summetext+'</td></tr>');        
	win.document.write ('<tr><td width="150" style="vertical-align:top;"><b>Fazit:</b></td><td> '+fazit+'</td></tr>'); 
	win.document.write ('</table>');
  }
}

function TabRowStart (idx, text)
{
  document.write('<tr class=');
  if (idx == 2 || idx == 4 || idx == 6 || idx == 8 || idx == 10 || idx == 12 || idx == 14 || idx == 16 || idx == 18 || idx == 20)
  { document.write('"smld">');
	document.write('<td width="450" colspan="2" class="smld">'+idx+' - '+text+'</td>');
  }
  else
  { document.write('"smlh">');
    document.write('<td width="450" colspan="2" class="smlh">'+idx+' - '+text+'</td>');
  }
}

function TabRowEnd (tooltip, text, idx)
{
  document.write('<td width="70" title="'+tooltip+'" class="pkte">'+idx+'</td>');
  document.write('<td width="300">'+text+'</td>');
  document.write('</tr>');
}

function UmschaltTaste (bild)
{
  document.write('<table class="Normal" width="80%" border="0" style="border-style: none">');
  document.write('<tr><td width="30%" style="border-style: none"><div align="left"><img src="'+bild+'" border="0"></div></td>');
//  if(navigator.cookieEnabled == true)
//  {
//    document.write('<td width="30%" style="border-style: none">Tabellendarstellung</td>');
//    document.write('<td width="60%" style="border-style: none" title="Erlaubt die Umstellung zwischen kompakter und ausführlicher Darstellungsweise. Die Auswahl wird in einem Cookie gespeichert und wieder verwendet."><br>');
//  }
  document.write('<form>');
//   if(navigator.cookieEnabled == true)
//   {
//     if (document.cookie == 0)
//   	       document.write('<input type="button" value="ausführlich anzeigen" onClick="neuanzeigen(true);">');
//     else  document.write('<input type="button" value="kompakt anzeigen" onClick="neuanzeigen(false);">');
//   }
//   else    document.write('Umschaltung per Cookie disabled');

  document.write('</form></td></tr></table>');
}

function neuanzeigen (wie)
{
  if (wie == true) // ausführlich
  {
    document.cookie = 1;
  }
  else     // kompakt
  {
    document.cookie = 0;
  }
	location.reload();
	//alert (document.cookie);
}
 
function tabelle (modell,bild,denPreis,w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12,w13,w14,w15,fazit)
{
  var text;
  var tooltip;
  var temp;
  var i;

  var summe = w1+w2+w3+w4+w5+w6+w7+w8+w9+w10+w11+w12+w13+w14+w15; 
  var summetext = getSummeTxt (summe);
 
  document.write('<table border="1">');
  document.write('<tr>');
  document.write('<td width="100" height="75" rowspan="2">&nbsp;');
  document.write('<a href="javascript:fenster(&quot;verpackung/'+bild+'.jpg&quot;,&quot;'+modell+'&quot;,&quot;'+denPreis+'&quot;,&quot;'+summe+'&quot;,&quot;'+fazit+'&quot;)"><img src="verpackung/'+bild+'-1.jpg" border="0"></a></td>');
  document.write('<td width="350" class="head" rowspan="2">'+modell+'</td>');
  document.write('<td width="370" height="10" colspan="2" class="smld">alte Bewertungs-Version</td>');
  document.write('</tr><tr>');
  document.write('<td width="370" height="65" colspan="2" class="head">'+denPreis+'</td>');
  document.write('</tr>');
//if (navigator.cookieEnabled == true && document.cookie == 1 || navigator.cookieEnabled == false)
{
	TabRowStart (1, "Wie fühlt sich die Strumpfhose nach dem Auspacken an");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	  text = "";
	  do {
	  switch (i)
	  { case 0: text="normal";	   break;
	    case 1: text="weich";	   break;
		case 2: text="schön weich";	   break;
	  }
	  if (temp == 0)
	  	 tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	  i ++;
	  } while (i <= 2 && temp == 0);
	  temp ++;
	  i = w1;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w1);
	TabRowStart (2, "Wie lässt sie sich anziehen");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	  text = "";
	  do {
	  switch (i)
	  { case 0: text="schiefes Bein";	   break;
	    case 1: text="enges Höschen";	   break;
	    case 2: text="schiefes Höschen";	   break;
		case 3: text="einwandfrei";	   break;
	  }
	  if (temp == 0)
	  	 tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	  i ++;
	  } while (i <= 3 && temp == 0);
	  temp ++;
	  i = w2;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w2);
	TabRowStart (3, "Wie fühlt sich die Strumpfhose am Bein an");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	  text = "";
	  do {
	  switch (i)
	  { case 0: text="kratzig, hart";	   break;
	    case 1: text="fest";	   break;
	    case 2: text="geht gerade so";	   break;
	    case 3: text="könnte besser sein";	   break;
	    case 4: text="noch weich";	   break;
		case 5: text="weich";	   break;
	    case 6: text="schön weich";	   break;
		case 7: text="besonders weich";	   break;
	  }
	  if (temp == 0)
	  	 tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	  i ++;
	  } while (i <= 7 && temp == 0);
	  temp ++;
	  i = w3;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w3);
	TabRowStart (4, "Passform (ausgehend von meiner Größe 42-44-46)");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	  text = "";
	  do {
	  switch (i)
	  { case 0: text="zu klein";	   break;
	    case 1: text="knapp";	   break;
	    case 2: text="etwas knapp";	   break;
		case 3: text="ausreichend";	   break;
		case 4: text="könnte besser sein";	   break;
		case 5: text="gut";	   break;
		case 6: text="sehr gut";	   break;
		case 7: text="hervorragend";	   break;
	  }
	  if (temp == 0)
	  	 tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	  i ++;
	  } while (i <= 7 && temp == 0);
	  temp ++;
	  i = w4;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w4);
	TabRowStart (5, "Tragekomfort unter einer langen Hose");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	  text = "";
	  do {
	  switch (i)
	  { case 0: text="stark einengend";	   break;
	    case 1: text="etwas einengend";	   break;
	    case 2: text="leicht";	   break;
		case 3: text="schön leicht";	   break;
		case 4: text="angenehm leicht";	   break;
	  }
	  if (temp == 0)
	  	 tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	  i ++;
	  } while (i <= 4 && temp == 0);
	  temp ++;
	  i = w5;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w5);
	TabRowStart (6, "Tragekomfort offen");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	  text = "";
	  do {
	  switch (i)
	  { case 0: text="stark einengend";	   break;
	    case 1: text="etwas einengend";	   break;
	    case 2: text="geht gerade so";	   break;
	    case 3: text="könnte besser sein";	   break;
	    case 4: text="gut";	   break;
	    case 5: text="leicht";	   break;
	    case 6: text="schön leicht";	   break;
		case 7: text="angenehm leicht";	   break;
	  }
	  if (temp == 0)
	  	 tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	  i ++;
	  } while (i <= 7 && temp == 0);
	  temp ++;
	  i = w6;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w6);
	TabRowStart (7, "wahrscheinliche Haltbarkeit");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	  text = "";
	  do {
	  switch (i)
	  { case 0: text="undefinierbar, wg. kleinen Mängeln";	   break;
	    case 1: text="niedrig";	   break;
		case 2: text="schwach";	   break;
		case 3: text="normal";	   break;
		case 4: text="hoch";	   break;
		case 5: text="sehr hoch";	   break;
	  }
	  if (temp == 0)
	  	 tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	  i ++;
	  } while (i <= 5 && temp == 0);
	  temp ++;
	  i = w7;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w7);
	TabRowStart (8, "Maschenbild - Optik");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { 
	      case 0: text="ungleichmäßig, streifig";	   break;
	      case 1: text="gleichmäßig";	   break;
		  case 2: text="fein und gleichmäßig";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 2 && temp == 0);
	   temp ++;
	   i = w8;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w8);
	TabRowStart (9, "Bündchen");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { 
	      case 0: text="vorhanden";	   break;
	      case 1: text="breit";	   break;
		  case 2: text="sehr breit";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 2 && temp == 0);
	   temp ++;
	   i = w9;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w9);
	TabRowStart (10, "Zwickel");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { case 0: text="ohne";	   break;
	      case 1: text="Spitzzwickel";	   break;
		  case 2: text="Baumwollzwickel, Komfortzwickel";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 2 && temp == 0);
	   temp ++;
	   i = w10;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w10);
	TabRowStart (11, "Spitzenverstärkung");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { 
	      case 0: text="dick";	   break;
	      case 1: text="zart, normal";	   break;
		  case 2: text="zart und transparent";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 2 && temp == 0);
	   temp ++;
	   i = w11;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w11);
	TabRowStart (12, "Ausgeformt");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { 
	      case 0: text="nein";	   break;
		  case 1: text="ja, bzw. Rückenschild";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 1 && temp == 0);
	   temp ++;
	   i = w12;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w12);
	TabRowStart (13, "Höschenteil");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { 
	      case 0: text="standard";	   break;
	      case 1: text="fast randlos, ...";	   break;
		  case 2: text="randlos, spezielle Form";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 2 && temp == 0);
	   temp ++;
	   i = w13;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w13);
	TabRowStart (14, "Nähte");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { 
	      case 0: text="standard";	   break;
	      case 1: text="Flachnaht";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 1 && temp == 0);
	   temp ++;
	   i = w14;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w14);
	TabRowStart (15, " Elastananteil");
      i = 0;
	  tooltip = "";
	  temp = 0;
	  do {
	   text = "";
	   do {
	    switch (i)
	    { case 0: text="ohne";	   break;
	      case 1: text="3% oder mehr als 15%";	   break;
	      case 2: text="5...15%";	   break;
		  case 3: text="LYCRA<small><sup>&reg;</sup></small> 3D";	   break;
	    }
	    if (temp == 0)
	  	   tooltip = tooltip + i + '&nbsp;&nbsp;' + text + '\n';
	    i ++;
	   } while (i <= 3 && temp == 0);
	   temp ++;
	   i = w15;
	  } while (temp <= 1);
	TabRowEnd (tooltip, text, w15);


}
  document.write('<tr class="smld">');
  document.write('<td width="450" colspan="2" class="foot"><b>insgesamt</b></td>');

  tooltip = "ab 45: Premiumklasse\nab 40: Komfortklasse\nab 35: Luxusklasse\nab 30: sehr gute Qualität\nab 25: gute Qualität\nab 20: befriedigende Qualität\nab 15: ausreichende Qualität\nab 10: notfalls noch tragbar\ndarunter: unbrauchbar";

  document.write('<td width="70" class="foot" title="'+tooltip+'" style="cursor:help">'+summe+'</td>');
  document.write('<td width="300" class="foot">'+summetext+'</td>');
  document.write('</tr>');
  document.write('<tr class="smlh">');
  document.write('<td width="100" height="20" class="foot">Fazit:</td>');
  document.write('<td colspan="3" height="20" class="foot">'+fazit+'</td>');
  document.write('</tr>');
  document.write('</table>');
}

//--- Script für Übersichtstabelle ---
function TabStart ()
{
  document.write('<table width="98%" border="1" cellspacing="3" cellpadding="0" >');
  document.write('<tr>');
  document.write('<td width="28%" class="head">Marke</td>');
  document.write('<td width="12%" class="head">Bild</td>');
  document.write('<td width="60%" class="head">Kommentar</td>');
  document.write('</tr>');
}

function TabEnde ()
{
  document.write('<tr>');
  document.write('<td width="28%" class="foot">einzelne Wertungen</td>');
  document.write('<td width="12%" class="foot">vergrößertes Bild</td>');
  document.write('<td width="60%" class="smld">alte Bewertung-Version</td>');
  document.write('</tr>');
  document.write('</table>');
}

function Zeile (idx, LinkTxt, modell, bild, denPreis, summe, kommentar)
{
  if (idx == 2)
  { document.write('<tr class="smld">');
    if (LinkTxt.length == 0)
	     document.write('<td width="28%" class="smld">'+modell);
	else document.write('<td width="28%" class="smld"><a href='+LinkTxt+'>'+modell+'</a>');
    document.write('</td>');
    document.write('<td width="12%" class="smld">');
    document.write('<a href="javascript:fenster(&quot;verpackung/'+bild+'.jpg&quot;,&quot;'+modell+'&quot;,&quot;'+denPreis+'&quot;,&quot;'+summe+'&quot;,&quot;'+kommentar+'&quot;)"><img src="verpackung/'+bild+'-1.jpg" border="0"></a>');
    document.write('</td>');
    document.write('<td width="60%" class="smld"><b>');
  }
  else
  { document.write('<tr class="smlh">');
    if (LinkTxt.length == 0)
	     document.write('<td width="28%" class="smlh">'+modell);
	else document.write('<td width="28%" class="smlh"><a href='+LinkTxt+'>'+modell+'</a>');
    document.write('</td>');
    document.write('<td width="12%" class="smlh">');
    document.write('<a href="javascript:fenster(&quot;verpackung/'+bild+'.jpg&quot;,&quot;'+modell+'&quot;,&quot;'+denPreis+'&quot;,&quot;'+summe+'&quot;,&quot;'+kommentar+'&quot;)"><img src="verpackung/'+bild+'-1.jpg" border="0"></a>');
    document.write('</td>');
    document.write('<td width="60%" class="smlh"><b>');
  }
  document.write(summe+'</b> Punkte: &nbsp;&nbsp;'+kommentar+'');
  document.write('</td>');
  document.write('</tr>');
}


