function is_empty(str)
{
  if(!str)
	return true;
  return str.search("^[ \t\n\r]*$") > -1 ? true : false ;
}

function is_password ( str )
{
  if ( str.length < 6 )
	return false;
  
  return str.search ( "[^a-zA-Z0-9_]{1}" ) > -1 ? false : true;
}

function is_email(str)
{
  //return true;
  return str.search("^([a-zA-Z0-9_]|\\-|\\.)+@(([a-zA-Z0-9_]|\\-)+\\.)+[a-zA-Z]{2,4}\$") > -1 ? true : false ;
}

function is_number ( str )
{
  uint = str.replace( /[ ]/g, "");
  if ( str.length == 0 )
    return false;
  return uint.search ( "([^0-9]{1})" ) != -1 ? false : true;
}

function is_checked(theForm, inputName)
{
  
  if ( theForm.elements[inputName] )
  {
    if ( theForm.elements[inputName].length )
    {
	  
  	  for ( i = 0 ; i<theForm.elements[inputName].length; i ++)
	  {
		if ( theForm.elements[inputName][i].checked )
		{
		   return true;
		}
	  }
	}
  }
  else
  {
	  inputName2=inputName+"[]";

	  if(theForm.elements[inputName2].length)
	  {
		for ( i = 0 ; i<theForm.elements[inputName2].length; i ++)
		{
		  if ( theForm.elements[inputName2][i].checked )
		  {
		   return true;
		  }
		}
	  }
	  else
		 	
	  {
		if ( theForm.elements[inputName].checked )
		  return true;		  		
	  }
  }
  
  return false;
}


function OpenPopUp_NoScroll(win_name,x,y){
	var sw1;
	var param = "toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,screenX=0,screenY=0,width="+x+",height="+y+",top=0,left=0";
	sw1 = window.open( win_name, "window1", param );
	sw1.focus();
}



/////////////////////////////////// POZE VIWER //////////////////////////////////////////////////////

poza_afisata = "";

function poza(p, txt)
{
    var newImg = new Image();
    newImg.src = p;
    w = newImg.width;
    h = newImg.width;

    //l = (screen.width - w) / 2;
    //t = (screen.height - h) / 2;
    if (document.body.clientWidth > w) {
        l = (document.body.clientWidth - w) / 2;
    }
    else {
        l = 5;
    }

    if (document.body.clientHeight > h) {
        t = (document.body.clientHeight - h) / 2;
    }
    else {
        t = 5;
    }
    
    document.getElementById("divPoza").style.left = l + 'px';
    document.getElementById("divPoza").style.top = t + 'px';
    
      if(document.getElementById("divPoza").style.visibility == "hidden")
      {
          document.getElementById("imgPoza").src = p;
            poza_afisata = p;
            document.getElementById("divPoza").style.visibility = "visible";
      }
      else
      {
            if (poza_afisata == p)
            {
                  document.getElementById("divPoza").style.visibility = "hidden";
            }
            else
            {
                  document.getElementById("imgPoza").src = p;
                  poza_afisata = p;
            }
      }
      
      document.getElementById("divText").innerHTML = txt;
}


function ascunde_poza()
{
    document.getElementById('divPoza').style.visibility = 'hidden';
}
