function showmenu(element) {
if(document.getElementById(element)) {
Effect.Appear(element, { duration: 0.7 });
}
if(navigator.appVersion.indexOf("MSIE 6.0") != -1) {
         var img = document.getElementsByTagName("img");
         for (var i = 0; i < img.length; i++) {
         	img[i].src = img[i].src.replace(/transparent/, "ie");
         }
}
//videoplayer();
return false;
}

function videoplayer(format, width, height, video) {
if(navigator.userAgent.indexOf("MSIE") < 1) {
var divwidth = width+10;
var divheight = height+55;
var videowidth = width+0;
var videoheight = height+15;
var content = '<div id="videoplayer" style="display: none; width: ' + divwidth + 'px; height: ' + divheight + 'px;"><div id="prevideo" style="width: ' + videowidth + 'px; height: ' + videoheight + 'px;"></div><div id="closebutton" style="display: none;"><a href="#" onclick="closevideo(\'' + videowidth + '\', \'' + videoheight + '\', \'\'); return false;">Close</a></div></div><div id="overlay" style="display: none;"></div>';
//var content = '<div id="videoplayer" style="display: none; width: 500px; height: 500px;"><div id="prevideo" style="width: 500px; height: 500px;"></div><div id="closebutton"><a href="#" onclick="closevideo(); return false;">Close</a></div></div><div id="overlay" style="display: none;"></div>';
var element = 'main';
/************************/
Element.insert(element, { after: content });
/************************/

var client = {
  viewportWidth: function() {
    return self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);
  },

  viewportHeight: function() {
    return self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);
  },

  viewportSize: function() {
    return { width: this.viewportWidth(), height: this.viewportHeight() };
  }
};
var viewportWidth = client.viewportWidth();
var viewportHeight = client.viewportHeight();
var arrayPageSize = this.getPageSize();
var siteWidth = arrayPageSize[0];
var siteHeight = arrayPageSize[1];
var videoWidth = $('videoplayer').getWidth();
var videoHeight = $('videoplayer').getHeight();

var top = (viewportHeight/2-videoHeight/2)+'px';
var left = (viewportWidth/2-videoWidth/2)+'px';

$('videoplayer').setStyle({
top: top,
left: left
});

$('overlay').setStyle({
width: siteWidth+'px',
height: siteHeight+'px'
});

Effect.Appear('overlay', { duration: 0.0, from: 0.0, to: 0.5 });
if(Effect.Appear('videoplayer', { duration: 0.5 })) {
//Effect.Grow('videoplayer', { duration: 0.5 });
//Effect.Grow('prevideo', { duration: 0.5 });
window.setTimeout("insertplayer('"+format+"', "+videowidth+", "+videoheight+", '"+video+"')", 500);
}

return false;
}
else {
window.location.href = document.getElementsByTagName('base')[0].href + video;
}
}

function insertplayer(format, videowidth, videoheight, video) {
//var content = '<embed src="videos/MP10_h320.mov" height="195" width="320" bgcolor="000000" autoplay="false" showlogo="false" />';
Effect.Appear('closebutton', { duration: 0.0 });
if(format == 'qt') {
	var content = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width='+videowidth+' height='+videoheight+' codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="videoplugin">';
	content += '<param name="src" value="'+video+'">';
	content += '<param name="autoplay" value="true">';
	content += '<param name="showlogo" value="true">';
	content += '<param name="controller" value="true">';
	content += '<embed src="'+video+'" width="'+videowidth+'" height="'+videoheight+'" type="video/quicktime" pluginspace="http://www.apple.com/quicktime/download/" bgcolor="000000" autoplay="true" showlogo="false" controller="true" /></object>';
}
else if(format == 'wm') {
	var content = '<object id="videoplugin" width='+videowidth+' height='+videoheight+' classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject">';
	//content += '<param name="URL" value="'+video+'">';
	content += '<param name="fileName" value="'+video+'">';
	content += '<param name="autoStart" value="true">';
	content += '<param name="uiMode" value="none">';
	content += '<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" bgcolor="000000" width="'+videowidth+'" height="'+videoheight+'" src="'+video+'"></EMBED>';
	content += '</OBJECT>';
}
else if(format == 'img') {
	content = '<img src="'+video+'" alt="Bild in Player" id="videoplugin" width='+videowidth+' height='+videoheight+' style="width: '+videowidth+'px;  height: '+videoheight+'px;" />';
}
else if(format == 'data') {
	content = video;
}


if(format == 'wm' || navigator.appVersion.indexOf("MSIE 6.0") != -1) {
var element = 'videoplayer';
$('prevideo').replace(content);
element.innerHTML;
}
else {
Element.insert('prevideo', { top: content });
}

}

function closevideo(videowidth, videoheight, action) {
if(action != 'remove') {
var content = '<div id="prevideo" style="width: '+videowidth+'px; height: '+videoheight+'px; background-image: none;"></div>';
$('videoplugin').replace(content);
Effect.Appear('overlay', { duration: 0.0, from: 0.5, to: 0.0 });
Effect.Appear('videoplayer', { duration: 0.5, from: 1.0, to: 0.0 });
window.setTimeout("closevideo("+videowidth+", "+videoheight+", 'remove')", 500);
}
else {
$('videoplayer').remove();
$('overlay').remove();
}
}

function hidemenu(element) {
Effect.Fade(element, { duration: 0.5 });
return false;
}

function reload_content(lang, site) {
document.getElementById('center_column').style.display = 'none';
new Ajax.Updater('center_column', 'reload_content.php?lang='+lang+'&site='+site+'', { method: 'get' });
document.getElementById('center_column').style.display = 'none';
setTimeout("reload_content_background('lang', 'site')", 100);
}

function getPageSize() {

	     var xScroll, yScroll;

		if (window.innerHeight && window.scrollMaxY) {
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}

		var windowWidth, windowHeight;

		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth;
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}

		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else {
			pageHeight = yScroll;
		}

		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){
			pageWidth = xScroll;
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}

function show_newsletter() {
Effect.BlindDown('newsletter', { duration: 0.5 }, { scaleY: false }, { scaleContent: false });
return false;
}

function shownews(id) {
Effect.BlindDown('press_'+id+'_div', { duration: 0.5 });
$('press_'+id+'_more').setStyle({
display: 'none'
});
return false;
}

function hidenews(id) {
//Effect.BlindUp('press_'+id+'_div', { duration: 0.5 });
$('press_'+id+'_div').setStyle({
display: 'none'
});
$('press_'+id+'_more').setStyle({
display: 'inline'
});
return false;
}

function html5video(src, poster, width, height) {
  	// Apple detection
	var isiPad 	= navigator.userAgent.match(/iPad/i) != null; 	
	var isiPhone= navigator.userAgent.match(/iPhone/i) != null; 	
	var isiPod	= navigator.userAgent.match(/iPod/i) != null;
	var isFirefox = navigator.userAgent.match(/Firefox/i) != null;
	if(isiPad || isiPhone || isiPod) {		
		var ele = document.getElementById('player1');
		ele.parentNode.removeChild(ele);		
		/*
		var newVideo = document.createElement('video');
		newVideo.setAttribute('id', 'player1');
		var newSrc = document.createElement('source');
		newSrc.setAttribute('src', 'videos/LM_Showreel_480p.ogv');
		document.getElementById('videocontainer').appendChild(newVideo);
		document.getElementById('player1').appendChild(newSrc);
		*/
		document.getElementById('videocontainer').innerHTML = '<video id="vid1" width="'+width+'" height="'+height+'" controls preload'+poster+'><source src="'+src+'.m4v" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' /></video>';
		} 
}



