var txt_array = new Array();
txt_array[0] = translation_obj_array[5].value;
txt_array[1] = translation_obj_array[6].value; // 'Bitte geben Sie hier die Brennweite in mm ohne Eingabe der Ma&szlig;einheit ein.';

var mouseinfo_interval = null;
var offset = 0;

var validation_array = new Array();
validation_array['abstand'] 				= true;
validation_array['brennweite'] 			= true;
validation_array['anschluss'] 			= true;
validation_array['objektgroesse'] 	= true;
validation_array['ccd'] 						= true;

/**
* ein paar Stammdaten
*/

ccd_height_array = new Array();
ccd_height_array[0] = NaN;
ccd_height_array[1] = 2.7;
ccd_height_array[2] = 3.6;
ccd_height_array[3] = 4.8;
ccd_height_array[4] = 6.6;
ccd_height_array[5] = 9.525;

ccd_width_array = new Array();
ccd_width_array[0] = NaN;
ccd_width_array[1] = 3.6;
ccd_width_array[2] = 4.8;
ccd_width_array[3] = 6.4;
ccd_width_array[4] = 8.8;
ccd_width_array[5] = 12.7;

ccd_value_array = new Array();
ccd_value_array[0] = '';
ccd_value_array[1] = '1/4"';
ccd_value_array[2] = '1/3"';
ccd_value_array[3] = '1/2"';
ccd_value_array[4] = '2/3"';
ccd_value_array[5] = '1"';

ccd_id_array = new Array();
ccd_id_array[''] 		 = 0;
ccd_id_array['1/4"'] = 1;
ccd_id_array['1/3"'] = 2;
ccd_id_array['1/2"'] = 3;
ccd_id_array['2/3"'] = 4;
ccd_id_array['1"'] 	 = 5;

/**
* generelles Werte parsen
*/

function parseDistance(user_value)
{
	// regexp = /^\d+ ?[c|m]?m/;
	// alert('test: '+regexp.test(user_value));

//*** zuerst "," umsetzen auf "." wg deutscher Schreibweise

	user_value = user_value.replace(/,/, '.');

//*** danach Zahlenwerte extrahieren und Ma�einheit beachten

	value = parseFloat(user_value);

	if (!isNaN(value))
	{
		cm_test = /cm/;
		mm_test = /mm/;
		km_test = /km/;

		if (cm_test.test(user_value))
		{
			value = value / 100;
		}
		else if (mm_test.test(user_value))
		{
			value = value / 1000;
		}
		else if (km_test.test(user_value))
		{
			value = value * 1000;
		}
	}

	return value;
}


/**
* Brennweiten Bereichnung und Listen Ausgabe
*/

function createLense(anfg_bw,end_bw,form,mount,bezeichnung,bestellcode,blenden_oeffnung,blende,blenden_reg,product_type)
{
	this.anfg_bw 					= parseFloat(anfg_bw);
	this.end_bw  					= (end_bw == '' ? -999.9 : parseFloat(end_bw));
	this.form   					= form;
	this.mount   					= mount;
	this.bezeichnung  		= bezeichnung;
	this.bestellcode  		= bestellcode;
	this.blenden_oeffnung = blenden_oeffnung;
	this.blende  					= blende;
	this.blenden_reg  		= blenden_reg;
	this.lens_type				= (this.end_bw == -999.9 ? 'fix' : 'zoom');
	this.product_type			= product_type;

	return this;
}

function getCCDHeight(ccd_id)
{
	return ccd_height_array[ccd_id];
}

function getCCDWidth(ccd_id)
{
	return ccd_width_array[ccd_id];
}

function getCCDValue(ccd_id)
{
	return ccd_value_array[ccd_id];
}

function getCCDID(ccd_value)
{
	return ccd_id_array[ccd_value];
}

function getAbstandValue()
{
	abstand_value = document.myform.abstand.value;

	if (abstand_value == '')
	{
		validation_array['abstand'] = false;

		//alert(translation_obj_array[7].value);  // 'Bitte geben Sie den Abstand zum Objekt ein.'
		$('#td_abstand').addClass('PE_warning');
	}
	else
	{
		abstand_value = parseDistance(abstand_value);

		if (isNaN(abstand_value))
		{
			validation_array['abstand'] = false;

			alert(translation_obj_array[8].value);  // 'Bitte geben Sie einen numerischen Wert als Abstand zum Objekt ein.'
			$('#td_abstand').addClass('PE_warning');
		}
		else
		{
			validation_array['abstand'] = true;
			$('#td_abstand').addClass('bold');
		}
	}

	return abstand_value;
}

function putAbstandValue(value)
{
	document.myform.abstand.value = value;
}

function getBrennweiteValue()
{
	brennweite_value = document.myform.brennweite.value;

	if (brennweite_value == '')
	{
		validation_array['brennweite'] = false;

		//alert(translation_obj_array[9].value); // 'Bitte geben Sie die Brennweite ein.'
		$('#td_brennweite').addClass('PE_warning');
	}
	else
	{
		if (isNaN(brennweite_value))
		{
			validation_array['brennweite'] = false;

			//alert(translation_obj_array[10].value); // 'Bitte geben Sie einen numerischen Wert als Brennweite.'
			$('#td_brennweite').addClass('PE_warning');
		}
		else
		{
			validation_array['brennweite'] = true;
			$('#td_brennweite').addClass('bold');
		}
	}

	return brennweite_value;
}

function getObjektGroesseValue()
{
	objektgroesse_value = $('#text_objektgroesse').val();

	if (objektgroesse_value == '')
	{
		validation_array['objektgroesse'] = false;

		//alert(translation_obj_array[11].value); // 'Bitte geben Sie die Groesse des Objektes ein.'
		$('#td_objektgroesse').addClass('PE_warning');
	}
	else
	{
		objektgroesse_value = parseDistance(objektgroesse_value);

		if (isNaN(objektgroesse_value))
		{
			validation_array['objektgroesse'] = false;

			//alert(translation_obj_array[12].value); // 'Bitte geben Sie einen numerischen Wert als Gr�sse des Objektes ein.'
			$('#td_objektgroesse').addClass('PE_warning');
		}
		else
		{
			validation_array['objektgroesse'] = true;
			$('#td_objektgroesse').addClass('bold');
		}
	}

	return objektgroesse_value;
}

function getFormCCDID()
{
	ccd_idx = document.myform.ccd.selectedIndex;

	if (ccd_idx == 0)
	{
		validation_array['ccd'] = false;

		ccd_id = NaN;

		//alert(translation_obj_array[13].value);  // 'Bitte w�hlen Sie die Sensorgr��e aus.'
		$('#td_ccd').addClass('PE_warning');
	}
	else
	{
		ccd_id = document.myform.ccd[ccd_idx].value;

		validation_array['ccd'] = true;
		$('#td_ccd').addClass('bold');
	}

	return ccd_id;
}

function getCCDDiagonaleValueByCCDID(ccd_id)
{
	ccd_diagonale = NaN;

	if (validation_array['objektgroesse'])
	{
		if (document.myform.ausrichtung[0].selected)
		{
			$('#td_objektgroesse').addClass('bold');
			ccd_diagonale = getCCDHeight(ccd_id);
		}
		else if (document.myform.ausrichtung[1].selected)
		{
			$('#td_objektgroesse').addClass('bold');
			ccd_diagonale = getCCDWidth(ccd_id);
		}
		else
		{
			validation_array['objektgroesse'] = false;

			alert(translation_obj_array[14].value);  // 'Bitte w�hlen Sie die Ausrichtung des Objektes.'
			$('#td_objektgroesse').addClass('PE_warning');
		}
	}

	return ccd_diagonale;
}

function getAnschlussValue()
{
	var anschluss_value = '';

	if (document.myform.anschluss_c.checked)
	{
		validation_array['anschluss'] = true;

		anschluss_value = 'c';

		$('#td_anschluss').addClass('bold');
	}

	if (document.myform.anschluss_cs.checked)
	{
		validation_array['anschluss'] = true;

		if (anschluss_value == 'c')
		{
			anschluss_value = 'both';
		}
		else
		{
			anschluss_value = 'cs';
		}

		$('#td_anschluss').addClass('bold');
	}

	if (anschluss_value == '')
	{
		validation_array['anschluss'] = false;

		//alert(translation_obj_array[15].value); // 'Bitte w�hlen Sie den Anschluss aus.'
		$('#td_anschluss').addClass('PE_warning');
	}

	return anschluss_value;
}

function calcAbstand()
{
// *** altes Ergebnis zur�cksetzen

	$('#div_ergebnis ipnut').val('-');
	$('#PLUGIN_LS_Lense_list').html('').show();
	$('.PE_warning').removeClass('PE_warning')

// *** Daten holen

	brennweite_value 		= getBrennweiteValue();

	objektgroesse_value = getObjektGroesseValue();

	ccd_id							= getFormCCDID();

	ccd_diagonale				= getCCDDiagonaleValueByCCDID(ccd_id);

//*** �berpr�fung der Daten und Berechnung der Brennweite

	if (validation_array['brennweite']
	&&  validation_array['anschluss']
	&&  validation_array['objektgroesse']
	&& 	validation_array['ccd'])
	{
    q = objektgroesse_value * 1000 / ccd_diagonale;
    s = q+1;
    p = s * brennweite_value;

    abstand = p / 1000;

    abstand = abstand.toFixed(2);

    abstand_out = abstand.replace(/\./g,',')+ ' m';

		$('#div_ergebnis input').val(abstand_out);
	}
	else
	{
		alert(translation_obj_array[16].value); // 'Bitte �berpr�fen/vervollst�ndigen Sie Ihre Eingaben.'
	}

	return false;
}

function calcFixAbstand(brennweite_value)
{
//***	Komma korrigieren in Punkt f�r Float Berechnung

	brennweite_value = brennweite_value.replace(/\,/g,'.');

//*** fixe Daten holen(ausser Brennweite)

	objektgroesse_value = getObjektGroesseValue();

	ccd_id							= getFormCCDID();

	ccd_diagonale				= getCCDDiagonaleValueByCCDID(ccd_id);

//*** Berechnen des Abstandes

  q = objektgroesse_value * 1000 / ccd_diagonale;
  s = q+1;
  p = s * brennweite_value;

  abstand = p / 1000;

  abstand = abstand.toFixed(2);

  abstand_out = abstand.replace(/\./g,',');

//*** korrigierte Ausgabe setzen in das Feld Abstand

	putAbstandValue(abstand_out);
}

function calcBrennweite()
{
// *** altes Ergebnis zur�cksetzen

	$('#div_ergebnis input').val('-');
	$('#PLUGIN_LS_Lense_list').html('').show();
	$('.PE_warning').removeClass('PE_warning')

// *** Daten holen

	abstand_value 			= getAbstandValue();

	objektgroesse_value = getObjektGroesseValue();

	ccd_id							= getFormCCDID();

	ccd_diagonale				= getCCDDiagonaleValueByCCDID(ccd_id);

	anschluss_value 		= getAnschlussValue();

//*** �berpr�fung der Daten und Berechnung der Brennweite

	if (validation_array['abstand']
	&&  validation_array['anschluss']
	&&  validation_array['objektgroesse']
	&& 	validation_array['ccd'])
	{
    q = objektgroesse_value * 1000 / ccd_diagonale;
    //alert(q);

    s = q+1;
    //alert(s);

    p = abstand_value * 1000;
    //alert(p);

    brennweite = p / s;
    //alert(brennweite);

    brennweite = brennweite.toFixed(2);

    brennweite_out = brennweite.replace(/\./g,',')+ ' mm';

		$('#div_ergebnis input').val(brennweite_out);

		displayObjektivListe(brennweite,anschluss_value,ccd_id,1);
	}
	else
	{
		alert(translation_obj_array[16].value); // 'Bitte ueberpruefen/vervollstaendigen Sie Ihre Eingaben.'
	}

	return false;
}

function displayObjektivListe(brennweite, anschluss, ccd_id, type)
{
	var ccd_count 	= 6;
	var lense_count = lense_array.length;
	var bw_toleranz = 0.2; // 20%

	bw = parseFloat(brennweite);

// *** +/- 20% Brennweiten-Toleranz
	brennweite_unteres_limit 	= bw - (bw * bw_toleranz);
	brennweite_oberes_limit 	= bw + (bw * bw_toleranz);

	hits   						= 0;
	html							= '';
	tr_class 					= '';
	table_rows 				= '';
	output_fix_info 	= true;
	output_zoom_info 	= true;

// *** durch alle Objektive loopen

	lense_match_array = new Array;
	lense_match_ctr   = 0;
	lense_search_mode	= 0; // 0 = strict CCD, 1 = all CCDs, 2 = finish loop

	while (lense_match_array.length == 0 && lense_search_mode != 2)
	{
		for (z=0;z<lense_count;z++)
		{
			lense = lense_array[z];

// *** Objektive n�her betrachten, wenn
// *** Anschluss passt
// *** und  Objektiv-Sensorgr��e mit Sensorgr��en Loop �bereinstimmt
// *** type = 2: alle Objektive zeigen

			if ( type == 2
			|| ( ( getCCDID(lense.form) >= ccd_id || lense_search_mode == 1)
			&& (anschluss.toUpperCase() == lense.mount.toUpperCase()
			|| 	anschluss.toUpperCase() == 'CS'
			|| 	anschluss.toUpperCase() == 'BOTH') ) )
			{
				lense_anfg_bw = parseFloat(lense.anfg_bw);
				lense_end_bw	= parseFloat(lense.end_bw);

// *** Objektiv in Suchergebnisliste packen, wenn
// *** und  anfg_bw >= berechneter Brennweite (-20%) und anfg_bw <= berechnete Brennweite (+10%) (bei Festbrennweite Objektiven)
// *** oder anfg_bw <= berechneter Brennweite und end_bw  >= berechneter Brennweite (bei Zoom Objektiven)

				if ( (lense_anfg_bw >= brennweite_unteres_limit && lense_anfg_bw <= brennweite_oberes_limit)
				||   (lense_anfg_bw <= brennweite								&& lense_end_bw	>= brennweite)
				||   (type					== 2) )
				{
					lense_match_array[lense_match_ctr] = z;
					lense_match_ctr++;
				}
			}
		}

// *** kein Objektiv gefunden => lense_search_mode weiterschalten

		if (lense_match_array.length == 0)
		{
			lense_search_mode++;
		}
	}


// *** hier Sucheergebnisliste auswerten und Tabelle bauen


	if (lense_match_array.length > 0)
	{
		var last_lens_type = '';

		for (loop=0;loop<lense_match_array.length;loop++)
		{
			z = lense_match_array[loop];		// ID des Gesamtarrays aus Suchergebnisliste holen
			lense = lense_array[z];					// Objektiv aus Gesamtarray holen

/*
			lense_anfg_bw = parseFloat(lense.anfg_bw);	// nochmal berechnen ... nicht sch�n, aber zweckm��ig
			lense_end_bw	= parseFloat(lense.end_bw);
*/

			if ( last_lens_type != '' && last_lens_type != lense.lens_type )
			{
				table_rows += '</table>\n<table cellspacing="0" id="PE_LS_lensList_zoom">';
				// Hier folgt die Liste der Zoomobjektive. Fuer diese Objektive wurde eine Zoom Animation erstellt. Sobald Sie auf die Bezeichnung klicken, wird die Animation geladen, die Sie oben rechts auf dieser Seite anschauen koennen.
				table_caption ='<caption>'+translation_obj_array[17].value+'</caption>';
				table_rows += table_caption;
				table_rows += createTableHead('zoom');
			}
			else if ( last_lens_type == '' )
			{
				table_rows += '<table cellspacing="0" id="PE_LS_lensList_fix">';
				// Hier folgt die Liste der Objektive mit einer festen Brennweite. Fuer diese Objektive wurde keine Zoom Animation erstellt.
				table_caption ='<caption>'+translation_obj_array[18].value+'</caption>';
				table_rows += table_caption;
				table_rows += createTableHead('fix');
			}

			if ( (lense.anfg_bw >= brennweite_unteres_limit && lense.anfg_bw <= brennweite_oberes_limit)
			||   (lense.anfg_bw <= brennweite								&& lense.end_bw	>= brennweite)
			||   (type					== 2) )
			{
				tr_class = (tr_class == 'PE_oddRow' ? 'PE_evenRow' : 'PE_oddRow' );


// *** Link fuer neue Zoom Animation erstellen (nur bei Zooms)

				if (lense.lens_type == 'zoom')
				{
					if (output_zoom_info)
					{
						output_zoom_info = false;
					}
				}
				else
				{
					if (output_fix_info)
					{
						output_fix_info = false;
					}
				}

				table_rows += createTableRow(lense, tr_class, brennweite, type);

				hits++;
				last_lens_type = lense.lens_type;
			}
		}
	}

// *** Table zusammenbauen

	table = '';

	if (lense_search_mode == 1)
	{
		html += '<div>'+translation_obj_array[48].value+'</div>';
	}

	if (anschluss.toUpperCase() == 'CS')
	{
		// Sie haben den CS Anschluss ausgewaehlt. Bei Einsatz eines 5 mm Zwischenringes koennen Sie neben den CS Objektiven auch C Objektive verwenden.
		html += '<div>'+translation_obj_array[22].value+'</div>';
	}

	if (table_rows != "")
	{
		html += '<p>'+translation_obj_array[23].value+' '+hits+' '+translation_obj_array[24].value+'</p>';
	}

	table += '';

	if (table_rows != '')
	{
		table += table_rows;
		table += '</table>';
	}
	else
	{
		// Es wurden keine geeigneten Objektive gefunden, bitte ueberpruefen Sie Ihre Eingaben in der Berechnung.
		table+= '<div class="PE_warning">'+translation_obj_array[34].value+'</div>';
	}

  html += table;

	$('#PLUGIN_LS_Lense_list').html(html).show();
}

function createTableRow(lense, tr_class, brennweite, type)
{
	var anim_url = abstand_url = '';

// hja, 2008-07-10: Dieser Link sollte aus lense_selector.ini Datei kommen, abhängig von Landessprache, um das richtige Ziel zu erwischen, sofern möglich/vorhanden
// var pentax_url = 'http://www.pentax.de/de/product/'+lense.bestellcode+'/ssd_produkte.php';

	if (lense.product_type == 'security')
	{
		var pentax_url = translation_obj_array[50].value+lense.bestellcode+translation_obj_array[51].value;
	}
	else
	{
		var pentax_url = translation_obj_array[50].value+lense.bestellcode+translation_obj_array[52].value;
	}

	bw = lense.anfg_bw;
	if (lense.lens_type == 'zoom')
	{
		bw +=' - '+lense.end_bw;
// *** z.Zt. bis max. 10x Zoom anzeigen ...
		tmp_ab = lense.anfg_bw.toString().replace(/,/, '.');
		tmp_eb = lense.end_bw.toString().replace(/,/, '.');

		if (tmp_eb / tmp_ab <= 10)
		{
			anim_url 	= 'javascript:loadSliderAnim(\''+bw+'\')';
		}
		else
		{
			// anim_url 	= 'javascript:loadSliderAnim(\''+bw+'\')';

			anim_url = '';
		}

	}
	else
	{
		anim_url = '';

		if (lense.anfg_bw != brennweite	&& type != 2)
		{
			abstand_url = 'javascript:calcFixAbstand(\''+bw+'\')';
		}
	}

// *** float Punkt durch ein Komma ersetzen
	bw = bw.toString().replace(/\./g, ",");

// *** Target bestimmen
	if (typeof partner != 'undefined')
	{
		var target = ' target="PE_SSD_Lens"';
	}
	else
	{
		var target = '';
	}


// *** Tabellen Zeile fuer aktuelles Objektiv ausgeben

	tr  ='<tr class="'+tr_class+'">';
	tr +='<td><a'+ target +' href="'+pentax_url+'">'+lense.bestellcode+'</a></td>';
	tr +='<td>'+lense.bezeichnung+'</td>';
	tr +='<td align="center">'+lense.form+'</td>';
	tr +='<td align="center">'+lense.mount+'</td>';
	tr +='<td align="right">'+bw+' mm</td>';
	tr +='<td align="center">'+lense.blenden_oeffnung+' - '+lense.blende+'</td>';
	tr +='<td align="center">'+lense.blenden_reg+'</td>';

	//tr +='<td align="center"><a href="'+pentax_url+'" target="cctv"><img src="'+IMG_PATH+'world.gif" border="0" width="16" height="16" alt="" title="'+translation_obj_array[19].value+'"></a></td>'; // zur Produktansicht in einem neuen Fenster

	if (anim_url != '')
	{
		tr +='<td align="center"><a href="'+anim_url+'" style="color:#000000; text-decoration:underline"><img src="'+IMG_PATH+'zoom_ani.gif" border="0" width="16" height="16" title="'+translation_obj_array[20].value+'"></a></td>';
	}
	else
	{
		if (abstand_url != '')
		{
			tr +='<td align="center"><a href="'+abstand_url+'" style="color:#000000; text-decoration:underline"><img src="'+IMG_PATH+'calc_distance.gif" border="0" width="16" height="16" title="'+translation_obj_array[21].value+'"></a></td>';
		}
		else
		{
			tr +='<td></td>';
		}
	}

	tr +='</tr>';

	return tr;
}

function createTableHead(mode)
{
	thead = '<thead>';
	thead += '<tr>';
	thead += '<th>'+translation_obj_array[27].value+'</th>';	// Artikel
	thead += '<th>'+translation_obj_array[28].value+'</th>';	// Bezeichnung
	thead += '<th>'+translation_obj_array[29].value+'</th>';	// Format
	thead += '<th>'+translation_obj_array[30].value+'</th>';	// Mount
	thead += '<th>'+translation_obj_array[31].value+'</th>';	// Brennweite
	thead += '<th>'+translation_obj_array[32].value+'</th>';	// Blendenbereich
	thead += '<th>'+translation_obj_array[33].value+'</th>';	// Blendenregelung

	if (mode == 'fix')
	{
		thead += '<th>Fix</th>';
	}
	else
	{
		thead += '<th>'+translation_obj_array[26].value+'</th>';	// Zoom
	}

	thead += '</tr>';
	thead += '</thead>';

	return thead;
}

function displayBrennweiteForm()
{
	var html = '';

// *** bestehende Objektive Liste zur�cksetzen

	$('#PLUGIN_LS_Lense_list').html('').show();
	//setVisibilityByID('PLUGIN_LS_Lense_list','visible')

// *** HTML Formular bauen

	html+= '<form name="myform" onSubmit="return calcBrennweite()">';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="td_ccd">'+translation_obj_array[36].value+'</label>';  // Sensorgr&ouml;&szlig;e (CCD/CMOS)
	html+= '<span><select name="ccd">';
	html+= '<option value="0">'+translation_obj_array[37].value+'</option>'; // Bitte w&auml;hlen
	html+= '<option value="1">1/4"</option>';
	html+= '<option value="2">1/3"</option>';
	html+= '<option value="3">1/2"</option>';
	html+= '<option value="4">2/3"</option>';
	html+= '<option value="5">1"</option>';
	html+= '</select></span>';
	html+= '</div>';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="td_abstand">'+translation_obj_array[38].value+'</label>'; // Abstand
	html+= '<span><input id="text_abstand" type="text" size="5" name="abstand" value="" title="|'+txt_array[0]+'" /></span>';
	html+= '</div>';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="td_objektgroesse"><select name="ausrichtung"><option value="hoehe">'+translation_obj_array[40].value+'</option><option value="beite" selected="selected">'+translation_obj_array[41].value+'</option></select>'+translation_obj_array[39].value+'</label>';  // Gr&ouml;sse des Objektes
	html+= '<span><input id="text_objektgroesse" type="text" size="5" name="objektgroesse" value="" title="|'+txt_array[0]+'" /></span>';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="td_anschluss">'+translation_obj_array[42].value+'</label>';  // Anschluss
	html+= '<span><input type="checkbox" name="anschluss_c" value="1">'+translation_obj_array[43].value+'&nbsp;<br />'; // C-Mount
	html+= '<input type="checkbox" name="anschluss_cs" value="1" checked="checked">'+translation_obj_array[44].value; // CS-Mount
	html+= '</span>';
	html+= '</div>';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="ergebnis">'+translation_obj_array[46].value+'</label>';  // ermittelte Brennweite
	html+= '<span id="div_ergebnis"><input type="text" value="-" size="9" readonly="" /></span>';
	html+= '</div>';
	html+= '<div class="PE_submit">';
	html+= '<input class="PE_btn_calc" type="submit" value="'+translation_obj_array[45].value+'">';  // berechnen
	html+= '</div>';
	html+= '</form>';

	$('#PLUGIN_LS_Calculator').html(html);
	$('#PLUGIN_TAB_Entfernung').removeClass('PE_active');
	$('#PLUGIN_TAB_Brennweite').addClass('PE_active');
	initToolTipps();
}

function displayTabs()
{
	html = '<li id="PLUGIN_TAB_Brennweite" class="PE_active">'+translation_obj_array[31].value+'</li>';
	html+= '<li id="PLUGIN_TAB_Entfernung">'+translation_obj_array[35].value+'</li>';
	$('#PLUGIN_LS_Tabs').html(html);
}

function displayEntfernungForm()
{
	var html = '';

// *** bestehende Objektive Liste zurücksetzen

	$('#PLUGIN_LS_Lense_list').html('').show();
	//setVisibilityByID('PLUGIN_LS_Lense_list','visible')

// *** HTML Formular bauen
	html+= '<form name="myform" onSubmit="return calcAbstand()">';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="td_ccd">'+translation_obj_array[36].value+'</label>'; // Sensorgr&ouml;&szlig;e (CCD/CMOS)
	html+= '<span><select name="ccd">';
	html+= '<option value="0">'+translation_obj_array[37].value+'</option>'; // Bitte w&auml;hlen
	html+= '<option value="1">1/4"</option>';
	html+= '<option value="2">1/3"</option>';
	html+= '<option value="3">1/2"</option>';
	html+= '<option value="4">2/3"</option>';
	html+= '<option value="5">1"</option>';
	html+= '</select></span>';
	html+= '</div>';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="td_brennweite">'+translation_obj_array[31].value+'</label>'; // Brennweite
	html+= '<span><input id="text_brennweite" type="text" size="5" name="brennweite" value="" title="|'+txt_array[1]+'" /></span>';
	html+= '</div>';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="td_objektgroesse"><select name="ausrichtung"><option value="hoehe">'+translation_obj_array[40].value+'</option><option value="beite" selected="selected">'+translation_obj_array[41].value+'</option></select>'+translation_obj_array[39].value+'</label>';  // Gr&ouml;sse des Objektes
	html+= '<span><input id="text_objektgroesse" type="text" size="5" name="objektgroesse" value="" title="|'+txt_array[0]+'"/></span><br />';
	html+= '</div>';
	html+= '<div class="PE_contentPair">';
	html+= '<label id="ergebnis">'+translation_obj_array[47].value+'</label>'; // ermittelter Abstand
	html+= '<span id="div_ergebnis"><input type="text" value="-" size="9" readonly="" /></span>';
	html+= '</div>';
	html+= '<div class="PE_submit">';
	html+= '<input class="PE_btn_calc" type="submit" value="'+translation_obj_array[45].value+'" />';  // berechnen
	html+= '</div>';
	html+= '</form>';

	$('#PLUGIN_LS_Calculator').html(html);
	$('#PLUGIN_TAB_Brennweite').removeClass('PE_active');
	$('#PLUGIN_TAB_Entfernung').addClass('PE_active');

	initToolTipps();
}

function display_all_lenses()
{
	// Params: brennweite, anschluss, ccd_id, type
	displayObjektivListe(1,'C',1,2);
}

function Position(id,left,top,visibility)
{
	this.id 				= id;
	this.left 			= left;
	this.top 				= top;
	this.visibility = visibility;

	return this;
}

function setStartPositions()
{
	position_array = new Array();
	position_array[0] = new Position('PLUGIN_LS_Slider', 0, 10, 'hidden');

	for (z=0;z<position_array.length;z++)
	{
		position_obj = position_array[z];
		setPosForID(position_obj.id,position_obj.left,position_obj.top,position_obj.visibility);
	}
}

function displayDivs()
{
	setVisibilityByID('PLUGIN_LS_Slider', 								'visible');
}
