/*
 * Auf jeder Seite die Funktion "openPictureWindow_Fever" ersetzen
 */
function New_openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	openPictureWindow_core(imageName,imageWidth,imageHeight,alt,posLeft,posTop, "#FFFFFF");
}

function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	openPictureWindow_core(imageName,imageWidth,imageHeight,alt,posLeft,posTop,"#ffffff");
}
function openPictureWindow_Fever_black(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	openPictureWindow_core(imageName,imageWidth,imageHeight,alt,posLeft,posTop,"#000000");
}

function openPictureWindow_core(imageName,imageWidth,imageHeight,alt,posLeft,posTop,col) {
	var win_w = parseInt(imageWidth)  + 40;
	var win_h = parseInt(imageHeight) + 40;

	var posLeft = Math.round((screen.width  - win_w)/2);
	var posTop  = Math.round((screen.height - win_h)/2);

	newWindow = window.open("","newWindow","width="+win_w+",height="+win_h+",left="+posLeft+",top="+posTop+",resizable=yes,status=no,scrollbars=no");
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title>' + "\n");
	newWindow.document.write('<style type="text/css">body { margin:0; padding;0; }</style></head>' + "\n");
	newWindow.document.write('<body bgcolor="'+col+'" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<table border="0" cellspacing="20" cellpadding="0">' + "\n");
	newWindow.document.write('<tr><td align="center" valign="middle">');
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>');
	newWindow.document.write('</td></tr></table>' + "\n");
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function openGenericWindow_core(swfPfad, swfWidth, swfHeight, swfVersion) {
	var win_w = parseInt(swfWidth)  + 40;
	var win_h = parseInt(swfHeight) + 40;

	var posLeft = Math.round((screen.width  - win_w)/2);
	var posTop  = Math.round((screen.height - win_h)/2);

	newWindow = window.open("../showswf.php?pfad=" + swfPfad + "&v=" + swfVersion + "&w=" + swfWidth + "&h=" + swfHeight,"newSwfWindow","width="+win_w+",height="+win_h+",left="+posLeft+",top="+posTop+",resizable=yes,status=no,scrollbars=no");
	/*
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title>' + "\n");
	newWindow.document.write('<style type="text/css">body { margin:0; padding;0; }</style></head>' + "\n");
	newWindow.document.write('<body bgcolor="'+col+'" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<table border="0" cellspacing="20" cellpadding="0">' + "\n");
	newWindow.document.write('<tr><td align="center" valign="middle">');
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>');
	newWindow.document.write('</td></tr></table>' + "\n");
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	*/
	newWindow.focus();
}

function detectingFLASH() {
  var browser = navigator.userAgent.toLowerCase();
  flashVersion = 0;
	// NS3+, Opera3+, IE5+ Mac
	if ( navigator.plugins != null && navigator.plugins.length > 0 ) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if ( typeof flashPlugin == 'object' ) {
			if ( flashPlugin.description.indexOf('7.') != -1 ) flashVersion = 7;
			else if ( flashPlugin.description.indexOf('6.') != -1 ) flashVersion = 6;
			else if ( flashPlugin.description.indexOf('5.') != -1 ) flashVersion = 5;
			else if ( flashPlugin.description.indexOf('4.') != -1 ) flashVersion = 4;
			else if ( flashPlugin.description.indexOf('3.') != -1 ) flashVersion = 3;
		}
	} // IE4+ Win32 (VBscript)
	else if ( browser.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && browser.indexOf("win")!= -1 && browser.indexOf("16bit")== -1 ) {
	  document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('DIM obFlash \n');
		document.write('SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n');
		document.write('IF IsObject(obFlash) THEN \n');
		document.write('flashVersion = 7 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") END IF \n');
		document.write('IF flashVersion < 7 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 6 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") END IF \n');
		document.write('IF flashVersion < 6 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 5 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") END IF \n');
		document.write('IF flashVersion < 5 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 4 \n');
		document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") END IF \n');
		document.write('IF flashVersion < 4 and IsObject(obFlash) THEN \n');
		document.write('flashVersion = 3 \n');
		document.write('END IF');
	  document.write('</scr' + 'ipt\> \n');
  } // no Flash
  else {
	flashVersion = -1;
  }
return flashVersion;
}

function fotostudio_ref_flash(pfad) {
	var win_w = 800;
	var win_h = 600;

	var schirm_breite = screen.availWidth;
	var schirm_hoehe  = screen.availHeight;

	var posLeft = Math.round((schirm_breite - win_w) / 2);
	var posTop  = Math.round((schirm_hoehe  - win_h) / 2);

	fotorefflash = window.open(pfad, "fotorefflash", "width="+win_w+",height="+win_h+",left="+posLeft+",top="+posTop+",toolbar=0,location=0,directories=0,status=0,resizable=no,toolbar=no,scrollbars=no");
	fotorefflash.focus();
}


// -----------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------


function pop_spezial_e(backPfad, sprache) {
	pfad = '../../../';
	args = pop_spezial_e.arguments;
	if (args.length > 0)
		pfad = args[0];

	pop_spezial(pfad, '_E');
}

function pop_spezial(backPfad, sprache) {
	pfad = '../../../';
	spra = '';

	args = pop_spezial.arguments;
	if (args.length > 0)
		pfad = args[0];
	if (args.length > 1)
		spra = args[1];

	var lang = 'd';
	var winMod = 'scrollbars=no,menubar=no,location=no,border=no,toolbar=no,resizable=no,status=no';
	var w = 600
	var h = 500;
	var xp = Math.round((screen.width  - w) / 2);
	var yp = Math.round((screen.height - h) / 2);
	pop_spezialw = open(pfad+ 'public/ez_spezial' + spra + '/mainFlash/ez_spezial_preloader.php?lang=' + lang,'pop_spezialw','left='+xp+',top='+yp+',width='+w+',height='+h+','+winMod);
	window.setTimeout('pop_spezialw.moveTo('+xp+','+yp+')',200);
	pop_spezialw.focus();
}

function oeffne_zeitlos() {
	if (zeitlos_timer != null)
		clearTimeout(zeitlos_timer);

	MM_showHideLayers('selflahtm','','show');

	layer = MM_findObj('poszeitlos');
	if (layer) {
		if (layer.style) layer = layer.style;
		layer.zIndex = 4;
	}
}

function schliesse_zeitlos() {
	if (zeitlos_timer != null)
		clearTimeout(zeitlos_timer);
	zeitlos_timer = setTimeout("_schliesse_zeitlos()", 500);
}

function _schliesse_zeitlos() {
	MM_showHideLayers('selflahtm','','hide');

	layer = MM_findObj('poszeitlos');
	if (layer) {
		if (layer.style) layer = layer.style;
		layer.zIndex = 1;
	}
}

function myCenterWin(z, w, h) {
	mywinMod = 'scrollbars=auto,menubar=no,location=no,border=no,toolbar=no,resizable=no,status=no';
	x_pos = Math.round((screen.width-w)/2);
	y_pos = Math.round((screen.height-h)/2);
	myCenterWin_Win = open(z,'MYCENTERWIN_WIN','top='+y_pos+',left='+x_pos+',width='+w+',height='+h+','+mywinMod);
	myCenterWin_Win.focus();
}


function bildaktion(ref_id, bild_id, text) {
	ns = (document.layers) ? true : false;
	ie = (document.all) ? true : false;
	n6 = (document.getElementById && !document.all) ? true : false;

	ziel = "gross_" + ref_id;
	bild = "../showimage.php?typ=gr&bild_id=" + bild_id;
	document.images[ziel].src = bild;

	/*
	layr = "grosstxt_" + ref_id;
	if (ie) {
		document.all[layr].innerHTML = text;
	} else if (n6) {
		document.getElementById(layr).innerHTML = text;
	}
	*/
}


// -----------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------


function refResetFrameset() {
	var parentFrameset = parent;
	if (parentFrameset != null) {
		var menuFrame = parentFrameset.referenzen_oben;
		if (menuFrame != null) {
			// Unterscheiden, ob wir auf der Auflistungsseite oder der spezifischen Seite sind
			var work = new String(location.href);
			if (work.indexOf("/html/") > 0) {
				// Wir sind auf der Auflistungsseite
				if (verzeichnisName(menuFrame.location.href) != verzeichnisName(location.href)) {
					menuFrame.location.href = verzeichnisName(location.href) + "/referenzen_oben.php";
				}
			} else {
				// Wir sind auf der spezifischen Seite
				var page = new PageQuery(location.search);

				// Passt der Querystring zum Verzeichnis des Menü-Frames?
				// s = Sprache: 'de' oder 'en'
				// b = Bereich: 'w' (werbeagentur), 'p' (produktion), 'n' (neuemedien)
				var pfad = new String();
				switch (page.getValue('s')) {
					case 'en':
						pfad = 'english';
						break;

					default:
						pfad = 'deutsch';
				}

				var bereich = new String();
				switch (page.getValue('b')) {
					case 'p':
						bereich = 'produktion';
						break;

					case 'n':
						bereich = 'neuemedien';
						break;

					default:
						bereich = 'werbeagentur';
				}

				var noetigerPfad = new String(pfad + '/html/' + bereich);
				var echterPfad   = new String(verzeichnisName(menuFrame.location.href));

				var position	 = echterPfad.indexOf(noetigerPfad);

				if (position < 0) {
					// Pfade passen nicht, Menüframe neu laden
					menuFrame.location.href = "../../" + noetigerPfad + "/referenzen_oben.php";
				}
			}
		}
	}
}

function verzeichnisName(quelle) {
	var work = new String(quelle);
	var spos = work.lastIndexOf("/");
	if (spos > 0) {
		work = work.substr(0, spos);
	}
	return work;
}

function PageQuery(q) {
	if (q.length > 1) {
		this.q = q.substring(1, q.length);
	} else {
		this.q = null;
	}

	this.keyValuePairs = new Array();

	if(q) {
		for (var i = 0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}

	this.getKeyValuePairs = function() {
		return this.keyValuePairs;
	}

	this.getValue = function(s) {
		for (var j = 0; j < this.keyValuePairs.length; j++) {
			if (this.keyValuePairs[j].split("=")[0] == s) {
				return this.keyValuePairs[j].split("=")[1];
			}
		}
		return false;
	}

	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}

	this.getLength = function() {
		return this.keyValuePairs.length;
	}
}

function teaser_wallpaper(pfad) {
	var win_w = 697;
	var win_h = 537;

	var schirm_breite = screen.availWidth;
	var schirm_hoehe  = screen.availHeight;

	var posLeft = Math.round((schirm_breite - win_w) / 2);
	var posTop  = Math.round((schirm_hoehe  - win_h) / 2);

	wallpaperWin = window.open(pfad, "wallpaperWin", "width="+win_w+",height="+win_h+",left="+posLeft+",top="+posTop+",toolbar=0,location=0,directories=0,status=0,resizable=0,toolbar=no,scrollbars=no");
	wallpaperWin.focus();

}

