var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

var dragswitch=0
var nsx
var nsy
var nstemp


function drag_drop_ns(name){

	if (!ns4)
	return

	temp=eval(name)
	temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
	temp.onmousedown=gons
	temp.onmousemove=dragns
	temp.onmouseup=stopns

}

function gons(e){
	temp.captureEvents(Event.MOUSEMOVE)
	nsx=e.x
	nsy=e.y
}

function dragns(e){

	if (dragswitch==1){
		temp.moveBy(e.x-nsx,e.y-nsy)
		return false
	}

}

function stopns(){
	temp.releaseEvents(Event.MOUSEMOVE)
}



function drag_drop(e){

	if (ie4&&dragapproved){
		crossobj.style.left=tempx+event.clientX-offsetx
		crossobj.style.top=tempy+event.clientY-offsety
		return false
	}

	else if (ns6&&dragapproved){
		crossobj.style.left=tempx+e.clientX-offsetx
		crossobj.style.top=tempy+e.clientY-offsety
		return false
	}

}

function initializiere_drag(e){

	//crossobj=ns6? document.getElementById("einepopupbox") : document.all.einepopupbox

	var firedobj=ns6? e.target : event.srcElement
	var topelement=ns6? "HTML" : "BODY"

	while (firedobj.tagName!=topelement&&firedobj.id!="dragbar"){

		firedobj=ns6? firedobj.parentNode : firedobj.parentElement

	}

	if (firedobj.id=="dragbar"){

		box = findPopupBox(firedobj);
		boxId = box.id;
		crossobj=ns6? document.getElementById(boxId) : document.all[boxId]
		offsetx=ie4? event.clientX : e.clientX
		offsety=ie4? event.clientY : e.clientY
		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)
		dragapproved=true
		document.onmousemove=drag_drop
	}

}

document.onmousedown=initializiere_drag
document.onmouseup=new Function("dragapproved=false")


function LoadAndShowSwf (width, height, src , id, version, base ) {

  if(!id) id='flashMovie';
  if(!version) version='6,0,29,0';
  if(!base) base='/fileadmin/flash/titanflex/';

	flashStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'" width="'+width+'" height="'+height+'"><param name="base" value="'+base+'" /><param name="movie" value="'+src+'"><param name=quality value=high><embed src="'+src+'"  base="'+base+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>';

	document.getElementById(id).innerHTML = flashStr; 

	document.getElementById(id).style.visibility = "visible";

}



function box_zeigen2(boxId){
	LoadAndShowSwf('400','225', 'fileadmin/mandanten/001/images/titanflex/movie/diebrillefuermaenner.swf');
	crossobj=ns6? document.getElementById(boxId) : document.all[boxId]

	if (ie4||ns6)
	crossobj.style.visibility="visible"
	else if (ns4)
	document.einepopupbox.visibility="visible"
}

function box_zeigen2010(boxId){
	document.getElementById("einepopupbox").style.width="400px";
	document.getElementById("einepopupbox").style.left="500px";
	document.getElementById("dragbar").style.width="400px";
	
	LoadAndShowSwf('400','225', 'fileadmin/images/sehhilfen/movie/shilf_film_1.swf');
	crossobj=ns6? document.getElementById(boxId) : document.all[boxId]
	if (ie4||ns6)
	   crossobj.style.visibility="visible"
	else if (ns4)
	   document.einepopupbox.visibility="visible"
}

function box_zeigen2011(boxId, lang){ //Mobilux
	document.getElementById("einepopupbox").style.width="592px";
	document.getElementById("dragbar").style.width="592px";
	document.getElementById("einepopupbox").style.left="350px";
	
	if(lang == "DT"){
		LoadAndShowSwf('592','333', 'fileadmin/images/sehhilfen/movie/Mobilux_DT.swf');
	}
	else if(lang == "FR"){
		LoadAndShowSwf('592','333', 'fileadmin/images/sehhilfen/movie/Mobilux_FR.swf');
	}
	else{
		LoadAndShowSwf('592','333', 'fileadmin/images/sehhilfen/movie/Mobilux_GB.swf');
	}
	crossobj=ns6? document.getElementById(boxId) : document.all[boxId]
	if (ie4||ns6)
	   crossobj.style.visibility="visible"
	else if (ns4)
	   document.einepopupbox.visibility="visible"
	   
	    
}

function box_zeigen4(boxId){

	LoadAndShowSwf('700','550', 'fileadmin/flash/titanflex/TitanFlex.swf', 'tfMovie', '9,0,0,0');
	// LoadAndShowSwf('700','550', 'fileadmin/flash/titanflex/TitanFlex_loop.swf', 'tfMovie', '9,0,0,0');

	crossobj=ns6? document.getElementById(boxId) : document.all[boxId]

	if (ie4||ns6)

	crossobj.style.visibility="visible"

	else if (ns4)

	document.tfpopupbox.visibility="visible"



}







function box_zeigen3(boxId){



	LoadAndShowSwf('750','500', 'http://www.t-90.com/FootBallGame/FussBall01.swf');

	crossobj=ns6? document.getElementById(boxId) : document.all[boxId]

	if (ie4||ns6)

	crossobj.style.visibility="visible"

	else if (ns4)

	document.einepopupbox.visibility="visible"

}







function findPopupBox(obj) {

while(obj.id.indexOf("popupbox") == -1) {

	obj = obj.parentNode;

}

return obj;

}





function box_weg(boxId){

	crossobj=ns6? document.getElementById(boxId) : document.all[boxId]

	if (ie4||ns6){
	crossobj.style.visibility="hidden"

	}

	else if (ns4){
	document[bodId].visibility="hide"

	}
	var par = document.getElementById("flashMovie");
	removeChildrenFromNode(par);
}

function removeChildrenFromNode(node)
{
   if(node == undefined && node == null)
   {
      return;
   }

   var len = node.childNodes.length;

   for(var i = 0; i < len; i++)
   {
      node.removeChild(node.childNodes[i]);
   }
}

function box_zeigen(boxId){

	crossobj=ns6? document.getElementById(boxId) : document.all[boxId]

	if (ie4||ns6)

	crossobj.style.visibility="visible"

	else if (ns4)

	document.einepopupbox.visibility="visible"

}


