/*	Aktuelle XP Revision: $Revision: 1.2 $
	Letzte XP Aenderung am: $Date: 2006/01/11 15:25:37 $ GMT */
/* for the IE only workarounds */
var ie = (document.all) ? true : false;
/* to get rid of the pre-text in inputs */
/* needs two functions, if a ...... user enters the default Value... */
function onFocusCheckEntry(which, cont, colorChange) {
	if(cont !=  "dummy" && which.value == cont) {
		which.value = "";
	}
}

function onBlurCheckEntry(which, cont, colorChange) {
	if(cont !=  "dummy" && which.value == '') {
		which.value = cont;
	}
}

/* Opens a new Window */
var mediencenter = null;
function openWin() {
	if (mediencenter != null && mediencenter.closed == false) mediencenter.close();
	mediencenter = window.open("darsteller.html", "mediencenter", "");
	mediencenter.focus();
}

/*rr: barrierearme sendungsdropdowns incl. title mit ziel popup oder self*/
function dropdownpopup(formsendungauswahl) { 
 var myindex=formsendungauswahl.sendungsdropdown.selectedIndex; 
 if(document.getElementById('formsendungauswahl').sendungsdropdown.options[myindex].value !="0") {
  if (document.getElementById('formsendungauswahl').sendungsdropdown.options[myindex].title == "Externer Link") {
   window.open(formsendungauswahl.sendungsdropdown.options[myindex].value,target="","");
   }
 else {
  window.location.href=formsendungauswahl.sendungsdropdown.options[myindex].value;
  }
 }
}

function dropdownJJ(myform) { 
 var myindex=myform.list.selectedIndex; 
 if(myform.list.options[myindex].value !="0") {
  if (myform.list.options[myindex].title == "Externer Link") {
   window.open(myform.list.options[myindex].value,target="","");
   }
  else {
   window.location.href=myform.list.options[myindex].value;
   }
  }
}


/* ALTLASTEN */
this.window.name = "DasErste";

var dasErstePopupWin=0;
var dasErsteFlexiWin=0;
var dasErsteFlexiParamWin=0;
var dasErsteMediathekWin=0;

function DasErstePopup(tTarget,tWx,tWy) {
 if (dasErstePopupWin)
  if(!dasErstePopupWin.closed) 
   dasErstePopupWin.close();

 dasErstePopupWin=window.open(tTarget,"DasErstePopup","width="+tWx+",height="+tWy+""); 
 dasErstePopupWin.focus(); 
}

function DasErstePopup2(tTarget,tWx,tWy) {
 if (dasErstePopupWin)
  if(!dasErstePopupWin.closed) 
   dasErstePopupWin.close();

 dasErstePopupWin=window.open(tTarget,"DasErstePopup2","width="+tWx+",height="+tWy+""); 
 dasErstePopupWin.focus(); 
}

function DasErstePopupBrennpunkt(tTarget,tWx,tWy) {
 if (dasErstePopupWin)
  if(!dasErstePopupWin.closed) 
   dasErstePopupWin.close();

 dasErstePopupWin=window.open(tTarget,"DasErstePopupBrennpunkt","scrollbars=yes,width="+tWx+",height="+tWy+""); 
 dasErstePopupWin.focus(); 
}

function DasErstePopupscroll(tTarget,tWx,tWy) {
 if (dasErstePopupWin)
  if(!dasErstePopupWin.closed) 
   dasErstePopupWin.close();
 dasErstePopupWin=window.open(tTarget,"DasErstePopup","scrollbars=yes,width="+(Number(tWx)+1)+",height="+(Number(tWy)+1)+""); 
 dasErstePopupWin.focus(); 
}

function DasErsteFlexiPopup(tTarget,tName,tWx,tWy) {
 if (dasErsteFlexiWin)
  if(!dasErsteFlexiWin.closed) 
   dasErsteFlexiWin.close();

 dasErsteFlexiWin=window.open(tTarget,tName,"width="+tWx+",height="+tWy+""); 
 dasErsteFlexiWin.focus(); 
}

function DasErsteFlexiParamPopup(tTarget,tName,tWx,tWy,tParam) {
 if (dasErsteFlexiParamWin)
  if(!dasErsteFlexiParamWin.closed) 
   dasErsteFlexiParamWin.close();

 dasErsteFlexiParamWin=window.open(tTarget,tName,"width="+tWx+",height="+tWy+","+tParam+""); 
 dasErsteFlexiParamWin.focus(); 
}

function DasErstePopupExt(tTarget,tWx,tWy) {
 dasErstePopupWin=window.open(tTarget,"DEOPopup"+checksum(tTarget),"scrollbars=yes,width="+(Number(tWx)+1)+",height="+(Number(tWy)+1)+""); 
 dasErstePopupWin.focus(); 
}


function stopsubmit() {  
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("Die Formular Daten wurden bereits verschickt. Vielen Dank!");
      return false;
      }
   }
   

function DasErstePopupMediathek(tTarget) {
// if (dasErsteMediathekWin)
//  if(!dasErsteMediathekWin.closed) 
//   dasErsteMediathekWin.close();
 dasErsteMediathekWin=window.open(tTarget,"daserstemediathek","scrollbars=yes,resizable=yes,width=1024,height=711");
 dasErsteMediathekWin.focus(); 
}




/*   Teaser    */
function showteaser(a1,a2) {
	this.clearInterval(aniInterval[a1]);
	for (i = 0; i < 4; i++)
		if (document.getElementById('teaser_'+a1+'_'+i)) 
			if (document.getElementById('teaser_'+a1+'_'+i).style.visibility != "hidden") {
 				FadeOpacity('teaser_'+a1+'_'+i, 50, 0, 100, 15);
			}
	FadeOpacity('teaser_'+a1+'_'+a2, 70, 100, 100, 15);
}

var a, b, curanis, maxanis; curanis = 0;
var aniPosition = new Array(10);
var aniInterval = new Array(10);
function initiateAnis() {
	for (a = 0; a < 10; a++) 
		aniPosition[a] = 0;

	maxanis = 2;

	for (a = 1; a <= 9; a++)
		if (document.getElementById('teaser_'+a+'_1'))
			if (curanis < maxanis) {
				++curanis;
				for (b = 1; b < 4; b++)
					if (document.getElementById('teaser_'+a+'_'+b))
						document.getElementById('teaser_'+a+'_'+b).style.visibility = "hidden";
				aniInterval[a] = this.setInterval('autoteaser('+a+');', 7000);
				}
    a = 0;
	if (document.getElementById('teaser_'+a+'_1')) {
		for (b = 1; b < 4; b++)
			if (document.getElementById('teaser_'+a+'_'+b))
				document.getElementById('teaser_'+a+'_'+b).style.visibility = "hidden";
		aniInterval[a] = this.setInterval('autoteaserimage('+a+');', 7000);
		}

}

function autoteaser(teasnr) {
	++aniPosition[teasnr];
	if (!document.getElementById('teaser_'+teasnr+'_'+aniPosition[teasnr]))
		aniPosition[teasnr] = 0;
	showinterval(teasnr, aniPosition[teasnr]);
}
function autoteaserimage(teasnr) {
	++aniPosition[teasnr];
	if (!document.getElementById('teaser_'+teasnr+'_'+aniPosition[teasnr]))
		aniPosition[teasnr] = 0;
	showintervalimage(teasnr, aniPosition[teasnr]);
}
function showinterval(a1,a2) {
	for (i = 0; i < 4; i++)
		if (document.getElementById('teaser_'+a1+'_'+i))
			if (document.getElementById('teaser_'+a1+'_'+i).style.visibility != "hidden") {
				FadeOpacity('teaser_'+a1+'_'+i, 50, 0, 250, 15);
			}
	FadeOpacity('teaser_'+a1+'_'+a2, 70, 100, 250, 15);
}
function showintervalimage(a1,a2) {
	for (i = 0; i < 6; i++)
		if (document.getElementById('teaser_'+a1+'_'+i))
			if (document.getElementById('teaser_'+a1+'_'+i).style.visibility != "hidden") {
				FadeOpacity('teaser_'+a1+'_'+i, 100, 0, 1200, 15);
			}
	FadeOpacity('teaser_'+a1+'_'+a2, 10, 100, 600, 20);
}



function showgallery(a1,a2,a3) {
	for (i = 0; i < 21; i++)
		if (document.getElementById('teaser_'+a1+'_'+a2+'_'+i))
			document.getElementById('teaser_'+a1+'_'+a2+'_'+i).style.visibility = "hidden";
	document.getElementById('teaser_'+a1+'_'+a2+'_'+a3).style.visibility = "visible";
}





//*** zoom function images ***/
var zoomed;
 zoomed = false;

function zoomin(normalbild, normalbildbreite, zoombild, zoombildbreite, bildnr, color) {
 
 var tvtippwrapperID;
 var tvtippimageID;
 var tvtipplupeID;

 ImgObjWrapperID	= "ImgObjWrapper" + bildnr;
 ImgObjImageID		= "ImgObjImage" + bildnr;
 ImgObjLupeID		= "ImgObjLupe" + bildnr;
 ImgObjLinkID		= "ImgObjLink" + bildnr;
 ImgObjLinkLupeID	= "ImgObjLinkLupe" + bildnr;

 if (!zoomed) {
 	zoomed = true;
	document.getElementById(ImgObjImageID).src = zoombild;
	document.getElementById(ImgObjImageID).style.width = zoombildbreite + 'px';
	document.getElementById(ImgObjWrapperID).style.width = zoombildbreite + 'px';
	if (color == 'white') 
		{
		document.getElementById(ImgObjLupeID).src = 'http://www.daserste.de/cmspix/icons/FFFFFF/icn_38.gif';
		}
	else 
		{
		document.getElementById(ImgObjLupeID).src = 'http://www.daserste.de/cmspix/icons/000000/icn_38.gif';
		}
	document.getElementById(ImgObjLupeID).alt = 'Bild verkleinern';
	document.getElementById(ImgObjLinkID).title = 'Bild verkleinern';
	document.getElementById(ImgObjLinkLupeID).title = 'Bild verkleinern';
	} 
 else {
 	zoomed = false;
	document.getElementById(ImgObjImageID).src = normalbild;
	document.getElementById(ImgObjImageID).style.width = normalbildbreite + 'px';
	document.getElementById(ImgObjWrapperID).style.width = normalbildbreite + 'px';
	if (color == 'white') 
		{
		document.getElementById(ImgObjLupeID).src = 'http://www.daserste.de/cmspix/icons/FFFFFF/icn_10.gif';
		}
	else
		{
		document.getElementById(ImgObjLupeID).src = 'http://www.daserste.de/cmspix/icons/000000/icn_10.gif';
		}
	document.getElementById(ImgObjLupeID).alt = 'Bild vergrößern';
	document.getElementById(ImgObjLinkID).title = 'Bild vergrößern';
	document.getElementById(ImgObjLinkLupeID).title = 'Bild vergrößern';
	} 
}


function checksum(klarText){
	var checksum=0;
	for(var i=0; i<klarText.length; i++) {
		var encodedChar=klarText.charCodeAt(i);
		checksum=encodedChar+checksum;
	}
	return checksum;
}

