function persispopup(param)
{
  link = "https://persis.swr.de/persis/main?" + param;
  popup2(link, 660, 600,'persis');

}

function emailpopup(mailid, typ, schemaid, wellenid)
{
  link = "/kontakt/index.php?modus=popup&mailid="+mailid+"&type="+typ+"&schema_id="+schemaid+"&wellen_id="+wellenid;
  popup(link,540,540);
}


function emailpopup2(mailid, typ, wellenid, bundeslandid)
{
  link = "/kontakt/index.php?modus=popup&mailid="+mailid+"&type="+typ+"&bundesland_id="+bundeslandid+"&wellen_id="+wellenid;
  popup(link,540,540);
}

function emailpopup3(progid)
{
  link = "/kontakt/index.php?modus=popup&prog_id="+progid;
  popup(link,540,540);
}

function emailpopup4(progid,mailid,typ)
{
  link = "/kontakt/index.php?modus=popup&prog_id="+progid+"&mailid="+mailid+"&type="+typ;
  popup(link,540,540);
}

function popup(url, w, h)
{
  var now = new Date();
  var name = "Popup" + now.getTime();
  window.open(url,name,"width="+w+",height="+h+",resizable=yes,scrollbars=yes");
}

function popup2(url, w, h, name)
{
  window.open(url,name,"width="+w+",height="+h+",resizable=yes,scrollbars=yes");
}

function popup2_forum(url, w, h, name)
{
  window.open(url,name,"width="+w+",height="+h+",resizable=yes,scrollbars=yes,status=yes,toolbar=yes");
}

function popup3(url, w, h, name)
{
  window.open(url,name,"width="+w+",height="+h+",resizable=no,scrollbars=no");
}

function stdpopup(url, groesse)
{
  if(groesse==1)  // kleines Popup + 20px fuer Scrollbalken
    popup(url, 440, 250);
  if(groesse==2)  // mittleres Popup + 20px fuer Scrollbalken
    popup(url, 440, 350);
  if(groesse==3)  // grosses Popup + 20px fuer Scrollbalken
    popup(url, 440, 450);
  if(groesse==4)  // ganz grosses Popup + 20px fuer Scrollbalken
    popup3(url, 440, 600,'440x600');
}

function emailtofriend()
{
  popup("/cgi-bin/emailtofriend.pl?which=show&url="+location.pathname+"&search="+escape(location.search), 470, 440);
}

function bookmark()
{
  var ver = navigator.appName;
  var num = parseInt(navigator.appVersion);

  if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
    window.external.AddFavorite(location.href, document.title);
  }
  else {
    alert("Leider kann Ihr Browser nicht automatisch einen Bookmark setzen. Bitte benutzen Sie statt dessen die Tastenkombination 'Strg-D'.");
  }
}

function zoompic(url, w, h)
{
  popup("/imperia/showpic.php?url="+url, w+40, h+65);
}

function zoompic2(url, w, h, bu, iso)
{
  if ((bu) && (bu != "")) {
    var reg = /\s+/g;
    var neu = bu.replace(reg, "_");
    if ((iso) && (iso != "")) {
      popup("/imperia/showpic.php?url="+url+"&bu="+neu+"&iso="+iso, w+40, h+85);
    }
    else {
      popup("/imperia/showpic.php?url="+url+"&bu="+neu, w+40, h+85);
    }
  }
  else  {
    popup("/imperia/showpic.php?url="+url, w+40, h+85);
  }
}

function gallery(groupid, galleryid, w, h, img)
{
  if (groupid=="")
    groupid=0;
  if (w < 380)  { w = 380; }
  if (h < 470)  { h = 470; }
  if (img != "")  {
    popup("/imagegallery/index.php?group="+groupid+"&gallery="+galleryid+"&image="+img, w, h);
  }
  else  {
    popup("/imagegallery/index.php?group="+groupid+"&gallery="+galleryid, w, h);
  }
}

function surfto(form) {
  var myindex=form.dest.selectedIndex;

  if(form.dest.options[myindex].value!="")
    location = form.dest.options[myindex].value;
}

function surfto2(form, pull) {
  var myindex=document.forms[form].elements[pull].selectedIndex;

  if(document.forms[form].elements[pull].options[myindex].value!="")  {
    var test = document.forms[form].elements[pull].options[myindex].value;
    var ergebnis = test.match(/http:/gi);
    if (ergebnis != null) {
      window.open(test);
    }
    else  {
      parent.location = test;
    }
  }
}

function SelectItem(SelectBox, Item, Type)
{
var lv=0;
for (lv=0;(lv < SelectBox.options.length);lv++)
{
  if (Type == "TEXT")
  {
   if (SelectBox.options[lv].text == Item)
   {
    SelectBox.options[lv].selected = true;
    return true;
   }
  }
  else
  {
   if (Type == "VALUE")
   {
    if (SelectBox.options[lv].value == Item)
    {
     SelectBox.options[lv].selected = true;
     return true;
    }
   }
   else
   {
    return false;
   }
  }
}
return false;
}



function selSucheDatum()
{
   heute = new Date();

   year = heute.getFullYear();
   month = heute.getMonth()+1;
   day =  heute.getDate();


   if(month < 10) {month ="0".month;}
   if(day< 10) {day ="0".day;}

    if ( SelectItem(document.forms["imperia"].elements["endyear"], String(year), "VALUE") != true)
   {}
   if ( SelectItem(document.forms["imperia"].elements["endmon"], String(month), "VALUE") != true)
   {}
    if ( SelectItem(document.forms["imperia"].elements["endday"], String(day), "VALUE") != true)
   {}

   startyear = document.forms["imperia"].elements["defaultyear"].value;
   startmonth = document.forms["imperia"].elements["defaultmon"].value;
   startday =  document.forms["imperia"].elements["defaultday"].value;


   if ( SelectItem(document.forms["imperia"].elements["startyear"], String(startyear), "VALUE") != true)
   {}
   if ( SelectItem(document.forms["imperia"].elements["startmon"], String(startmonth), "VALUE") != true)
   {}
    if ( SelectItem(document.forms["imperia"].elements["startday"], String(startday), "VALUE") != true)
   {}

}

function checknl(Emailshift)
{
  var Email = /^[a-zA-Z0-9-\.\_]+@[a-zA-Z0-9-\_]+\.[a-zA-Z-\.\_]+$/
  var alerttxt = "Bitte überprüfen Sie:\n";
  var iserror = false;
  if(Emailshift=="") {
    iserror = true;
    alerttxt += "\nBitte geben Sie eine E-Mailadresse an.";
  } else {
    if(!Email.test(Emailshift)) {
      iserror = true;
      alerttxt += "\nDas E-Mailformat stimmt nicht z.B. name@domain.de";
    }
  }
  if(iserror) {
    alert(alerttxt);
    return false;
  } else {
    return true;
  }
}


function webplayer(url, type, id, media,descr,descr_long) {
                //alert(descr +" - "+descr_long);
                //alert(descr.indexOf("\""));
                //alert(escape(descr_long));

    var isNav4, isIE4,height;
    var which = null;
    if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
        isNav4 = (navigator.appName == "Netscape") ? 1 : 0;
        isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
      }

    if (media=="audio")
    {height=300; }
    else
    {height=447; }
	
	if (navigator.appName.indexOf("Microsoft") != -1) {
		height = height + 100
	}



    if(isNav4){
        wwin = window.open("/mediaplayer/player/webplayerframes.php?nurl=" + escape(url) + '&prog_id=' + id + '&type=' + type + '&media=' + media+ '&descr='+escape(descr)+ '&descr_long='+escape(descr_long),"Webradio","width=440,height=' + height+ ',resizable=no,scrollbars=no");
        wwin.focus();
    } else{
        wwin = window.open("/mediaplayer/player/webplayerframes.php?nurl=" + escape(url) + '&prog_id=' + id + '&type=' + type + '&media=' + media+ '&descr='+escape(descr)+ '&descr_long='+escape(descr_long),"Webradio","width=440,height=' + height+ ',resizable=no,scrollbars=no");
        wwin.focus();
    }

  }


function loadImages() {
  var browser = true;
  if(browser){
    var page = top.document.location.pathname;
    // fuehrenden Slash entfernen, wenn vorhanden
    if (page.substring(0,1) == "/") {
      page = page.substring(1, page.length);
    }

    // wenn ein weiterer Slash vorhanden ist,
    // werden die Standard-GIFs geladen
    // fuer Ansicht in Imperia "homepage" abgefragt
    butObject['start']= new obData("http://www.swr.de/swr_standard/gfx/navig/navi_start_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_start_cms_a.gif","start");
    butObject['nachrichten']=new obData("http://www.swr.de/swr_standard/gfx/navig/navi_nachrichten_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_nachrichten_cms_a.gif","nachrichten");
    butObject['ratgeber']=new obData("http://www.swr.de/swr_standard/gfx/navig/navi_ratgeber_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_ratgeber_cms_a.gif","ratgeber");
    butObject['kultur']=new obData("http://www.swr.de/swr_standard/gfx/navig/navi_kultur_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_kultur_cms_a.gif","kultur");
    butObject['regionen']=new obData("http://www.swr.de/swr_standard/gfx/navig/navi_regionen_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_regionen_cms_a.gif","regionen");
    butObject['radio']=new obData("http://www.swr.de/swr_standard/gfx/navig/navi_radio_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_radio_cms_a.gif","radio");
    butObject['fernsehen']=new obData("http://www.swr.de/swr_standard/gfx/navig/navi_fernsehen_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_fernsehen_cms_a.gif","fernsehen");
    butObject['unternehmen']=new obData("http://www.swr.de/swr_standard/gfx/navig/navi_unternehmen_cms.gif","http://www.swr.de/swr_standard/gfx/navig/navi_unternehmen_cms_a.gif","unternehmen");
  }
}

function obData(repImage, resImage, obNr) {
  this.obNr=obNr;
  this.simg = new Image();
  this.simg.src=repImage;
  this.rimg = new Image();
  this.rimg.src=resImage;
}

function resImage(name) {
  nr=butObject[name].obNr;
  document.images[nr].src=butObject[name].simg.src;
}

function repImage(name){
  nr=butObject[name].obNr;
  document.images[nr].src=butObject[name].rimg.src;
}

var butObject=new Array();
loadImages();

function setStartseite() {
  if (document.getElementById) {
    document.getElementById("setstart").style.behavior= "url(#default#homepage)";
    document.getElementById("setstart").sethomepage("http://www.swr.de/");
  }
  else if (document.all) {
    document.all.setstart.style.behavior= "url(#default#homepage)";
    document.all.setstart.sethomepage("http://www.swr.de/");
  }
}


function startWebradio() {
 var wwin = window.open('/mediaplayer/webradio.php?type=all&sch_id=47','Webradio','width=520,height=505,resizable=yes,scrollbars=yes');
 wwin.focus();
}
function ticker_popup (id_ticker,limit,kopf,style)
{
 var id_ticker = id_ticker;
 var limit     = limit;
 var kopf      = kopf;
 var style     = style;

 var params = 'id_ticker=' + id_ticker;

 if (limit){
  params = params + '&limit=' + limit;
 }

 if (kopf){
  params = params + '&kopf=' + kopf;
 }

 if (style){
  params = params + '&style=' + style;
 }

 T1 = window.open("/musikticker/ticker.php?" + params,"Newsticker","width=360,height=600,left=0,top=0");
 T1.focus();
}


