function deleteUmlaute(curText) {

 if (curText == "" || typeof(curText) != 'string' ) return "";
 var result = curText;

 result=result.replace(/ü/g, "ue");
 result=result.replace(/ö/g, "oe");
 result=result.replace(/ä/g, "ae");
 result=result.replace(/Ü/g, "Ue");
 result=result.replace(/Ö/g, "Oe");
 result=result.replace(/Ä/g, "Ae");
 result=result.replace(/ß/g, "ss");

 return result;

}

var first_run=true;

function videoivw(playerName, videoName, lineupID, referenceId) {
  p1 = '';
  p2 = '';
  p3 = '';
  p4 = '';

  // console.log("videoivw");

  if (first_run) {
    // console.log("exiting on first run");
    first_run=false;
    return;
  }  
  
  /* if (document.images["ivwpx"] && (typeof _hbPageView == 'function')) { */
  if (document.images["ivwpx"]) {	  
    /*###### videodata ########################################*/
     p1 = deleteUmlaute(playerName.toString());
     p2 = deleteUmlaute(videoName.toString());     
     if (lineupID) {
        p3 = deleteUmlaute(lineupID.toString());
     }     
     if (referenceId) {
        p4 = deleteUmlaute(referenceId.toString());
     }

    /*###### parameter ########################################*/
    ivw_string = 'http://schowohn.ivwbox.de/cgi-bin/ivw/CP/1023280;378,,Brightcove_'+ p1 +':'+ p2 +':'+ p3 +',?p='+ (Math.random()*100000);
    hbx_para_1 = "Brightcove_"+p1+":"+p2+"";
    hbx_para_Download = hbx_para_1+".flv";

    /*###### Videocenter ########################################*/
    hbx_para_2 = "/video/"+p3+"/"+p4;
        //1. IVW-Count
    document.images["ivwpx"].src = ivw_string;
    //2. HBX-Count
    _hbPageView(hbx_para_1, hbx_para_2);
    // 3. HBX-Download
    _hbDownload(hbx_para_Download);
    //console.log("Videocenter:");
    //console.log("_hbPageView("+hbx_para_1+","+hbx_para_2+")");
    //console.log("_hbDownload("+hbx_para_Download+")");

    // 4. GA-Count
    if (typeof pageTracker =='object' && p1 == 'VideoArtikel' ) {
      pageTracker._trackPageview("/video-dl/"+ escape(p2) + "/" +document.location.pathname+document.location.search);
    }
    else {
      pageTracker._trackPageview(hbx_para_2);
    }

    //console.log("pageTracker._trackPageview("+hbx_para_2+")");
    //console.log("Finish");
  }
}


