﻿NS4 = (document.layers) ? 1 : 0;
NS5 = (document.getElementById) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
if(IE4 == 1) {
	NS5 = 0;
}

function ShowElement(element, posX, posY, show) {
	if (NS4) {
		document.layers[element].left = posX;
		document.layers[element].top = posY;
		if(show == true) {
			document.layers[element].visibility = "show";
		}
		else {
			document.layers[element].visibility = "hide";
		}
	} 

	if (NS5) {
			document.getElementById(element).style.left = posX;
			document.getElementById(element).style.top = posY;
		if(show == true) {
			document.getElementById(element).style.visibility = "visible";
		}
		else {
			document.getElementById(element).style.visibility = "hidden";
		}
	} 

	if (IE4) {
		document.all[element].style.pixelLeft = posX;
		document.all[element].style.pixelTop = posY;
		if(show == true) {
			document.all[element].style.visibility = "visible";
		}
		else {
			document.all[element].style.visibility = "hidden";
		}
	} 
}

function setStyle(id, color) {

	if(document.all) {
		document.all[id].style.backgroundColor = color;
	}
	else {
		document.getElementById(id).style.backgroundColor = color;
	}
}

function hideLayer(Layer) {
		if (NS4) {
			document.layers[Layer].visibility = "hide";
		} // endif

		if (NS5) {
			document.getElementById(Layer).style.visibility = "hidden";
		} // endelse

		if (IE4) {
			document.all[Layer].style.visibility = "hidden";
		} // endelse

} // end of hideLayer()

function showLayer(Layer) {

		if (NS4) {
			document.layers[Layer].visibility = "visible";
		} // endif


		if (NS5) {
			document.getElementById(Layer).style.visibility = "visible";
		} // endelse


		if (IE4) {
			document.all[Layer].style.visibility = "visible";
		} // endelse
		
} // end of showLayer()

function undisplayLayer(Layer) {
		if (NS4) {
			document.layers[Layer].display = "none";
		} // endif

		if (NS5) {
			document.getElementById(Layer).style.display= "none";
		} // endelse

		if (IE4) {
			document.all[Layer].style.display = "none";
		} // endelse
}

function displayLayer(Layer) {

		if (NS4) {
			document.layers[Layer].display = "inline";
		} // endif


		if (NS5) {
			document.getElementById(Layer).style.display = "inline";
		} // endelse


		if (IE4) {
			document.all[Layer].style.display = "inline";
		} // endelse
}



function changecss(theClass,element,value) {
 var cssRules;
 if (document.all) {
  cssRules = 'rules';
 }
 else if (document.getElementById) {
  cssRules = 'cssRules';
 }
 for (var S = 0; S < document.styleSheets.length; S++){
  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
    document.styleSheets[S][cssRules][R].style[element] = value;
   }
  }
 }	
}

function switchImage(img, url) {
    img.src = url;
}

function switchBackgroundImage(element, img) {
    if(element == null) {
        alert(img);
    }
    element.style.backgroundImage = "url(" + img + ")";
}

function showModalPopup(id) {
    $find(id).show();
}

// SWF referenzieren:
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        // return window[movieName];
        return(document.getElementById(movieName));
    }else{
        if(document[movieName].length != undefined){
            return document[movieName][1];
    }
    return document[movieName];
    }
}


/*

Video laden und abspielen:

    Parameter:
    -----------
    fn: filename (Ohne Ordner)
    w: Video-Breite (width)
    h: Video-Höhe (height)
    col: Farbe des Titels + progress-bar. Format: 0xffffff für weiss, 0xcc0000 für rot, 0x000000 für schwarz, usw.
    vidTitle: Video-Titel

*/

function mPlayVideo(fn, w, h, col, vidTitle) {
    var flashmovie = thisMovie('microPlayer');
    flashmovie.microPlayVideo(fn, w, h, col, vidTitle);
}


// play/pause: (ohne Parameter)
function mToggleVideo() {
    var flashmovie = thisMovie('microPlayer');
    flashmovie.toggleMovie();
}

