﻿function startCountDown(obj_id, rurl, time_in_sec)
{
    if (time_in_sec == null ||  time_in_sec == "")
        time_in_sec = 10;
        
    var obj = document.getElementById(obj_id);
    if (obj == null || obj == 'undefined')
        return;
    else
    {
        
        if (time_in_sec == 0)
        {
            document.location = rurl;
            return;
        }
        
        var secTxt = (time_in_sec == 1 ? "sekunde " : "sekunde ");
        obj.innerText = time_in_sec + " " + secTxt ;
        
        var next_time_in_sec = time_in_sec - 1;
        setTimeout("startCountDown('" + obj_id + "', '" + rurl + "', '" + next_time_in_sec + "')", 1000);
    }   
}

function textCounter(field,cntfield,maxlimit) {
    if (field.value.length > maxlimit) 
        field.value = field.value.substring(0, maxlimit); // if too long...trim it!
    else
    {
        if (document.all)
            cntfield.innerText = field.value.length; // otherwise, update 'characters left' counter
        else
            cntfield.textContent = field.value.length;
    }
}

function iprOpenPicture(imgUrl, w, h, x, y, scrollable)
{
  if (w == null)
    w = 600;
  if (h == null)
    h = 550;
    
  w += 32;
  h += 96;
  
  if (x == null)
    x = (screen.width - w) / 2;
  if (y == null)
    y = (screen.height - w) / 2;
    
  if (scrollable == null)
    scrollable = "1";
    
  var positionSizeProperty = "width="+w+", height="+h+", left="+x+", top="+y;
  var imgWindow = window.open(imgUrl, "IprImgWin", "status=0, toolbar=0, menubar=0, scrollbars="+scrollable+", resizable=0," + positionSizeProperty);
  imgWindow.focus();
}
