// JavaScript Document
var activeItem = {sPicID:"",sTextID:"",sNewsID:""};
var bHoldItem = false;
var g_objIFrameActor, g_nIFrameOpenerTimerID=null;

function ReplaceCSSClass(objElem, sWhat, sWith, bDoNotAppend)
{
	var sClassName = objElem.className;
	var pattern = new RegExp("(\\W*)\\b(" + sWhat + ")\\b(\\W*)","g");
	// Kommt drin vor?
	if(pattern.test(sClassName))
	{
		// Ersatz-Klasse?
		if(sWith)
		{
			objElem.className = sClassName.replace(pattern,
				function() {
					return(arguments[1] + sWith + arguments[3]);
				}
			);
		}
		else
		{
			objElem.className = sClassName.replace(pattern, "");
		}
	}
	else
	{
	    if(!bDoNotAppend)
		    AppendCSSClass(objElem, sWith);
	}
}

function AppendCSSClass(objElem, sClass)
{
	var sClassName = objElem.className;
	var pattern = new RegExp("\\W*\\b" + sClass + "\\b\\W*","g");
	if(!pattern.test(sClassName) && sClass)
	{
		objElem.className += (sClassName?" ":"") + sClass;
	}
}


onload = function(e) {
	g_objIFrameActor = document.getElementById("facactordata");
	HideIFrame();
};

function GetPageCoords(element)
{
	if(!element) return({x : 0, y : 0, w : 0, h : 0});
	var coords = {x : 0, y : 0, w : element.offsetWidth, h : element.offsetHeight};
	while(element)
	{
		coords.x += element.offsetLeft;
		coords.y += element.offsetTop;
		element = element.offsetParent;
	}
	return coords;
}


function ActorTextOnMouseOver(sPicID, objText, sShowID1)
{
	var sClassOverPic = "facactorsitempicactive";
	var sClassOverText = "facactorsitemtextactive";
	var myPic = document.getElementById(sPicID);
	if(myPic) {
		myPic.className = "facactorsitempic " + sClassOverPic;
	}
	objText.className = "facactorsitemtext " + sClassOverText;
	if(sShowID1) {
		var objShow = document.getElementById(sShowID1);
		if(objShow) {
			objShow.className = objShow.className.replace(/facitemhidden/g, "facitemvisible");
		}
	}
}

function ActorTextOnMouseOut(sPicID, objText, sHideID1)
{
	if(bHoldItem == true) {
		if(activeItem.sPicID == sPicID || activeItem.sTextID == objText.id) {
			return;
		}
	}
	
	var sClassOutPic = "facactorsitempicnormal";
	var sClassOutText = "facactorsitemtextnormal";
	var myPic = document.getElementById(sPicID);
	if(myPic) {
		myPic.className = "facactorsitempic " + sClassOutPic;
	}
	objText.className = "facactorsitemtext " + sClassOutText;
	if(sHideID1) {
		var objHide = document.getElementById(sHideID1);
		if(objHide) {
			objHide.className = objHide.className.replace(/facitemvisible/g, "facitemhidden");
		}
	}
}

function ActorPicOnMouseOver(sTextID, objPic, sShowID1)
{
	var sClassOverText = "facactorsitemtextactive";
	var sClassOverPic = "facactorsitempicactive";
	var myText = document.getElementById(sTextID);
	if(myText) {
		myText.className = "facactorsitemtext " + sClassOverText;
	}
	objPic.className = "facactorsitempic " + sClassOverPic;
	if(sShowID1) {
		var objShow = document.getElementById(sShowID1);
		if(objShow) {
			objShow.className = objShow.className.replace(/facitemhidden/g, "facitemvisible");
		}
	}
	
//	// Laden des IFrames
//	if(g_objIFrameActor)
//	{
//		var sSource = objPic.parentNode.href;
//		var sA = sSource.substring(0,sSource.lastIndexOf("/"));
//		var sB = sSource.substring(sSource.lastIndexOf("/"));
//		sB = sB.substring(0, sB.lastIndexOf(".htm"));
//		sSource = sA + "/vita" + sB + "vita.htm?show=infos";
//		g_objIFrameActor.src = sSource;
//		var objCoords = GetPageCoords(objPic);
//		g_objIFrameActor.style.left = objCoords.x + "px";
//		g_objIFrameActor.style.top = objCoords.y + "px";
//		// Verzgert einschalten:
//		ClearIFrameTimer();
//		g_nIFrameOpenerTimerID = setTimeout("ShowIFrame()",1000);
//	}
}

function ClearIFrameTimer() {
	if(g_nIFrameOpenerTimerID != null)
		clearTimeout(g_nIFrameOpenerTimerID);
	g_nIFrameOpenerTimerID = null;
}
function ShowIFrame() {
	if(g_objIFrameActor)
	{
		g_objIFrameActor.style.visibility = "visible";
		g_objIFrameActor.style.display = "block";
	}
}
function HideIFrame() {
	if(g_objIFrameActor)
	{
		g_objIFrameActor.style.visibility = "hidden";
		g_objIFrameActor.style.display = "none";
	}
}

function ActorPicOnMouseOut(sTextID, objPic, sHideID1)
{
	if(bHoldItem == true) {
		if(activeItem.sPicID == objPic.id || activeItem.sTextID == sTextID) {
			return;
		}
	}

	ClearIFrameTimer();

	if(g_objIFrameActor)
	{
		g_objIFrameActor.style.visibility = "hidden";
		g_objIFrameActor.style.display = "none";
	}

	var sClassOverText = "facactorsitemtextnormal";
	var sClassOutPic = "facactorsitempicnormal";
	var myText = document.getElementById(sTextID);
	if(myText) {
		myText.className = "facactorsitemtext " + sClassOverText;
	}
	objPic.className = "facactorsitempic " + sClassOutPic;
	if(sHideID1) {
		var objHide = document.getElementById(sHideID1);
		if(objHide) {
			objHide.className = objHide.className.replace(/facitemvisible/g, "facitemhidden");
		}
	}
}

function FacOnActorsFilterClicked(sFilterID) {
	var objElem, sTmp,i,j;
	objElem = document.getElementById(sFilterID);
	if(objElem)
	{
		if(objElem.checked)
		{
			switch(sFilterID) {
				case "facactorsall":
					// zeige alle Schauspieler:
					location.replace("factory.actors.test.htm");
					break;
				case "facactorsbeginners":
					// zeige nur beginners:
					location.replace("factory.actors.beginner.htm");
					break;
			}
		}
	}
}

//g_objFilter = { beginners:{
//					"ccaspers":true,
//					"dfey":true,
//					"jjacob":true,
//					"alowygina":true,
//					"lskusz":true,
//					"ssoraya":true,
//					"athieme":true,
//					"dadlhoch":true,
//					"tbreyvogel":true,
//					"bmichael":true,
//					"dprosenc":true
//				} };