//var swf_root = "http://www.praxis-am-savignyplatz.de/media/";
//var pic_root = "http://www.praxis-am-savignyplatz.de/pics/bg/";

var baseDIR = "http://www.praxis-am-savignyplatz.de/";
var swf_root = "/./media/";
var pic_root = "/./pics/bg/";
var bubble_root = "/./pics/";
/* CONTENT DISPLAY */
// ++++++++++++++++++++++++++++++++ NAVIGATION
function swapBG(obj,selection)
{	/**
		*	replace background-image for element (node_id)
	*/
	var tmpNode;
	node_id = obj.parentNode.parentNode.id;
	circle_size = 128;
	posID = node_id.split("_")[1];
	t_pos = posData[posID][0];
	l_pos = posData[posID][1];
	
	if(document.getElementById(node_id))
	{
		tmpNode = document.getElementById(node_id);
		swap_pic = (posData[posID][2] == "A") ? "blue" : "yellow";
		switch(selection)
		{	// REMOVE BUBBLE
			case 0 :	try{	param = "position:absolute;top:"+t_pos+"px;left:"+l_pos+"px;background:url('"+bubble_root+"circle_"+swap_pic+".png') center no-repeat;";
								tmpNode.setAttribute("style",param,"false");
								try{	tmpNode.style.setAttribute("background","url('"+bubble_root+"circle_"+swap_pic+".png') center no-repeat","false");}
								catch(e){}
							}
						catch(e){}
						break;
			// SHOW BUBBLE
			case 1 :	try{	param = "position:absolute;top:"+t_pos+"px;left:"+l_pos+"px;background:url('"+bubble_root+"circle_purple.png') center no-repeat;";
								tmpNode.setAttribute("style",param,"false");
								try{	tmpNode.style.setAttribute("background","url('"+bubble_root+"circle_purple.png') center no-repeat","false");	}
								catch(e){}
							}
						catch(e){}
						break;
			default : break;
		}
	}
}

// ++++++++++++++++++++++++++++++++ TEAM

//function dTeam(x,y,id,job,pic)
function dTeam()
{	/*
		*	show / hide team-info area
		*	reposition element according to selected team-member
	*/
	// basic params
	elementID = "detail";// ID for detail-node
	display_height = 188;// detail height
	nArgs = dTeam.arguments.length;
	tmpNode = document.getElementById(elementID);

	if(nArgs>0)
	{	teamID = dTeam.arguments[dTeam.arguments.length-1];	
		// get team- & member-position in tData
		// get values from array tData for member
		team = teamID.split("_")[0];
		member = teamID.split("_")[1];
		
		x = tData[team][member][0];
		y = tData[team][member][1];
		id = tData[team][member][2];
		job = tData[team][member][3];
		pic = tData[team][member][4];
		
		//pic_path = "http://www.praxis-am-savignyplatz.de/pics/team/"+pic;
		pic_path = "/./pics/team/"+pic;
	}
		
	show = (nArgs > 0 ) ? true : false;
	//check, if job-description exceeds 1 line
	nLines = 0;
	if(show)
	{	if(job!=null)
		{	tmp = job.split("<br>");
			if(tmp.length>1)
			{	nLines = tmp.length-1;
				display_height += (nLines)*14;	
			}
		}
		if(id!=null)
		{	t = id.split("<br>");
			if(t.length>1)
			{	
				display_height += (t.length-1)*4;
			}
		}
		// create team-info for selected member
		tmpNode.innerHTML = "<img src='"+pic_path+"' border='0'><br><b>"+id+"</b><br>"+job;
		xpos = (x - 54);
		ypos = (y - (display_height+8));
	}
	else
		tmpNode.innerHTML = "";
	
	switch(show)
	{	// SHOW Info
		case true :
		try{
			param = "position:absolute;top:"+ypos+"px;left:"+xpos+"px;height:"+display_height+"px;visibility:visible;";
			tmpNode.setAttribute("style",param,"false");
			try{// MS-approach
				tmpNode.style.setAttribute("visibility","visible","false");		
				tmpNode.style.setAttribute("top",ypos+"px","false");
				tmpNode.style.setAttribute("left",xpos+"px","false");
				tmpNode.style.setAttribute("height",display_height+"px","false");
			}catch(e){}
		}catch(e){}
		break;			
		// HIDE info
		case false :
		try{
			tmpNode.setAttribute("style","visibility:hidden","false");
			try{
				tmpNode.style.setAttribute("visibility","hidden","false");
			}catch(e){}
		}catch(e){}
		break;
		default : break;
	}	
}

// ++++++++++++++++++++++++++++++++ INFO-POPUPS

function showInfo(nodeID,IO)
{	/**
		* display/hide info-popup
	*/
	nodeLabels = new Array("info_content","aktuell_content");
	infoNode = nodeLabels[nodeID];
	
	popups = new Array(new Array(4,136),new Array(5,112));
	
	w_default = 0;
	h_default = 0;
	w_max = 480;
	h_max = 524;
		
	if(showInfo.arguments.length>2)	nAssets = showInfo.arguments[2];
		
	/*
	// DECREASE HEIGHT, IF NUMBER OF ENTRIES EXCEEDS LIMIT
	if(nAssets>popups[nodeID][0])
		h_max += (nAssets-popups[nodeID][0])*popups[nodeID][1];
	*/
	tmpString_default = "width:"+w_default+"px;height:"+h_default+"px;";
	tmpString_max = "width:"+w_max+"px;height:"+h_max+"px;";

	// set popups TO MAX
	if(IO==true)
	{	try	{	document.getElementById(infoNode).setAttribute("style","visibility:visible","false");
				document.getElementById(infoNode).setAttribute("style",tmpString_max,"false");
				try	{	document.getElementById(infoNode).style.setAttribute("visibility","visible","false");
						document.getElementById(infoNode).style.setAttribute("width",w_max,"false");
						document.getElementById(infoNode).style.setAttribute("height",h_max,"false");		
					}	catch(e)	{	}
			}	catch(e)	{	}
	}
	
	// reset popups TO DEFAULT
	if(IO==false)
	{	try	{	document.getElementById(infoNode).setAttribute("style","visibility:hidden;","false");
				document.getElementById(infoNode).setAttribute("style",tmpString_default,"false");
				try	{	document.getElementById(infoNode).style.setAttribute("visibility","hidden","false");
						document.getElementById(infoNode).style.setAttribute("width",w_max,"false");
						document.getElementById(infoNode).style.setAttribute("height",h_max,"false");
					}catch(e)	{	}
			}	catch(e)	{	}
	}
}

// ++++++++++++++++++++++++++++++++ EMBED



function embedLogo()
{	/**
		*	embed animated logo (swf-file) with header content 
		*	if javascript is deactivated jpg is used instead 
	*/
if(document.getElementById("logo"))
	{	tmp = document.getElementById("logo");
		tmpHTML = "";
		// rewrite content for validation purposes!!
		tmpHTML += "<noembed><img src=\""+baseDIR+"pics/logo_noflash.jpg\" border=\"0\" alt=\"\" title=\"logo\"></noembed>\n";
		tmpHTML += "<embed src=\""+baseDIR+"media/ani_logo.swf\" quality=\"high\" alt=\"Zahnarztpraxis am Savignyplatz\" bgcolor=\"#ffffff\" width=\"72\" height=\"74\" name=\"ani_logo\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n";
		tmpHTML += "<p><img src=\""+baseDIR+"pics/logo_text_neu.png\" border=\"0\" alt=\"Zahnmedizinische Fachzentrum am Savignyplatz - Dr. Johannes Czerwinski & Kollegen\"></p>";
		/*
		tmpHTML += "<p><em class=\"t1\">Zahnmedizinisches Fachzentrum</em>";
		tmpHTML += "<br><em class=\"t1_b\">am Savignyplatz</em><br>";
		tmpHTML += "<em class=\"t2\">Dr. Johannes Czerwinski & Kollegen</em></p>";
		*/
		tmp.innerHTML = tmpHTML;
	}
}

function embed_object(node_id,obj_name,w,h)
{	/**
		*	embed object (obj_name) in element (node_id) with parameters width (w) and height (h)
		*	same functionality as embedLogo() -- but with more general parameters
	*/
	tmp = document.getElementById(node_id);
	if(document.getElementById(node_id))
	{	obj_source = swf_root+""+obj_name+".swf";
		tmpHTML = "";
		tmpHTML += "<noembed>the object cannot be shown<br>please use another browser</noembed>";
		tmpHTML += "<embed src=\""+obj_source+"\" quality=\"high\" bgcolor=\"#ffffff\" width=\""+w+"\" height=\""+h+"\" name=\""+obj_name+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n";
		tmp.innerHTML = tmpHTML;
	}
}

function embed_BG_object(obj_name,w,h)
{	/**
		*	same functionality as embed_object (size and location is fixed)
		*	!!param: wmode = transparent allows swf-objects to be placed in lower <div>s
	*/
	node_id = "bgIMG";
	if(document.getElementById(node_id))
	{
		tmp = document.getElementById(node_id);
		node_id = "bgIMG";
		obj_source = obj_name+".swf";
		tmpHTML = "";
		tmpHTML += "<noembed>the object cannot be shown<br>please use another browser</noembed>";
		tmpHTML += "<embed src=\""+swf_root+""+obj_source+"\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#ffffff\" width=\""+w+"\" height=\""+h+"\" name=\""+obj_name+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n";
		tmp.innerHTML = tmpHTML;
	}
}

function swap_BG_image_text(bgImg,infoText,cPic)
{	/**
		*	change content of elements (tmpNodeA / tmpNodeB)
		*	needed for image-navigation @ 'home-->praxis'
	*/
	tmpNodeA = document.getElementById("bgIMG");
	tmpNodeB = document.getElementById("bgInfo");
	tmpHTML_A = "<img src='"+bgImg[cPic]+"' border='0' alt='bild'>";
	tmpHTML_B = infoText[cPic];
	tmpNodeA.innerHTML = tmpHTML_A;
	tmpNodeB.innerHTML = tmpHTML_B;
}