private int getDownPos(String text, int cpos)
	{
		String[] lines = text.split("\n");
        int line = 0;
        int tmp = cpos;
        while(tmp > 0)
        {
            tmp -= lines[line].length() + 1;
            line++;
        }
        
        line--;
        
        
        int all = 0;
        for(int i = 0; i < line; i++)
        {
            all += lines[i].length()+1;
        }
        
        int dif = cpos - all;
        
        if(line == -1)
        	line++;
        
        if(line == lines.length-1)
        	return cpos;
        
        
        if(dif == lines[line].length()+1)
        {
            dif = 0;
            line++;
        }
        else if(dif >= lines[line+1].length()+1)
        {
            dif = lines[line+1].length();
        }
        
        int t = 0;
        for(int i = 0; i < line+1; i++)
        {
            t += lines[i].length()+1;
        }
        return t+dif;
	}