/*
 * Variablen initialisieren
 */

initialSelectedProduct = 0;
selectedProduct = 0;

defaultcolor = 0;
defaultsurface = 0;

selectedColor = 'sand';
labelColor = '';
colorId = 0;
productColorId = 0;
selectedColorId = 0;
filteredColorId = 0;
isColorSelected = false;

selectedSurface = 'standard';
labelSurface = '';
surfaceId = 0;
productSurfaceId = 0;
selectedSurfaceId = 0;
filteredSurfaceId = 0;
isSurfaceSelected = false;

currentThumbnail = 0;
currentThumbnailId = 0;
currentScrollRange = 0;

imagePath = '';
zoomImage = '';
teaserReference = '';

categoryId = 0;
lang = 1;

downloadArray = new Array();

surfaces = new Array(
				'gerillt', 
				'gebuerstet', 
				'standard', 
				'patiniert', 
				'glasiert'
			);
			
surfaceNames = new Array(
				'gerillt', 
				'geb&uuml;rstet', 
				'standard', 
				'patiniert', 
				'glasiert'
			);


/*
 * setColor(color)
 *  
 * Ordnet Ids zur Identifizierung der Layer in der Farbauswahl und 
 * zugehörige Strings zur Identifizierung der Grafiken zu
 * 
 */

function setColor(color){
	switch (color) {
		case 0:
			showColor(1,'sand');
			break;
		case 1:
			showColor(1,'sand');
			break;
		case 2:
			showColor(2,'beige');
			break;
		case 3:
			showColor(3,'lachs');
			break;
		case 4:
			showColor(4,'pastellrot');
			break;
		case 5:
			showColor(5,'naturrot');
			break;
		case 6:
			showColor(6,'oxydrot');
			break;
		case 7:
			showColor(7,'dunkelrot');
			break;
		case 8:
			showColor(8,'braun');
			break;
		case 9:
			showColor(9,'vulkangrau');
			break;
		case 10:
			showColor(10,'quarzgrau');
			break;
		case 11:
			showColor(11,'eisengrau');
			break;
		case 12:
			showColor(12,'perlgrau');
			break;
		case 13:
			showColor(13,'hellgrau');
			break;
		case 14:
			showColor(14,'elfenbein');
			break;
		case 15:	
			showColor(15,'blaugrau');
			break;
		case 16:
			showColor(16,'tuerkis');
			break;
		case 17:
			showColor(17,'orange');
			break;
		case 18:
			showColor(18,'safran');
			break;
		case 19:
			showColor(19,'bernstein');
			break;
		case 20:
			showColor(20,'champagner');
			break;	
		case 21:
			showColor(21,'creme');
			break;
		case 22:
			showColor(22,'graphitgrau');
			break;
		case 23:
			showColor(23,'graugruen');
			break;
		case 24:
			showColor(24,'hellrot');
			break;
		case 25:
			showColor(25,'karminrot');
			break;
		case 26:
			showColor(26,'kastanienbraun');
			break;
		case 27:
			showColor(27,'lichtgrau');
			break;
		case 28:
			showColor(28,'rose');
			break;
		case 29:
			showColor(29,'rubinrot');
			break;
		case 30:
			showColor(30,'terracottabeige');
			break;
		case 31:
			showColor(31,'terracottagelb');
			break;
		case 32:
			showColor(32,'titangrau');
			break;
		case 33:
			showColor(33,'vulkangrau');
			break;
		case 34:
			showColor(34,'ziegelrot');
			break;																																				
	}	
	selectColor();
}


/*
 * setSurface(surface)
 *  
 * Ordnet Ids zur Identifizierung der Layer in der Oberflächenauswahl und 
 * zugehörige Strings zur Identifizierung der Grafiken zu
 * 
 */

function setSurface(surface){
	switch (surface) {
		case 0:
			showSurface(3,'standard');
			break;
		case 1:
			showSurface(1,'gerillt');
			break;
		case 2:
			showSurface(2,'gebuerstet');
			break;
		case 3:
			showSurface(3,'standard');
			break;
		case 4:
			showSurface(4,'patiniert');
			break;
		case 5:
			showSurface(5,'glasiert');
			break;						
	}	
	selectSurface();
}


/*
 * setSpecialSurface(product)
 *  
 * Definiert die Darstellung der glasierten Oberflächen in Abhängigkeit der konfigurierten Farbe
 * Derzeit gibt es keine expliziten "glasierten Farben" in der Contenido-Konfiguration, daher wird über
 * Stringvergleich der Farbton ausgewertet.
 * 
 * Beispiel: 	naturrot => rot
 * 
 * Paramter: 
 * product:	#alphaton, #longoton
 * 
 */

function setSpecialSurface(product){
	if (selectedColor.indexOf('blau') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/blau_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/blau_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color35').html());
	}
	else if (selectedColor.indexOf('braun') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/braun_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/braun_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color36').html());
	}
	else if (selectedColor.indexOf('gelb') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/gelb_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/gelb_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color37').html());
	}
	else if (selectedColor.indexOf('grau') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/grau_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/grau_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color38').html());
	}
	else if (selectedColor.indexOf('gruen') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/gruen_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/gruen_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color39').html());
	}
	else if (selectedColor.indexOf('orange') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/orange_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/orange_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color40').html());
	}
	else if (selectedColor.indexOf('rot') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/rot_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/rot_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color41').html());
	}
	else if (selectedColor.indexOf('schwarz') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/schwarz_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/schwarz_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color42').html());
	}
	else if (selectedColor.indexOf('weiss') != -1) {
		$(product+' .surfacefilter').attr('src', 'images/content_images/weiss_glasiert_99x55.jpg');
		$(product+' .colorfilter').attr('src', 'images/content_images/weiss_glasiert_99x55.jpg');
		$(product+' .colorvalue').html($('#color43').html());
	}
}