// JavaScript Document
// (c) Mag. Andreas Unterhuber
// http://blog.directorgate.com

var menunr = 1;

function dg(obj){return document.getElementById(obj);}

function geschW(url){popup = window.open(url,'Tivoli','scrollbars=yes,resizable=yes,width=720,height=700'); popup.focus(); return false;}

function colorMe(ID){if (ID != menunr) dg('MenuItem' + ID).style.backgroundColor = '#CCCCCC';}
function colorMeN(ID){if (ID != menunr) dg('MenuItem' + ID).style.backgroundColor = '';}
function colorMeL(ID){if (ID != menunr) dg('MenuItem' + ID).style.backgroundImage = 'none';}
function colorMeNL(ID){if (ID != menunr) dg('MenuItem' + ID).style.backgroundImage = 'url(../Pictures/ManueBG.gif)';}

function tM(obj) {if (obj != menunr) obj.style.color = '#000000';}
function tMn(obj) {if (subFunc(obj)) obj.style.color = '#ffffff';}

function vSm(){dg('subMenu').style.visibility = 'visible';}
function hSm(){dg('subMenu').style.visibility = 'hidden';}

function vSm2(){dg('subMenu2').style.visibility = 'visible';}
function hSm2(){dg('subMenu2').style.visibility = 'hidden';}

function doMenu(menunr) {if (dg('MenuItem' + menunr)) {dg('MenuItem' + menunr).style.backgroundColor = '#CCCCCC'; dg('MenuItem' + menunr).childNodes[0].style.color = '#000000';}}
function subFunc(obj){
	if (dg('MenuItem' + menunr)) 
	{return dg('MenuItem' + menunr).childNodes[0] != obj;} 
	else return true;}
	

function hideThemAll(){
	Element.hide('partCR');
	Element.hide('partCE');
	Element.hide('partTM');
	Element.hide('partTS');
	Element.hide('partGM');
	Element.hide('partSE');
	}

function hideSThemAll(){
	Element.hide('ApRi');
	Element.hide('ApDo');
	Element.hide('ApAi');
	}
function StornoI() {
    if (dg('InZa').style.display == 'none') {
        new Effect.BlindDown('InZa');
     }
}

function initSite(){
    if(navigator.userAgent.indexOf('AppleWebKit/') > -1) {dg('Hl').style.paddingBottom = '5px'; dg('Al').style.paddingBottom = '5px'; dg('Rl').style.paddingBottom = '5px';}
}

function runHm(objNr){
	if (dg('Hm' + objNr)) {
		dg('Hm' + objNr).style.color = '#ffffff';
	}
	// Weitere Funktion um Schriftgroesse anzupassen
	if(Prototype.Browser.Gecko && navigator.platform.indexOf('Win32') > -1) {dg('bodyMain').style.fontSize = '11px';}
}

// ##################################################
// 			Some Code
// ##################################################

function popUp(url) {
	window.open(url,"redRef","height=600,width=550,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0," + "resizable=0,scrollbars=1,status=1,toolbar=0");
}
var iMyWidth;
var iMyHeight;
iMyWidth = (window.screen.availWidth/2) - (765/2);
iMyHeight = (window.screen.availHeight/2) - (500/2);
function w(url){popup = window.open(url,'Gallery','scrollbars=no,resizable=no,width=765,height=500,left=' + iMyWidth + ',top=' + iMyHeight + ''); popup.focus(); return false;}

function hFlash(){if (dg('Flash')) dg('Flash').innerHTML = '<img src="../Pictures/Pic-Lagune.jpg" alt="Meran Südtirol" width="715" height="226" />'; }

function showVideo() {
    new Effect.Appear('video');
    //if (dg('movie').style.display == 'none') dg('movie').style.display = '';
	setTimeout(function() {
	var posterlessMovie = AC.Quicktime.packageMovie('Tivoli',
		'../Movies/Gert-Gschwendtner.mov', {width: 400, height: 316, autoplay: true});
	$('movie').appendChild(posterlessMovie);
	}, 2000);
}
function hideVideo() {
    dg('movie').removeChild(dg('movie').firstChild);
    new Effect.Fade('video');
}

// ##################################################
// 			Checkeffect
// ##################################################

window.onerror = handleError; 
var agt=navigator.userAgent.toLowerCase();
var major = parseInt(navigator.appVersion);
var ie  = (agt.indexOf("msie") != -1);
var nav = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)) && (agt.indexOf('opera')==-1));
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1));
var ref = "";
var fref;
var logdom;
var fpage;
var res = "";
var co = 0;
var tz=(new Date()).getTimezoneOffset();
if (major >= 4) {if (ie) { co = screen.colorDepth } else { co = screen.pixelDepth } res = "" + screen.width + "x" + screen.height; }
var tp = ""+escape(document.location.href);
var fl = 0;
var fv = 0;
var sw = 0;
var rp = 0;
var qt = 0;
var wm = 0;
var cetui = GCook('_cetui');
var cetsi = GCook('_cetsi');
if(!cetui){ cetui = SCook('_cetui', "" +  new Date().getTime() + Math.round(Math.random()*21474), 5000); }
if(!cetsi){ cetsi = SCook('_cetsi', "" +  new Date().getTime() + Math.round(Math.random()*21474)); }
if (ie && win ) {
if (window.ActiveXObject) {
for (var t=10;t>=4;t--) {
try {
var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+t+"');");
if (fl) { f=1; fv=t; break; }
}
catch(e) {}
}
}
} else {
detect();
}
try { ref = ceref(); } catch (e) { 
	if(typeof(top.document)=="object") {
		ref=escape(top.document.referrer);
	} 
}
if (( ref=="") || ( ref == undefined )) {
	ref = ""+escape(document.referrer);
}
function ceref() {
	var ref = "";
	if ((top.location == document.referrer) || (top != parent && parent.document.referrer == top.location) ) { 
		ref = ""+escape(top.document.referrer); 
		return ref;
	}
}
function caps () {
if(fref) { ref = escape(fref); }
if(fpage) { tp = escape(fpage); }
if(tp.length > 450) { tp=""; }
return "js=1&co=" + co + "&res="+ res + "&fl=" + fl + "&fv=" + fv + "&sw=" + sw + "&rp=" + rp + "&qt=" + qt + "&wm=" + wm + "&tz=" + tz + "&cetui=" + cetui + "&cetsi=" + cetsi + "&ref=" + ref + "&tp=" + tp;
}
function handleError() { 
return true;
} 
function run_it (client,area,logdom) {
var cc= caps();
if (!logdom) {
	logdom="s2.checkeffect.at";
}
var url = "<img src=\"http://" + logdom + "/?u=" + client + "&area=" + area + "&" + cc + "\" width=1 height=1 border=0 alt='' >";
document.write(url);
}
function run_custm(client,act,tokn,logdom){
if (!logdom) {
	logdom=client + ".log.checkeffect.at";
}
var mydate = new Date();
var url = "<img src=\"http://" + logdom + "/" + act + "/" + client + "/" + tokn + "/" + mydate.getTime() + "\" width=1 height=1 border=0 alt='' >";
document.write(url);
}
function detect (Name) {
if (navigator.plugins && navigator.plugins.length) {
 for(i=0; i<navigator.plugins.length; ++i) {
  var str = navigator.plugins[i].name.toLowerCase();
  if (str.indexOf("quicktime") != -1) { qt=1;	}
  if (str.indexOf("windows media") != -1) { wm=1;	}
  if (str.indexOf("shockwave for director") != -1) { sw=1; }
  if (str.indexOf("shockwave flash") != -1) { fl=1; var da = navigator.plugins[i].description.split(" "); var tda = da[2].split("."); fv = tda[0]; }
  if (str.indexOf("realplayer") != -1) { rp=1; }
 }
}
}
function GCook(name) {
var result = null;
var myCookie = " " + document.cookie + ";";
var searchName = " " + name + "=";
var startOfCookie = myCookie.indexOf(searchName);
var endOfCookie;
if (startOfCookie != -1 ) {
	startOfCookie +=searchName.length;
	endOfCookie = myCookie.indexOf(";", startOfCookie);
	result = unescape(myCookie.substring(startOfCookie, endOfCookie));
}
return result;
}
function SCook(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
return value;
}