
function tabswitch(o) {
pn = o.parentNode;
o = pn.nextSibling;
	if (!o) return false;
	if (o.nodeType == 3) o = o.nextSibling;
	if (pn.id == 'tab2') to = 'tab1';
		else to = 'tab2';
pn.className = 'sel';
o.className = 'sel';
document.getElementById(to).className = '';
r = document.getElementById(to).nextSibling;
	if (r.nodeType == 3) r = r.nextSibling;
r.className = 'hide';
return true;
}

function bg(o,w) {
if(!o) w.style.background='#e7f7cc';
	else {
		if (o == 'dark') w.style.background='#f0fae1';
		else w.style.background='#fff';
	}
}

function textCounter( field, countfield, maxlimit ) {
  if ( field.value.length > maxlimit )
  {
    field.value = field.value.substring( 0, maxlimit );
    //alert( 'Maksimalno &#353;tevilo &#269;rk je prese&#382;eno.' );
    return false;
  }
  else
  {
    countfield.value = maxlimit - field.value.length;
  }
}

function showLines(max, text) {
max--;
text = "" + text;
var temp = "";
var chcount = 0; 
for (var i = 0; i < text.length; i++) // for each character ... 
{   
var ch = text.substring(i, i+1); // first character
var ch2 = text.substring(i+1, i+2); // next character
if (ch == '\n') // if character is a hard return
{  
temp += ch;
chcount = 1;
}
else
{
if (chcount == max) // line has max chacters on this line
{
temp += '\n' + ch; // go to next line
chcount = 1; // reset chcount
}
else  // Not a newline or max characters ...
{
temp += ch;
chcount++; // so add 1 to chcount
      }
   }
}
return (temp); // sends value of temp back
}
