﻿function wopen(link,wi,he)
{
	wincom = window.open(link ,"fenster","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,screenX=200,screenY=200, left=200, top=200,width="+wi+",height="+he);
	wincom.focus() ;
}


function swap(img_name,img_new)
{
	document.images[img_name].src=img_new;
}

// Seite drucken
function printPage()
{
	print(document);
}

// Text einf?gen
function settext(t){
	document.Angebotsanfrage.Produkte.value += t;
	document.Angebotsanfrage.Produkte.focus();
}






/********** VIDEO LAYER **********/
function toggleLayer() {
	var vl = document.getElementById("videoLayer").style;
	(vl.visibility == "visible") ? vl.visibility = "hidden" : vl.visibility = "visible";
}

function toggleLayer1() {
	var vl = document.getElementById("videoLayer1").style;
	(vl.visibility == "visible") ? vl.visibility = "hidden" : vl.visibility = "visible";
}

function showLayer() {
	var vl = document.getElementById("videoLayer").style;
	//(vl.visibility == "visible") ? vl.visibility = "hidden" : vl.visibility = "visible";
	//pwindow = window.open ("","img","width="+b+",height="+(h+23)+",scrollbars=0,resizable=0,top="+((screen.availHeight - h) / 2)+",left="+((screen.availWidth - b) / 2)+"");
	vl.visibility = "visible";
	//var h = '900px';
	//vl.top = +((screen.availHeight - h) / 2)+ "px";
}

function hideLayer() {
	var vl = document.getElementById("videoLayer").style;
	//(vl.visibility == "visible") ? vl.visibility = "hidden" : vl.visibility = "visible";
	vl.visibility = "hidden";
}


function loadVideo(v){
   document.flvplayer.SetVariable("tflv", "/cms/uploads/tx_FLVPLAYER/"+v);
   showLayer();   
}
/********** ENDE VIDEO LAYER **********/



/********** BILDER SCROLLER **********/

AMS_picture_viwer = function (name, breite, hoehe, vertikal_abstand, horizontal_abstand, rahmenstaerke, rahmenstil, rahmenfarbe, hintergrundfarbe, sroll_variante, scroll_geschwindigkeit) {

	/*
	 * Basis-Klasse dynamischer Bild- Scroller
	 *
	 * AMS_picture_viwer ([Scrollername, [Scrollerbreite, [Scrollerhoehe, [Vertikal Abstand, [Horizontal Abstand, [Rahmenstaerke, [Rahmenstil, [Rahmenfarbe, [Hintergrundfarbe, [Sroll- Variante, [Scroll- Geschwindigkeit]]]]]]]]]]])
	 * +
	 * |
	 * +- init_picture_viwer ()
	 * +- init_picture_viwer_buttons ([Umbruch, optional])
	 * +- add_image ([[Bildpfad, Bildbreite, Bildh?he], [Text oder Bild, [Text oder Bild Boolean]]])
	 *
	 * Parametererkl?rung
	 *
	 * @param name						: string | Scroller- Name / ID
	 * @param breite					: number | Scroller- Breite
	 * @param hoehe						: number | Scroller- H?he
	 * @param vertikal_abstand			: number | Vertikaler abstand, oben und unten
	 * @param horizontal_abstand		: number | Horizontaler abstand, links und rechts
	 * @param rahmenstaerke				: number | Rahmenst?rke
	 * @param rahmenstil				: string | Rahmen-Stil, Werte: dashed, dotted, double, groove, inset, outset, ridge, solid
	 * @param rahmenfarbe				: string | Rahmenfarbe, Hexaangabe (#FF00AA)
	 * @param hintergrundfarbe			: number | Hintergrundfarbe, Hexaangabe (#FF00AA)
	 * @param sroll_variante			: number | Scroll- Variante, 1 = von links nach rechts, 2 = von oben nach unten
	 * @param scroll_geschwindigkeit	: number | Scroll- Geschwindigkeit, je h?her desto langsamer
	 *
	 */

	this.scrollername				= name;

	this.rahmenbreite 				= breite;
	this.rahmenhoehe 				= hoehe;

	this.vertikaler_abstand 		= vertikal_abstand;
	this.horizontaler_abstand 		= horizontal_abstand;

	this.rahmenstaerke				= rahmenstaerke;
	this.rahmenstil					= rahmenstil;
	this.rahmenfarbe 				= rahmenfarbe;

	this.hintergrundfarbe 			= hintergrundfarbe;

	this.sroll_variante 			= sroll_variante;
	this.scroll_geschwindigkeit 	= scroll_geschwindigkeit;

	this.gesamt_groesse 			= 0;
	this.bilder						= [];
	this.popup_bilder				= [];
	this.untertitel					= [];
	this.untertitel_werte			= [];


};

AMS_picture_viwer.prototype.init_picture_viwer = function () {

	if(this.bilder.length < this.untertitel.length) {

		alert("FEHLER\nSie haben weniger Bilder als Untertitel angegeben,\ndiese k?nnte zu Fehlern f?hren.");
		return false;

	} else if(this.bilder.length > this.untertitel.length) {

		alert("FEHLER\nSie haben weniger Untertitel als Bilder angegeben,\ndiese k?nnte zu Fehlern f?hren.");
		return false;

	} else if(this.sroll_variante != 1 && this.sroll_variante != 2) {

		alert("FEHLER\n\"this.srollVariante\" darf nur werte von 0 bis 1 besitzen,\nandernfalls k?nnte es zu Fehlern kommen.");
		return false;
	}

	this.rand_ID 	= new String( Math.floor(Math.random() * 100000000) );
	var output 		= new String();

	output += '<div id="' + this.rand_ID + '" style="';

	if(window.opera == null && document.all) {

		output += 'width:' + ( this.rahmenbreite + (this.horizontaler_abstand * 2) + (this.rahmenstaerke * 2) ) + 'px;';
		output += 'height:' + ( this.rahmenhoehe + (this.vertikaler_abstand * 2) + (this.rahmenstaerke * 2) ) + 'px;';

	} else {

		output += 'width:' + ( this.rahmenbreite + (this.horizontaler_abstand * 2) ) + 'px;';
		output += 'height:' + ( this.rahmenhoehe + (this.vertikaler_abstand * 2) ) + 'px;';
	}

	output += 'border:' + this.rahmenstaerke + 'px ' + this.rahmenstil + ' ' + this.rahmenfarbe + ';';
	output += 'background-color:' + this.hintergrundfarbe + ';';
	output += 'overflow:hidden;';

	if(window.opera == null && document.all) {

		output += 'position:relative;';
	}

	output += '">';

	output += '<div ';
	output += 'id="' + this.scrollername + '" ';
	output += 'style="';

	if(this.sroll_variante == 1) {

		output += 'width:';

	} else if(this.sroll_variante == 2) {

		output += 'height:';
	}

	output += this.gesamt_groesse + 'px;';
	output += 'position:relative;top:0px;left:0px;">';

	for (var y = 0, x = 0; x < this.bilder.length; ++x, ++y) {

		if(y > this.bilder.length - 2) {

			y = -1;
		}

		output += '<div style="';
		output += 'text-align:center;';
		output += 'width:' + ( this.bilder[x][1] + (this.horizontaler_abstand * 2) ) + 'px;';
		output += 'padding-top:' + this.vertikaler_abstand + 'px;';
		output += 'padding-bottom:' + this.vertikaler_abstand + 'px;';

		if(this.sroll_variante == 1) {

			output += 'float:left;';
		}

		output += '"><table width="215" border="0" cellspacing="0" cellpadding="0" height="330"><tr align="center" valign="middle"><td>';

		if(this.popup_bilder[x] != "" && typeof(this.popup_bilder[x]) == "object") {

			output += '<a href="#" onclick="document.getElementById(\'' + this.rand_ID + '\').open_window(\''+this.popup_bilder[x][0]+'\', '+this.popup_bilder[x][1]+', '+this.popup_bilder[x][2]+');return false;" alt="Bitte klicken f&uuml;r gro&szlig;es Bild" title="Bitte klicken f&uuml;r gro&szlig;es Bild">';
		}

		output += '<img src="' + this.bilder[x][0] + '" border="0">';

		if(this.popup_bilder[x] != "" && typeof(this.popup_bilder[x]) == "object") {

			output += '</a>';
		}

		output += '</td></tr></table></div>';
	}


	output += '<br style="font-size:1px;clear:both;" />';
	output += "</div>";
	output += "</div>";

	document.write(output);

	var obj 			= document.getElementById(this.rand_ID);
	obj.scroll_obj		= document.getElementById(this.scrollername);
	obj.scroll_type		= new Number(this.sroll_variante);
	obj.rand_id			= new String(this.rand_ID);
	obj.speed			= new Number(this.scroll_geschwindigkeit);
	obj.interval_1	 	= new Number(0);
	obj.interval_2	 	= new Number(0);

	obj.scroll_calc = function (t, b, c, d) {

		if ((t/=d/2) < 1) {

			return c/2*t*t*t*t*t + b;
		}

		return c/2*((t-=2)*t*t*t*t + 2) + b;
	};

	obj.scroll_display = function (p, d) {

		if(this.count == null) {

			this.count 		= 0;
			this.new_pos 	= p;
			this.obj_pos 	= parseInt((this.scroll_type == 1) ? this.scroll_obj.style.left : this.scroll_obj.style.top);
			this.diff_pos 	= this.new_pos - this.obj_pos;
		}

		if(this.count < d) {

			if(this.scroll_type == 1) {

				this.scroll_obj.style.left = this.scroll_calc (this.count, this.obj_pos, this.diff_pos, d)+"px";

			} else {

				this.scroll_obj.style.top = this.scroll_calc (this.count, this.obj_pos, this.diff_pos, d)+"px";
			}

			this.count++;

			this.interval_1 = setTimeout("document.getElementById('" + this.rand_id + "').scroll_display(" + p + ", " + d + ")", 1);
		}
	};

	obj.run_scroller = function (p) {

		clearTimeout(this.interval_1);

		this.scroll_display(-p, this.speed);

		if(this.count < this.speed) {

			this.interval_2 = setTimeout("document.getElementById('" + this.rand_id + "').run_scroller(" + p + ")", 1);

		} else {

			clearTimeout(this.interval_1);
			clearTimeout(this.interval_2);
		}
	};

	obj.slide_to_pos = function (p) {

		this.count = null;

		clearTimeout(this.interval_1);
		clearTimeout(this.interval_2);

		this.run_scroller(p);
	};

	obj.open_window = function(p, b, h) {

		pwindow = window.open ("","img","width="+b+",height="+(h+23)+",scrollbars=0,resizable=0,top="+((screen.availHeight - h) / 2)+",left="+((screen.availWidth - b) / 2)+"");

		pwindow.document.write ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
		pwindow.document.write ('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">');
		pwindow.document.write ('<head>');
		pwindow.document.write ('<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">');
		pwindow.document.write ('<title>Bild vergr&ouml;&szlig;ert</title>');
		pwindow.document.write ('<style type="text/css"><!-- a.lbase:link, a.lbase:visited { font-family: Verdana,Tahoma,Arial,Helvetica,Geneva,sans-serif; font-size:10px; color:#5C739C; text-decoration:none; letter-spacing:2px; } a.lbase:hover { color:#B30028; text-decoration:underline; } --></style>');
		pwindow.document.write ('</head>');
		pwindow.document.write ('<body onload="focus()" style="padding:0;margin:0;">');
		pwindow.document.write ('<div style="height:19px; background:url(/img/gfx/bg_img.jpg) 0 0 repeat-x; text-align:center; padding-top:4px;"><a href="javascript:window.close();" class="lbase">Fenster schließen</a></div>');
		pwindow.document.write ('<table width="750" border="0" cellspacing="0" cellpadding="0" height="400"><tr align="center" valign="middle"><td><a href="javascript:window.close();"><img src="'+p+'" border="0" /></a></td></tr></table>');
		pwindow.document.write ('</body>');
		pwindow.document.write ('</html>');
		pwindow.document.close();
	};

	obj.set_hover_class = function(rid, obj_num, anzahl) {

		for (var x = 0; x < anzahl; ++x) {

			//document.getElementById("ams_a_"+rid+"_"+x).style.color = "#FFF";
		}

		document.getElementById("ams_a_"+rid+"_"+obj_num).style.color = "#F00";
	};
};

AMS_picture_viwer.prototype.init_picture_viwer_buttons = function () {

	/*
	 * Methode zum setzen der Sroller- Links
	 * Parametererkl?rung
	 *
	 * @param 1 (Optional) : number | Nach wieviel Links ein Umbruch gemacht werden soll
	 * @param 2 (Optional) : array  | Normal und Hover Border-Color [Normal, Hover]
	 *
	 */

	var output = new String();

	for (var x = 0; x < this.bilder.length; ++x) {

		output += '<a href="';
		output += 'javascript:';
		output += 'document.getElementById(\'' + this.rand_ID + '\').slide_to_pos(';

		output += (this.sroll_variante == 1) ?
		(x == 0) ? 0 : (( this.bilder[x][1] + (this.horizontaler_abstand * 2)) * x + 1) :
		(x == 0) ? 0 : (( this.bilder[x][2] + (this.vertikaler_abstand * 2)) * x + 1);
		
		// CEhrhart: Vorangegangene Abfragen um einen Pixel erweitert, damit unschoene Effekte beim Sliden verhindert werden.
		
		output += ');" id="ams_a_'+this.rand_ID+'_'+x+'">';

		if(this.untertitel_werte[x] == true) {

			output += '<img src="' + this.untertitel[x] + '" border="0" id="ams_img_'+this.rand_ID+'_'+x+'">';

		} else if(this.untertitel_werte[x] == false) {

			output += this.untertitel[x];
		}

		output += '</a>';

		if(arguments[0] != null) {

			if(((x+1)%arguments[0]) == 0) {

				output += '<br style="font-size:1px;clear:both;" />';
			}
		}
	}

	document.write(output);

	if(arguments[1] != null && typeof(arguments[1]) == "object" && arguments[1] != "") {

		for (var x = 0; x < this.bilder.length; ++x) {

			if(this.untertitel_werte[x] == true) {

				var a_links = document.getElementById("ams_img_"+this.rand_ID+"_"+x);

				a_links.aktiv = false;
				a_links.rand_id = this.rand_ID;
				a_links.links_anzahl = this.bilder.length;
				a_links.links_normal = arguments[1][0];
				a_links.links_hover = arguments[1][1];

				a_links.onmouseover = function() {

					if(!this.aktiv) {

						this.style.border = this.links_hover;
					}
				};

				a_links.onmouseout = function() {

					if(!this.aktiv) {

						this.style.border = this.links_normal;
					}
				};

				a_links.onmousedown = function() {

					for(var x = 0; x < this.links_anzahl; ++x) {

						document.getElementById("ams_img_"+this.rand_id+"_"+x).style.border = this.links_normal;
						document.getElementById("ams_img_"+this.rand_id+"_"+x).aktiv = false;
					}

					this.aktiv = true;
					this.style.border = this.links_hover;
				};
			}
		}
	}

};

AMS_picture_viwer.prototype.add_image = function (i, p, it, b) {

	/*
	 * Methode zum Initialisieren eines Bildes
	 * Parametererkl?rung
	 *
	 * @param i 	: array 	| [Bildpfad, Bildbreite, Bildh?he]
	 * @param p 	: array 	| [Bildpfad, Bildbreite, Bildh?he] (Popup)
	 * @param it 	: string 	| Text oder Bild
	 * @param b 	: boolean 	| Wenn Text = false, wenn Bild = true
	 *
	 */

	if(typeof(i) != "object" || i.length != 3) {

		alert('FEHLER\nDie erste Parameterangabe bei der Methode "add_image" ist kein Array oder hat weniger oder mehr als 3 Array-Elementen, diese k?nnte zu Fehlern f?hren. Erwartete Array-Elemente sind: Bild-Pfad, Bildbreite, Bildh?he.');
		return false;
	}

	if(this.sroll_variante == 1) {

		this.gesamt_groesse += i[1] + (this.horizontaler_abstand * 2);

	} else if(this.sroll_variante == 2) {

		this.gesamt_groesse += i[2] + (this.vertikaler_abstand * 2);
	}

	this.bilder[this.bilder.length] = i;
	this.popup_bilder[this.popup_bilder.length] = p;
	this.untertitel[this.untertitel.length] = it;
	this.untertitel_werte[this.untertitel_werte.length] = b;
};

	
/**********  ENDE BILDER SCROLLER **********/



function dirtypop(h, b, writer)
{
var generator=window.open('','name','height='+h+',width='+b+'');

generator.document.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>dixi360</title></head><body bgcolor="#ffffff"><!--Im Film verwendete URLs--><!--Im Film verwendeter Text--><!-- saved from url=(0013)about:internet --><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="dixi360" align="middle" height="480" width="480"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="uploads/tx_DIXI360/'+writer+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff"><embed src="uploads/tx_DIXI360/'+writer+'" quality="high" bgcolor="#ffffff" name="dixi360" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" height="480" width="480"></object></body></html>');
generator.document.close();
}



